diff --git a/.gitignore b/.gitignore
index 3a72b59..03276ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -107,3 +107,6 @@ venv.bak/
.idea/
.vscode/
~*
+
+# UCloud
+.migrate/
diff --git a/.travis.yml b/.travis.yml
index 88e6162..26fd8c4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,40 +2,17 @@
language: python
python:
- - 2.7
+ - 2.7
dist: xenial
sudo: true
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
-install: pip install -U tox-travis
+install: pip install -e .[ci]
# command to run tests, e.g. python setup.py test
-script: tox
+script:
+ - make lint
+ - make test-cov
-before_deploy:
- - pip install -e .[doc]
- - make docs
- - touch docs/build/html/.nojekyll
-
-# deploy new versions to PyPI / GithubIO
-deploy:
- - provider: pages
- skip_cleanup: true
- github_token:
- secure: "hmzSJF/l5S0Wg5gne0EMg4949kCge+FsicBdpTrfARS22cWfhuoBw4U2/1g68vk3CrCDCWjY1MeS8KSnIL7/T1QEgXtiSj218sUmbJqQrw2zJwQ5D+PSih9YkefAH8Gxhnm0y5XNY7WdtxE243eDNBSahhYUvtb7rIH47nCvCP+Hfqwbe6Uh8sFhXyJoBIG48I66GHJ6ogQdSxbeVErGhyOjnhcgLbEDSj9c0CxkqGzaMjLr0eCJyGk11K8cFiJYlk4pL+rDYh6ySq+5gGIUlCPWwDc0eED2SYfPmuKUf36A8M+zOFXmB2MBu05EgVQy8B8pkuaEANOV8/fzRr4tEJkG6rrnfbECCMjMHb5kVzrPKhjJ+YXpoG4nO7uvILVB3F8H521BhDtEFA3bU2h7ptb5fUsGWovbLbA+Od8B5R2l63GrdGO1tp6rDYsOevrs4yt/nSQnY/3Arj558tVYy4nUCBPQu9ERPh1fqSPGGJ137fTPtaqSI2HNLWDMbXhuStda4Jst8NUtrF52lXiPQ1blFwQ6OTFKzF2lGLpAmYJ+IbbmcVZrif7hS163/h1vbthtdQ3DiAre0Zhy+iKLdVqvkO+FbRkY9UaYC94/xdYNOegzfTlrQbehxALbkAdLfIYfQN09Jqg41H1bGzIak9VWTHgPbrpzThVTrLIwCJg="
- local_dir: docs/build/html
- on:
- branch: master
- repo: ucloud/ucloud-sdk-python2
- python: 2.7
- - provider: pypi
- distributions: sdist bdist_wheel
- skip_existing: true
- user: ucloud
- password:
- secure: "t0uGtmntLkofMOwPHvaxhDnIEOsA/wgLejbq2Vf8yDueDpJ7mOhHsFEt7vn+PTFeilRf6N58z9P4eixMMxl6oDktSS1WbL5chaUtRljDeTBN8rL10lbalsc7nUFZL8VGKtf2XljhaSra+jcCGvTPaqEOisDiGJoNm6GPbyR9s+P2mfL0XDTwgyUMHpaG5LcvMU+zpns+uXHurBoCnQrstIah9ylrGnmIhNbN6fU2HLlhVaX9VB7QGwSxQuin3YkTdi1tFN7AToi2oMcg46mXRRf/K4jNTwPOEr0MYZ334PhFB1odaWidOObbxMiRudyGk3pTzH6NFxtgg6PviH999qgWgTBFwBjHvq1DkJatRGH/vDHmgE3t2yS2c1xE8Wgl9ONhUj8MOlaStDn9H4lhbuiT7754yS22ko4mvcxCrqzGqZSp2/vh9UyJ72YcqsvsqUPv5paSmSebsEPxCw3z646CuqGk5cPz3XGj4pxJdhqlvOV3Zl35O3mSRLkCfyNLOTfYsheAaK2sxtbcbJ5fPfQRLsvPdVtInmDBEACdHdVYJJSFw4em+gwnnLDGj74/nHJUAX781XetmWoyP9t5IP+cEuzhYApo4rO8JgaG7v/IZoXcl/h4tHsSev8PD6cqWx2vYIJFtMKej87YjbkU/RJEjQz5NychqL0U3FminTw="
- on:
- branch: master
- tags: true
- repo: ucloud/ucloud-sdk-python2
- python: 2.7
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
diff --git a/Makefile b/Makefile
index 5b7f526..3756938 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,8 @@ endef
export BROWSER_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"
-# UCloud Tools
-GENERATE_TEMPLATE_PATH=../ucloud-api-model-v2/apisdk/lang/python/templates/bash.tpl
+# UCloud Tools Path
+UCLOUD_TEMPLATE_PATH=../ucloud-api-model-v2/apisdk/lang/python/templates
help:
@echo "clean - remove all build, test, coverage and Python artifacts"
@@ -35,19 +35,19 @@ test: clean
pytest
test-cov: clean
- pytest --cov=ucloud
+ pytest --cov=ucloud/core tests/test_core
test-acc: clean
- USDK_ACC=1 pytest --cov=ucloud
+ USDKACC=1 pytest --cov=ucloud
test-all: clean
tox
lint:
- black --check ucloud/
+ @flake8 --exclude=ucloud/services ucloud --ignore=E501,F401
fmt:
- @black ./ucloud
+ @black -l 80 ucloud tests examples
dev:
@pip install -e .[dev]
@@ -80,11 +80,9 @@ clean-test:
migrate:
git clone https://github.com/ucloud/ucloud-sdk-python3.git .migrate
- python scripts/migrate.py --source .migrate/ucloud --output ucloud
- python scripts/migrate.py --source .migrate/tests --output tests
+ PYTHONPATH=. python scripts/migrate --source .migrate/ucloud --output ucloud
+ PYTHONPATH=. python scripts/migrate --source .migrate/tests --output tests
+ PYTHONPATH=. python scripts/migrate --source .migrate/docs --output docs
+ PYTHONPATH=. python scripts/migrate --source .migrate/examples --output examples
+ PYTHONPATH=. python scripts/migrate --source .migrate/README.md --output README.md
rm -rf .migrate
- black ucloud tests
-
-gen:
- ucloud-model sdk apis --lang python2 --type=public --template
- ${GENERATE_TEMPLATE_PATH} --output ./gen.sh
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..f462a42
--- /dev/null
+++ b/README.md
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+
+
+
+
+UCloud SDK Python 2
+
+
+
+
+
+
+
+
+UCloud SDK is a Python client library for accessing the UCloud API.
+
+This client can run on Linux, macOS and Windows.
+
+- Website: https://www.ucloud.cn/
+- Free software: Apache 2.0 license
+- [Documentation](https://ucloud.github.io/ucloud-sdk-python2/)
diff --git a/README.rst b/README.rst
deleted file mode 100644
index 6845410..0000000
--- a/README.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-UCloud SDK Python 2
-===================
-
-UCloud SDK is a Python client library for accessing the UCloud API.
-
-This client can run on Linux, macOS and Windows. It requires Python 2.7 and
-above.
-
-- Website: https://www.ucloud.cn/
-- Free software: Apache 2.0 license
-- `Documentation `_
-
-.. image:: https://img.shields.io/pypi/v/ucloud-sdk-python2.svg
- :target: https://pypi.python.org/pypi/ucloud-sdk-python2/
- :alt: Latest Version
-.. image:: https://travis-ci.org/ucloud/ucloud-sdk-python2.svg?branch=master
- :target: https://travis-ci.org/ucloud/ucloud-sdk-python2
- :alt: Travis CI Status
-.. image:: https://codecov.io/github/ucloud/ucloud-sdk-python2/coverage.svg?branch=master
- :target: https://codecov.io/github/ucloud/ucloud-sdk-python2?branch=master
- :alt: Codecov Status
-.. image:: https://img.shields.io/badge/docs-passing-brightgreen.svg
- :target: https://ucloud.github.io/ucloud-sdk-python2/
- :alt: Doc Status
diff --git a/docs/conf.py b/docs/conf.py
index 83ec3cc..947f332 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,56 +1,11 @@
-# Configuration file for the Sphinx documentation builder.
-#
-# This file only contains a selection of the most common options. For a full
-# list see the documentation:
-# http://www.sphinx-doc.org/en/master/config
+# -*- coding: utf-8 -*-
-# -- Path setup --------------------------------------------------------------
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#
-# import os
-# import sys
-# sys.path.insert(0, os.path.abspath('.'))
-
-
-# -- Project information -----------------------------------------------------
-
-project = 'ucloud-sdk-python2'
+project = 'ucloud-sdk-python3'
copyright = '2019, ucloud'
author = 'ucloud'
-
-
-# -- General configuration ---------------------------------------------------
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
-extensions = [
- 'sphinx.ext.autodoc',
- 'sphinx.ext.doctest',
- 'sphinx.ext.todo',
- 'sphinx.ext.viewcode',
-]
-
-# Add any paths that contain templates here, relative to this directory.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
+ 'sphinx.ext.viewcode']
templates_path = ['_templates']
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
-
-
-# -- Options for HTML output -------------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-#
html_theme = 'alabaster'
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
diff --git a/docs/core.rst b/docs/core.rst
index e6545e5..d9d7cb0 100644
--- a/docs/core.rst
+++ b/docs/core.rst
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
Core
====
diff --git a/docs/helpers.rst b/docs/helpers.rst
index e8192e1..530e036 100644
--- a/docs/helpers.rst
+++ b/docs/helpers.rst
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
Helpers
=======
diff --git a/docs/index.rst b/docs/index.rst
index d84f307..0369d6f 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,10 +1,11 @@
+# -*- coding: utf-8 -*-
+
UCloud SDK Python 2
===================
UCloud SDK is a Python client library for accessing the UCloud API.
-This client can run on Linux, macOS and Windows. It requires Python 2.7 and
-above.
+This client can run on Linux, macOS and Windows.
- Website: https://www.ucloud.cn/
- Free software: Apache 2.0 license
diff --git a/docs/quick_start.rst b/docs/quick_start.rst
index bfc0176..0db589a 100644
--- a/docs/quick_start.rst
+++ b/docs/quick_start.rst
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
QuickStart
==========
diff --git a/docs/services.rst b/docs/services.rst
index 59bfd45..446e90a 100644
--- a/docs/services.rst
+++ b/docs/services.rst
@@ -1,22 +1,24 @@
+# -*- coding: utf-8 -*-
+
UCloud SDK Services
===================
-UDPN
-----
+PathX
+-----
-.. autoclass:: ucloud.services.udpn.client.UDPNClient
+.. autoclass:: ucloud.services.pathx.client.PathXClient
:members:
-UAccount
+StepFlow
--------
-.. autoclass:: ucloud.services.uaccount.client.UAccountClient
+.. autoclass:: ucloud.services.stepflow.client.StepFlowClient
:members:
-UMem
-----
+UAccount
+--------
-.. autoclass:: ucloud.services.umem.client.UMemClient
+.. autoclass:: ucloud.services.uaccount.client.UAccountClient
:members:
UDB
@@ -25,10 +27,10 @@ UDB
.. autoclass:: ucloud.services.udb.client.UDBClient
:members:
-UPHost
-------
+UDPN
+----
-.. autoclass:: ucloud.services.uphost.client.UPHostClient
+.. autoclass:: ucloud.services.udpn.client.UDPNClient
:members:
UDisk
@@ -37,33 +39,39 @@ UDisk
.. autoclass:: ucloud.services.udisk.client.UDiskClient
:members:
-VPC
+UHost
+-----
+
+.. autoclass:: ucloud.services.uhost.client.UHostClient
+ :members:
+
+ULB
---
-.. autoclass:: ucloud.services.vpc.client.VPCClient
+.. autoclass:: ucloud.services.ulb.client.ULBClient
:members:
-UNet
+UMem
----
-.. autoclass:: ucloud.services.unet.client.UNetClient
+.. autoclass:: ucloud.services.umem.client.UMemClient
:members:
-ULB
----
+UNet
+----
-.. autoclass:: ucloud.services.ulb.client.ULBClient
+.. autoclass:: ucloud.services.unet.client.UNetClient
:members:
-PathX
------
+UPHost
+------
-.. autoclass:: ucloud.services.pathx.client.PathXClient
+.. autoclass:: ucloud.services.uphost.client.UPHostClient
:members:
-UHost
------
+VPC
+---
-.. autoclass:: ucloud.services.uhost.client.UHostClient
+.. autoclass:: ucloud.services.vpc.client.VPCClient
:members:
diff --git a/docs/usage.rst b/docs/usage.rst
index 04986e5..4a922f3 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
Usage
=====
diff --git a/examples/two-tier/README.md b/examples/two-tier/README.md
index 371c7d4..1a3c645 100644
--- a/examples/two-tier/README.md
+++ b/examples/two-tier/README.md
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# UCloud SDK Two-Tier Example
## What is the goal
diff --git a/examples/two-tier/__init__.py b/examples/two-tier/__init__.py
index e69de29..40a96af 100644
--- a/examples/two-tier/__init__.py
+++ b/examples/two-tier/__init__.py
@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-
diff --git a/examples/two-tier/main.py b/examples/two-tier/main.py
index 2a0a350..4eb0eb9 100644
--- a/examples/two-tier/main.py
+++ b/examples/two-tier/main.py
@@ -1,133 +1,131 @@
+# -*- coding: utf-8 -*-
+
import os
import logging
import random
-
from ucloud.client import Client
from ucloud.helpers import wait, utils
-logger = logging.getLogger('ucloud')
-
-client = Client({
- "region": "cn-bj2",
- "project_id": os.getenv("UCLOUD_PROJECT_ID"),
- "public_key": os.getenv("UCLOUD_PUBLIC_KEY"),
- "private_key": os.getenv("UCLOUD_PRIVATE_KEY"),
-})
+logger = logging.getLogger("ucloud")
+logger.setLevel(logging.DEBUG)
+client = Client(
+ {
+ "region": "cn-bj2",
+ "project_id": os.getenv("UCLOUD_PROJECT_ID"),
+ "public_key": os.getenv("UCLOUD_PUBLIC_KEY"),
+ "private_key": os.getenv("UCLOUD_PRIVATE_KEY"),
+ }
+)
def main():
image_id = describe_image()
-
uhost_ids = create_uhost_batch(image_id, 2)
-
ulb_id = create_ulb()
-
vserver_id = create_vserver(ulb_id)
-
backend_ids = allocate_backend_batch(ulb_id, vserver_id, uhost_ids)
-
backend_ids and release_backend_batch(ulb_id, vserver_id, backend_ids)
-
vserver_id and delete_vserver(ulb_id, vserver_id)
-
ulb_id and delete_ulb(ulb_id)
-
uhost_ids and delete_uhost_batch(uhost_ids)
def describe_image():
- images = client.uhost().describe_image({'ImageType': 'Base'}).get('ImageSet', [])
+ images = (
+ client.uhost().describe_image({"ImageType": "Base"}).get("ImageSet", [])
+ )
if not images:
return
image = random.choice(images)
- return image.get('ImageId')
+ return image.get("ImageId")
def mget_uhost_states(uhost_ids):
- resp = client.uhost().describe_uhost_instance({'UHostIds': uhost_ids})
- return [inst.get('State') for inst in resp.get('UHostSet')]
+ resp = client.uhost().describe_uhost_instance({"UHostIds": uhost_ids})
+ return [inst.get("State") for inst in resp.get("UHostSet")]
def create_uhost_batch(image_id, count):
- resp = client.uhost().create_uhost_instance({
- 'Name': 'sdk-python2-example-two-tier',
- 'Zone': 'cn-bj2-05',
- 'ImageId': image_id,
- 'LoginMode': "Password",
- 'Password': utils.gen_password(20),
- 'CPU': 1,
- 'Memory': 1024,
- 'MaxCount': count,
- })
- uhost_ids = resp.get('UHostIds', [])
+ resp = client.uhost().create_uhost_instance(
+ {
+ "Name": "sdk-python3-example-two-tier",
+ "Zone": "cn-bj2-05",
+ "ImageId": image_id,
+ "LoginMode": "Password",
+ "Password": utils.gen_password(20),
+ "CPU": 1,
+ "Memory": 1024,
+ "MaxCount": count,
+ }
+ )
+ uhost_ids = resp.get("UHostIds", [])
wait.wait_for_state(
- target=['running'], pending=['pending'], timeout=300,
- refresh=lambda: (
- 'running' if all([state == 'Running' for state in mget_uhost_states(uhost_ids)]) else 'pending'
- ),
+ target=["running"],
+ pending=["pending"],
+ timeout=300,
+ refresh=lambda: "running"
+ if all([(state == "Running") for state in mget_uhost_states(uhost_ids)])
+ else "pending",
)
return uhost_ids
def create_ulb():
- resp = client.ulb().create_ulb({
- 'Name': 'sdk-python2-example-two-tier',
- })
- return resp.get('ULBId')
+ resp = client.ulb().create_ulb({"Name": "sdk-python3-example-two-tier"})
+ return resp.get("ULBId")
def create_vserver(ulb_id):
- resp = client.ulb().create_vserver({
- 'Name': 'sdk-python2-example-two-tier',
- 'ULBId': ulb_id,
- })
- return resp.get('VServerId')
+ resp = client.ulb().create_vserver(
+ {"Name": "sdk-python3-example-two-tier", "ULBId": ulb_id}
+ )
+ return resp.get("VServerId")
def allocate_backend_batch(ulb_id, vserver_id, uhost_ids):
backend_ids = []
for uhost_id in uhost_ids:
- resp = client.ulb().allocate_backend({
- 'ULBId': ulb_id,
- 'VServerId': vserver_id,
- 'ResourceId': uhost_id,
- 'ResourceType': 'UHost',
- })
- backend_ids.append(resp.get('BackendId'))
+ resp = client.ulb().allocate_backend(
+ {
+ "ULBId": ulb_id,
+ "VServerId": vserver_id,
+ "ResourceId": uhost_id,
+ "ResourceType": "UHost",
+ }
+ )
+ backend_ids.append(resp.get("BackendId"))
return backend_ids
def release_backend_batch(ulb_id, vserver_id, backend_ids):
for backend_id in backend_ids:
- client.ulb().release_backend({
- 'ULBId': ulb_id,
- 'VServerId': vserver_id,
- 'BackendId': backend_id,
- })
+ client.ulb().release_backend(
+ {"ULBId": ulb_id, "VServerId": vserver_id, "BackendId": backend_id}
+ )
def delete_vserver(ulb_id, vserver_id):
- client.ulb().delete_vserver({'ULBId': ulb_id, 'VServerId': vserver_id})
+ client.ulb().delete_vserver({"ULBId": ulb_id, "VServerId": vserver_id})
def delete_ulb(ulb_id):
- client.ulb().delete_ulb({'ULBId': ulb_id})
+ client.ulb().delete_ulb({"ULBId": ulb_id})
def delete_uhost_batch(uhost_ids):
for uhost_id in uhost_ids:
- client.uhost().stop_uhost_instance({'UHostId': uhost_id})
-
+ client.uhost().stop_uhost_instance({"UHostId": uhost_id})
wait.wait_for_state(
- target=['stopped'], pending=['pending'], timeout=300,
- refresh=lambda: (
- 'stopped' if all([state == 'Stopped' for state in mget_uhost_states(uhost_ids)]) else 'pending'
- ),
+ target=["stopped"],
+ pending=["pending"],
+ timeout=300,
+ refresh=lambda: "stopped"
+ if all([(state == "Stopped") for state in mget_uhost_states(uhost_ids)])
+ else "pending",
)
-
for uhost_id in uhost_ids:
- client.uhost().terminate_uhost_instance({'UHostId': uhost_id})
+ client.uhost().terminate_uhost_instance({"UHostId": uhost_id})
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/examples/uhost/README.md b/examples/uhost/README.md
index 9aabc7e..08b363e 100644
--- a/examples/uhost/README.md
+++ b/examples/uhost/README.md
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# UCloud SDK UHost Example
## What is the goal
diff --git a/examples/uhost/__init__.py b/examples/uhost/__init__.py
index e69de29..40a96af 100644
--- a/examples/uhost/__init__.py
+++ b/examples/uhost/__init__.py
@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-
diff --git a/examples/uhost/main.py b/examples/uhost/main.py
index 5e87696..1f9e346 100644
--- a/examples/uhost/main.py
+++ b/examples/uhost/main.py
@@ -1,74 +1,91 @@
+# -*- coding: utf-8 -*-
+
import os
import logging
import random
-
from ucloud.client import Client
from ucloud.helpers import wait, utils
-logger = logging.getLogger('ucloud')
+logger = logging.getLogger("ucloud")
+logger.setLevel(logging.DEBUG)
def main():
- client = Client({
- "region": "cn-bj2",
- "project_id": os.getenv("UCLOUD_PROJECT_ID"),
- "public_key": os.getenv("UCLOUD_PUBLIC_KEY"),
- "private_key": os.getenv("UCLOUD_PRIVATE_KEY"),
- })
-
+ client = Client(
+ {
+ "region": "cn-bj2",
+ "project_id": os.getenv("UCLOUD_PROJECT_ID"),
+ "public_key": os.getenv("UCLOUD_PUBLIC_KEY"),
+ "private_key": os.getenv("UCLOUD_PRIVATE_KEY"),
+ }
+ )
logger.info("finding image, random choice one")
- images = client.uhost().describe_image({
- 'ImageType': 'Base', 'OsType': 'Linux'
- }).get('ImageSet', [])
-
+ images = (
+ client.uhost()
+ .describe_image({"ImageType": "Base", "OsType": "Linux"})
+ .get("ImageSet", [])
+ )
assert len(images) > 0
-
logger.info("creating uhost instance ...")
image = random.choice(images)
-
- resp = client.uhost().create_uhost_instance({
- 'Name': 'sdk-python-example',
- 'Zone': image["Zone"],
- 'ImageId': image["ImageId"],
- 'LoginMode': "Password",
- 'Password': utils.gen_password(20),
- 'CPU': 1,
- 'Memory': 1024,
- 'Disks': [{
- 'Size': image["ImageSize"],
- 'Type': 'CLOUD_SSD',
- 'IsBoot': 'True',
- }],
- })
+ resp = client.uhost().create_uhost_instance(
+ {
+ "Name": "sdk-python-example",
+ "Zone": image["Zone"],
+ "ImageId": image["ImageId"],
+ "LoginMode": "Password",
+ "Password": utils.gen_password(20),
+ "CPU": 1,
+ "Memory": 1024,
+ "Disks": [
+ {
+ "Size": image["ImageSize"],
+ "Type": "LOCAL_NORMAL",
+ "IsBoot": "True",
+ }
+ ],
+ }
+ )
uhost_id = utils.first(resp["UHostIds"])
logger.info("uhost instance is created")
def refresh_state():
- uhost = utils.first(client.uhost().describe_uhost_instance({'UHostIds': [uhost_id]}).get('UHostSet', []))
- if uhost.get('State') in ['Running', 'Stopped']:
- return uhost['State'].lower()
- return 'pending'
+ uhost = utils.first(
+ client.uhost()
+ .describe_uhost_instance({"UHostIds": [uhost_id]})
+ .get("UHostSet", [])
+ )
+ if uhost.get("State") in ["Running", "Stopped"]:
+ return uhost["State"].lower()
+ return "pending"
logger.info("wait uhost state is running ...")
try:
- wait.wait_for_state(pending=['pending'], target=['running'], timeout=300, refresh=refresh_state)
+ wait.wait_for_state(
+ pending=["pending"],
+ target=["running"],
+ timeout=300,
+ refresh=refresh_state,
+ )
except wait.WaitTimeoutException as e:
logger.error(e)
logger.info("uhost instance is running")
-
logger.info("stopping uhost for clean up resources ...")
- client.uhost().stop_uhost_instance({'UHostId': uhost_id})
-
+ client.uhost().stop_uhost_instance({"UHostId": uhost_id})
try:
- wait.wait_for_state(pending=['pending'], target=['stopped'], timeout=180, refresh=refresh_state)
+ wait.wait_for_state(
+ pending=["pending"],
+ target=["stopped"],
+ timeout=180,
+ refresh=refresh_state,
+ )
except wait.WaitTimeoutException as e:
logger.error(e)
else:
logger.info("uhost instance is stopped")
-
logger.info("remove uhost instance from cloud")
- client.uhost().terminate_uhost_instance({'UHostId': uhost_id})
+ client.uhost().terminate_uhost_instance({"UHostId": uhost_id})
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/pytest.ini b/pytest.ini
index d750e31..23d020e 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -2,7 +2,5 @@
log_cli = 1
log_cli_level = INFO
log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s %(name)s)
-log_cli_date_format=%Y-%m-%d %H:%M:%S
-norecursedirs = scripts
testpaths = ucloud tests
-addopts = -s -v --doctest-modules
+addopts = --doctest-modules
diff --git a/scripts/migrate.py b/scripts/migrate.py
deleted file mode 100644
index 4b5f55a..0000000
--- a/scripts/migrate.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import os
-import ast
-import astor
-import logging
-
-logging.basicConfig()
-logger = logging.getLogger(__name__)
-
-
-class SDK3to2Transformer(ast.NodeTransformer):
- def visit_Import(self, node):
- is_typing = [alias for alias in node.names if alias.name == 'typing']
- return None if is_typing else node
-
- def visit_AnnAssign(self, node):
- if node.value is None:
- return node
- return ast.Assign(targets=[node.target], value=node.value)
-
- def visit_FunctionDef(self, node):
- body = []
-
- # remove type hints
- for arg in node.args.args:
- arg.annotation = None
-
- if node.args.kwarg:
- node.args.kwarg.annotation = None
-
- # visit children
- for child in node.body:
- if isinstance(child, ast.AnnAssign):
- body.append(self.visit_AnnAssign(child))
- else:
- body.append(child)
-
- node.body = body
- node.returns = None
- return node
-
- def visit_ClassDef(self, node):
- body = []
-
- # old-style class convert to new-style class
- if not node.bases:
- node.bases = [ast.Name(id='object', ctx=ast.Load())]
-
- # visit children
- for child in node.body:
- if isinstance(child, ast.FunctionDef):
- body.append(self.visit_FunctionDef(child))
- else:
- body.append(child)
-
- node.body = body
- return node
-
-
-UTF8_HEADER = '# -*- coding: utf-8 -*-\n\n'
-UNICODE_HEADER = 'from __future__ import unicode_literals\n\n'
-
-
-class Migrate(object):
- def __init__(self, source, output=None):
- self.source = source
- self.output = output or source
- self.transformer = SDK3to2Transformer()
-
- def convert(self, source):
- ast_node = ast.parse(source)
- ast_node = self.transformer.visit(ast_node)
- return UTF8_HEADER + astor.to_source(ast_node)
-
- def find_python_files(self):
- for folder, _, files in list(os.walk(self.source)):
- for file in files:
- yield folder + os.path.sep + file
-
- def run(self):
- for path in self.find_python_files():
- logger.info('load {}'.format(path))
- relative_path = os.path.relpath(path, self.source)
- with open(path, encoding='utf-8') as f:
- source = f.read()
-
- code = self.convert(source)
-
- output_path = os.path.abspath(
- os.path.join(self.output, relative_path))
- os.makedirs(os.path.dirname(output_path), exist_ok=True)
-
- with open(output_path, 'w', encoding='utf-8') as f:
- f.write(code)
- print('migrated {} to {}'.format(path, output_path))
-
-
-if __name__ == '__main__':
- import argparse
-
- parser = argparse.ArgumentParser(description='argument parser')
- parser.add_argument('--source', required=True,
- help='source code file writen by python3')
- parser.add_argument('--output', required=True,
- help='output source code file writen by python2')
-
- args = parser.parse_args()
- migrate = Migrate(args.source, args.output)
- migrate.run()
diff --git a/scripts/migrate/__init__.py b/scripts/migrate/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/scripts/migrate/__main__.py b/scripts/migrate/__main__.py
new file mode 100644
index 0000000..85405cd
--- /dev/null
+++ b/scripts/migrate/__main__.py
@@ -0,0 +1,29 @@
+import os
+import json
+
+from scripts.migrate._migrate import Migrate, Config, PluginConfig
+
+
+DEFAULT_CONFIG_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'config.json')
+
+if __name__ == '__main__':
+ import argparse
+
+ parser = argparse.ArgumentParser(description='argument parser')
+ parser.add_argument('--source', required=True,
+ help='source code file writen by python3')
+ parser.add_argument('--output', required=True,
+ help='output source code file writen by python2')
+ parser.add_argument('--config', required=False,
+ help='the configuration file for migration processing')
+
+ with open(DEFAULT_CONFIG_PATH) as f:
+ d = json.load(f)
+
+ config = Config()
+ config.plugins = [PluginConfig(**plugin) for plugin in d['plugins']]
+ print(config.__dict__)
+
+ args = parser.parse_args()
+ migrate = Migrate(config)
+ migrate.run(args.source, args.output)
diff --git a/scripts/migrate/_migrate.py b/scripts/migrate/_migrate.py
new file mode 100644
index 0000000..b2e8ac2
--- /dev/null
+++ b/scripts/migrate/_migrate.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+import itertools
+import os
+import typing
+import logging
+import dataclasses
+
+from scripts.migrate._plugin_py3to2 import SDK3to2Transformer
+from scripts.migrate._plugin_doc import DocTransformer
+
+logging.basicConfig()
+logger = logging.getLogger(__name__)
+
+
+@dataclasses.dataclass
+class PluginConfig:
+ name: str
+ ext: typing.List[str] = None
+ options: dict = None
+
+
+class Config:
+ paths: typing.List[str] = []
+ plugins: typing.List[PluginConfig] = []
+
+
+class Migrate(object):
+ UTF8_HEADER = '# -*- coding: utf-8 -*-\n\n'
+
+ default_plugins_classes = {
+ "py3to2": SDK3to2Transformer,
+ "doc": DocTransformer,
+ }
+
+ def __init__(self, config: Config = None):
+ self.plugins = {}
+ self.ext = {}
+ for plugin in config.plugins:
+ plugin_cls = self.default_plugins_classes.get(plugin.name)
+ if plugin_cls is None:
+ continue
+
+ plugin_inst = plugin_cls(**(plugin.options or {}))
+ self.plugins[plugin.name] = plugin_inst
+
+ for ext in plugin.ext:
+ self.ext.setdefault(ext, list())
+ self.ext[ext].append(plugin_inst)
+
+ self.paths = config.paths
+
+ def find_python_files(self, dir_or_file):
+ if os.path.isdir(dir_or_file):
+ for folder, _, files in list(os.walk(dir_or_file)):
+ for file in files:
+ yield folder + os.path.sep + file
+ else:
+ yield dir_or_file
+
+ def run(self, source_path: str, output_path: str):
+ for path in self.find_python_files(source_path):
+ # find plugins by file extension
+ plugins = [plugins for ext, plugins in self.ext.items() if path.endswith(ext)]
+ plugins = plugins and plugins[0]
+
+ # skip unexpected file by file extension
+ if not plugins:
+ continue
+
+ # resolve path
+ relative_path = os.path.relpath(path, source_path)
+ result_path = os.path.abspath(os.path.join(output_path, relative_path))
+ print('migrate {} to {}'.format(path, result_path))
+
+ # read source code
+ with open(path, encoding='utf-8') as f:
+ source_code = f.read()
+
+ # convert destination code
+ output_code = source_code
+ for plugin in plugins:
+ output_code = self.UTF8_HEADER + plugin.convert(source_code)
+
+ # output to file
+ os.makedirs(os.path.dirname(result_path), exist_ok=True)
+
+ with open(result_path, 'w', encoding='utf-8') as f:
+ f.write(output_code)
diff --git a/scripts/migrate/_plugin_doc.py b/scripts/migrate/_plugin_doc.py
new file mode 100644
index 0000000..002b79f
--- /dev/null
+++ b/scripts/migrate/_plugin_doc.py
@@ -0,0 +1,11 @@
+
+
+class DocTransformer:
+ def __init__(self, replaces=None):
+ self.replaces = replaces
+
+ def convert(self, source: str) -> str:
+ result = source
+ for r in self.replaces:
+ result = result.replace(r['from'], r['to'])
+ return result
diff --git a/scripts/migrate/_plugin_py3to2.py b/scripts/migrate/_plugin_py3to2.py
new file mode 100644
index 0000000..4f3e424
--- /dev/null
+++ b/scripts/migrate/_plugin_py3to2.py
@@ -0,0 +1,59 @@
+import ast
+
+import astor
+
+
+class SDK3to2Transformer(ast.NodeTransformer):
+ def visit_Import(self, node):
+ is_typing = [alias for alias in node.names if alias.name == 'typing']
+ return None if is_typing else node
+
+ def visit_AnnAssign(self, node):
+ if node.value is None:
+ return node
+ return ast.Assign(targets=[node.target], value=node.value)
+
+ def visit_FunctionDef(self, node):
+ body = []
+
+ # remove type hints
+ for arg in node.args.args:
+ arg.annotation = None
+
+ if node.args.kwarg:
+ node.args.kwarg.annotation = None
+
+ # visit children
+ for child in node.body:
+ if isinstance(child, ast.FunctionDef):
+ body.append(self.visit_FunctionDef(child))
+ elif isinstance(child, ast.AnnAssign):
+ body.append(self.visit_AnnAssign(child))
+ else:
+ body.append(child)
+
+ node.body = body
+ node.returns = None
+ return node
+
+ def visit_ClassDef(self, node):
+ body = []
+
+ # old-style class convert to new-style class
+ if not node.bases:
+ node.bases = [ast.Name(id='object', ctx=ast.Load())]
+
+ # visit children
+ for child in node.body:
+ if isinstance(child, ast.FunctionDef):
+ body.append(self.visit_FunctionDef(child))
+ else:
+ body.append(child)
+
+ node.body = body
+ return node
+
+ def convert(self, source: str) -> str:
+ ast_node = ast.parse(source)
+ ast_node = self.visit(ast_node)
+ return astor.to_source(ast_node)
diff --git a/scripts/migrate/config.json b/scripts/migrate/config.json
new file mode 100644
index 0000000..3a33b19
--- /dev/null
+++ b/scripts/migrate/config.json
@@ -0,0 +1,29 @@
+{
+ "plugins": [
+ {
+ "name": "py3to2",
+ "ext": [
+ ".py"
+ ]
+ },
+ {
+ "name": "doc",
+ "ext": [
+ ".md",
+ ".rst"
+ ],
+ "options": {
+ "replaces": [
+ {
+ "from": "ucloud-sdk-python3",
+ "to": "ucloud-sdk-python2"
+ },
+ {
+ "from": "UCloud SDK Python 3",
+ "to": "UCloud SDK Python 2"
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/scripts/requirements.txt b/scripts/migrate/requirements.txt
similarity index 85%
rename from scripts/requirements.txt
rename to scripts/migrate/requirements.txt
index bc36c1d..7c41503 100644
--- a/scripts/requirements.txt
+++ b/scripts/migrate/requirements.txt
@@ -1 +1 @@
-astor
+astor
diff --git a/scripts/migrate/test_migrate.py b/scripts/migrate/test_migrate.py
new file mode 100644
index 0000000..48460b0
--- /dev/null
+++ b/scripts/migrate/test_migrate.py
@@ -0,0 +1,44 @@
+import ast
+import astor
+import pytest
+
+from scripts.migrate._plugin_py3to2 import SDK3to2Transformer
+
+
+@pytest.mark.parametrize(
+ "input_vector,expected",
+ [
+ ("foo: int = 42", "foo = 42"),
+ ("def fn(foo: str) -> int: pass", "def fn(foo):\n pass"),
+ ("class Foo: pass", "class Foo(object):\n pass"),
+ ("import typing", ""),
+ ("str(value)", "unicode(value)"),
+ ("def deco(fn: typing.Callable[[Client, dict], dict]): pass", "def deco(fn):\n pass"),
+ ("""
+def step(self, **kwargs):
+ def deco(fn: typing.Callable[[Client, dict], dict]):
+ return fn
+ return deco
+ """, """
+def step(self, **kwargs):
+ def deco(fn):
+ return fn
+ return deco
+ """),
+ ],
+)
+def test_transformer(input_vector, expected):
+ transformer = SDK3to2Transformer()
+ result = transformer.convert(input_vector)
+ assert result == astor.to_source(ast.parse(expected))
+
+
+def test_parse_ast():
+ input_vector = """
+def step(self, **kwargs):
+ def deco(fn: typing.Callable[[Client, dict], dict]):
+ return fn
+ return deco
+ """
+ node = ast.parse(input_vector)
+ print(astor.dump_tree(node))
diff --git a/setup.py b/setup.py
index 437306f..90b7ff5 100644
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,7 @@ def load_version():
def load_long_description():
try:
- with io.open("README.rst", encoding="utf-8") as f:
+ with io.open("README.md", encoding="utf-8") as f:
return f.read()
except IOError:
return ""
@@ -62,16 +62,15 @@ def load_requirements(requirements_file):
dependencies_test = dependencies + [
'flake8>=3.6.0',
- 'tox',
'pytest',
'pytest-cov',
]
-dependencies_doc = dependencies + ['sphinx==1.8.4']
+dependencies_doc = dependencies + ['sphinx']
-dependencies_dev = list(set(
- dependencies_doc + dependencies_test
-))
+dependencies_ci = list(set(dependencies_test + dependencies_doc))
+
+dependencies_dev = list(set(dependencies_ci + ['black']))
def do_setup():
@@ -79,6 +78,7 @@ def do_setup():
name="ucloud-sdk-python2",
description="UCloud Service Development Kit - Python",
long_description=load_long_description(),
+ long_description_content_type='text/markdown',
license="Apache License 2.0",
version=load_version(),
packages=find_packages(exclude=["tests*"]),
@@ -90,6 +90,7 @@ def do_setup():
"test": dependencies_test,
"doc": dependencies_doc,
"dev": dependencies_dev,
+ "ci": dependencies_ci,
},
classifiers=[
"Development Status :: 3 - Alpha",
diff --git a/tests/test_core/test_client.py b/tests/test_core/test_client.py
index 9872d02..08939db 100644
--- a/tests/test_core/test_client.py
+++ b/tests/test_core/test_client.py
@@ -3,8 +3,9 @@
import os
import pytest
import logging
-from ucloud.core.client import Client
-from ucloud.testing import env
+from ucloud.client import Client
+from ucloud.core import exc
+from ucloud.testing.mock import MockedTransport
logger = logging.getLogger(__name__)
@@ -13,21 +14,63 @@
def client():
return Client(
{
- "region": os.getenv("UCLOUD_REGION"),
- "project_id": os.getenv("UCLOUD_PROJECT_ID"),
- "public_key": os.getenv("UCLOUD_PUBLIC_KEY"),
- "private_key": os.getenv("UCLOUD_PRIVATE_KEY"),
+ "region": "cn-bj2",
+ "public_key": "foo",
+ "private_key": "foo",
"timeout": 10,
+ "max_retries": 3,
}
)
-class TestAccClient(object):
- @pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
- def test_pre_check(self, client):
- env.pre_check_env()
+@pytest.fixture(scope="function", autouse=True)
+def transport():
+ return MockedTransport()
- @pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
- def test_client_invoke(self, client):
- resp = client.invoke("DescribeUHostInstance")
- assert resp["RetCode"] == 0
+
+class TestClient(object):
+ def test_client_invoke(self, client, transport):
+ transport.mock_data(lambda _: {"RetCode": 0, "Action": "Foo"})
+ client.transport = transport
+ assert client.invoke("Foo") == {"RetCode": 0, "Action": "Foo"}
+
+ def test_client_invoke_code_error(self, client, transport):
+ transport.mock_data(lambda _: {"RetCode": 171, "Action": "Foo"})
+ client.transport = transport
+ with pytest.raises(exc.RetCodeException):
+ try:
+ client.invoke("Foo")
+ except exc.RetCodeException as e:
+ assert str(e)
+ expected = {"RetCode": 171, "Action": "Foo", "Message": ""}
+ assert e.json() == expected
+ raise e
+
+ def test_client_invoke_with_retryable_error(self, client, transport):
+ transport.mock_data(lambda _: {"RetCode": 10000, "Action": "Foo"})
+ client.transport = transport
+ with pytest.raises(exc.RetCodeException):
+ client.invoke("Foo")
+
+ def test_client_invoke_with_unexpected_error(self, client, transport):
+ def raise_error(_):
+ raise ValueError("temporary error")
+
+ transport.mock_data(raise_error)
+ client.transport = transport
+ with pytest.raises(ValueError):
+ client.invoke("Foo")
+
+ def test_client_try_import(self, client):
+ assert client.pathx()
+ assert client.stepflow()
+ assert client.uaccount()
+ assert client.udb()
+ assert client.udpn()
+ assert client.udisk()
+ assert client.uhost()
+ assert client.ulb()
+ assert client.umem()
+ assert client.unet()
+ assert client.uphost()
+ assert client.vpc()
diff --git a/tests/test_core/test_encoder.py b/tests/test_core/test_encoder.py
new file mode 100644
index 0000000..083bf5a
--- /dev/null
+++ b/tests/test_core/test_encoder.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+
+import pytest
+from ucloud.core.typesystem import encoder
+
+
+@pytest.mark.parametrize(
+ "input_vector,expected",
+ [
+ ({"foo": "bar"}, {"foo": "bar"}),
+ ({"foo": 42}, {"foo": "42"}),
+ ({"foo": 42.42}, {"foo": "42.42"}),
+ ({"foo": 42.0}, {"foo": "42"}),
+ ({"foo": True}, {"foo": "true"}),
+ ({"foo": False}, {"foo": "false"}),
+ ({"IP": ["127.0.0.1"]}, {"IP.0": "127.0.0.1"}),
+ ({"IP": ["foo", "bar"]}, {"IP.0": "foo", "IP.1": "bar"}),
+ ({"IP": [{"foo": "bar"}]}, {"IP.0.foo": "bar"}),
+ ],
+)
+def test_params_encode(input_vector, expected):
+ result = encoder.encode(input_vector)
+ assert result == expected
diff --git a/tests/test_core/test_exc.py b/tests/test_core/test_exc.py
new file mode 100644
index 0000000..8777fd4
--- /dev/null
+++ b/tests/test_core/test_exc.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+
+import pytest
+from ucloud.core import exc
+
+
+def test_ret_code_error():
+ assert not exc.UCloudException().retryable
+ code_error = exc.RetCodeException("Foo", 1, "")
+ assert str(code_error)
+ assert not code_error.retryable
+ assert code_error.json() == {"Action": "Foo", "Message": "", "RetCode": 1}
+ validate_error = exc.ValidationException(ValueError("invalid type"))
+ assert not validate_error.retryable
+ assert str(validate_error)
diff --git a/tests/test_core/test_fields.py b/tests/test_core/test_fields.py
new file mode 100644
index 0000000..4742d07
--- /dev/null
+++ b/tests/test_core/test_fields.py
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+
+import logging
+import pytest
+from ucloud.core import exc
+from ucloud.core.typesystem import fields
+
+logger = logging.getLogger(__name__)
+
+
+def test_field_str():
+ s = fields.Str()
+ assert s.dumps(s.loads("foo")) == "foo"
+ with pytest.raises(exc.ValidationException):
+ fields.Str(strict=True).loads(42)
+
+
+def test_field_int():
+ i = fields.Int()
+ assert i.dumps(i.loads("42")) == 42
+ with pytest.raises(exc.ValidationException):
+ fields.Int().dumps("foo")
+ with pytest.raises(exc.ValidationException):
+ fields.Int(strict=True).loads("42")
+
+
+def test_field_float():
+ f = fields.Float()
+ assert f.dumps(f.loads("42.0")) == 42.0
+ with pytest.raises(exc.ValidationException):
+ fields.Float().dumps("foo")
+ with pytest.raises(exc.ValidationException):
+ fields.Float(strict=True).loads("42.0")
+
+
+def test_field_bool():
+ b = fields.Bool()
+ assert b.dumps(b.loads("true"))
+ assert not b.dumps(b.loads("false"))
+ with pytest.raises(exc.ValidationException):
+ fields.Bool().dumps("foo")
+ with pytest.raises(exc.ValidationException):
+ fields.Bool(strict=True).loads("true")
+
+
+def test_field_list():
+ l = fields.List(fields.Int())
+ assert l.dumps(l.loads(["42"])) == [42]
+ with pytest.raises(exc.ValidationException):
+ fields.List(fields.Int(), strict=True).dumps(42)
+ with pytest.raises(exc.ValidationException):
+ fields.List(fields.Int()).dumps(["foo"])
+ with pytest.raises(exc.ValidationException):
+ fields.List(fields.Int(strict=True)).loads(["42"])
+
+
+def test_field_base64():
+ b64 = fields.Base64()
+ assert b64.loads("Zm9v") == "foo"
+ assert b64.dumps("foo") == "Zm9v"
diff --git a/tests/test_core/test_schema.py b/tests/test_core/test_schema.py
index 33ba2af..5271b19 100644
--- a/tests/test_core/test_schema.py
+++ b/tests/test_core/test_schema.py
@@ -8,14 +8,29 @@
logger = logging.getLogger(__name__)
+def test_request_basic():
+ class Schema(schema.RequestSchema):
+ fields = {
+ "Foo": fields.Int(required=True),
+ "Bar": fields.Int(required=False),
+ }
+
+ assert Schema().dumps({"Foo": "42"}) == {"Foo": 42}
+ assert Schema().dumps({"Foo": "42"}) == {"Foo": 42}
+ with pytest.raises(exc.ValidationException):
+ Schema().dumps({})
+ with pytest.raises(exc.ValidationException):
+ Schema().dumps({"Foo": "bar"})
+
+
def test_request_array():
class Schema(schema.RequestSchema):
fields = {"IP": fields.List(fields.Str())}
d = Schema().dumps({"IP": ["127.0.0.1"]})
- assert d == {"IP.0": "127.0.0.1"}
+ assert d == {"IP": ["127.0.0.1"]}
d = Schema().dumps({})
- assert d == {}
+ assert d == {"IP": []}
def test_request_array_with_default():
@@ -23,9 +38,9 @@ class Schema(schema.RequestSchema):
fields = {"IP": fields.List(fields.Str(), default=["127.0.0.1"])}
d = Schema().dumps({"IP": ["192.168.0.1"]})
- assert d == {"IP.0": "192.168.0.1"}
+ assert d == {"IP": ["192.168.0.1"]}
d = Schema().dumps({})
- assert d == {"IP.0": "127.0.0.1"}
+ assert d == {"IP": ["127.0.0.1"]}
def test_request_object_model():
@@ -36,7 +51,7 @@ class NestedObjectSchema(schema.RequestSchema):
fields = {"Interface": Schema()}
d = NestedObjectSchema().dumps({"Interface": {"IP": ["127.0.0.1"]}})
- assert d == {"Interface.IP.0": "127.0.0.1"}
+ assert d == {"Interface": {"IP": ["127.0.0.1"]}}
with pytest.raises(exc.ValidationException):
NestedObjectSchema().dumps({"Interface": 1})
@@ -54,16 +69,51 @@ class NestedArraySchema(schema.RequestSchema):
}
d = NestedArraySchema().dumps({})
- assert d == {"Interface.0.IP.0": "192.168.1.1"}
- d = {"Interface": [{"IP": ["127.0.0.1", "192.168.0.1"]}, {"IP": ["172.16.0.1"]}]}
+ assert d == {"Interface": [{"IP": ["192.168.1.1"]}]}
+ d = {
+ "Interface": [
+ {"IP": ["127.0.0.1", "192.168.0.1"]},
+ {"IP": ["172.16.0.1"]},
+ ]
+ }
d = NestedArraySchema().dumps(d)
assert d == {
- "Interface.0.IP.0": "127.0.0.1",
- "Interface.0.IP.1": "192.168.0.1",
- "Interface.1.IP.0": "172.16.0.1",
+ "Interface": [
+ {"IP": ["127.0.0.1", "192.168.0.1"]},
+ {"IP": ["172.16.0.1"]},
+ ]
}
+def test_response_basic():
+ class Schema(schema.ResponseSchema):
+ fields = {
+ "Foo": fields.Int(required=True),
+ "Bar": fields.Int(required=False),
+ "Default": fields.Int(default=42),
+ "Call": fields.List(fields.Int(), default=list),
+ }
+
+ assert Schema().dumps({"Foo": "42"}) == {
+ "Foo": 42,
+ "Default": 42,
+ "Call": [],
+ }
+ assert Schema().loads({"Foo": "42"}) == {
+ "Foo": 42,
+ "Default": 42,
+ "Call": [],
+ }
+ with pytest.raises(exc.ValidationException):
+ Schema().dumps({})
+ with pytest.raises(exc.ValidationException):
+ Schema().dumps({"Foo": "bar"})
+ with pytest.raises(exc.ValidationException):
+ Schema().dumps({})
+ with pytest.raises(exc.ValidationException):
+ Schema().dumps({"Foo": "bar"})
+
+
def test_response_array():
class Schema(schema.ResponseSchema):
fields = {"IP": fields.List(fields.Str())}
@@ -124,8 +174,16 @@ class NestedArraySchema(schema.ResponseSchema):
d = NestedArraySchema().dumps({})
assert d == {"Interface": [{"IP": ["192.168.1.1"]}]}
- d = {"Interface": [{"IP": ["127.0.0.1", "192.168.0.1"]}, {"IP": ["172.16.0.1"]}]}
+ d = {
+ "Interface": [
+ {"IP": ["127.0.0.1", "192.168.0.1"]},
+ {"IP": ["172.16.0.1"]},
+ ]
+ }
d = NestedArraySchema().dumps(d)
assert d == {
- "Interface": [{"IP": ["127.0.0.1", "192.168.0.1"]}, {"IP": ["172.16.0.1"]}]
+ "Interface": [
+ {"IP": ["127.0.0.1", "192.168.0.1"]},
+ {"IP": ["172.16.0.1"]},
+ ]
}
diff --git a/tests/test_core/test_transport.py b/tests/test_core/test_transport.py
new file mode 100644
index 0000000..ec519fb
--- /dev/null
+++ b/tests/test_core/test_transport.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+
+import pytest
+import logging
+from ucloud.core.transport import RequestsTransport, Request, Response, utils
+
+logger = logging.getLogger(__name__)
+
+
+@pytest.fixture(scope="function", autouse=True)
+def transport():
+ return RequestsTransport()
+
+
+class TestTransport(object):
+ def test_transport_send(self, transport):
+ req = Request(
+ url="http://httpbin.org/anything",
+ method="post",
+ json={"foo": "bar"},
+ )
+ resp = transport.send(req)
+ assert resp.text
+ assert resp.json()["json"] == {"foo": "bar"}
+
+ def test_transport_handler(self, transport):
+ global_env = {}
+
+ def request_handler(r):
+ global_env["req"] = r
+ return r
+
+ def response_handler(r):
+ global_env["resp"] = r
+ return r
+
+ transport.middleware.request(handler=request_handler)
+ transport.middleware.response(handler=response_handler)
+ req = Request(
+ url="http://httpbin.org/anything",
+ method="post",
+ json={"foo": "bar"},
+ )
+ resp = transport.send(req)
+ assert resp.text
+ assert resp.json()["json"] == {"foo": "bar"}
+ assert "req" in global_env
+ assert "resp" in global_env
+
+
+class TestResponse(object):
+ def test_guess_json_utf(self):
+ import json
+
+ encodings = [
+ "utf-32",
+ "utf-8-sig",
+ "utf-16",
+ "utf-8",
+ "utf-16-be",
+ "utf-16-le",
+ "utf-32-be",
+ "utf-32-le",
+ ]
+ for e in encodings:
+ s = json.dumps("表意字符").encode(e)
+ assert utils.guess_json_utf(s) == e
+
+ def test_response_empty_content(self):
+ r = Response("http://foo.bar", "post")
+ assert not r.text
+ assert r.json() is None
diff --git a/tests/test_helpers/test_wait.py b/tests/test_helpers/test_wait.py
index c6345cb..993ba31 100644
--- a/tests/test_helpers/test_wait.py
+++ b/tests/test_helpers/test_wait.py
@@ -13,5 +13,8 @@ def test_wait():
timeout=0.5,
)
wait.wait_for_state(
- pending=["pending"], target=["running"], refresh=lambda: "running", timeout=0.5
+ pending=["pending"],
+ target=["running"],
+ refresh=lambda: "running",
+ timeout=0.5,
)
diff --git a/tests/test_services/conftest.py b/tests/test_services/conftest.py
index 675eaae..194e927 100644
--- a/tests/test_services/conftest.py
+++ b/tests/test_services/conftest.py
@@ -5,22 +5,22 @@
from ucloud.client import Client
-@pytest.fixture(scope="session", autouse=True)
-def client():
+@pytest.fixture(scope="session", autouse=True, name="client")
+def client_factory():
return Client(
{
- "region": os.getenv("UCLOUD_REGION"),
+ "region": "cn-bj2",
"project_id": os.getenv("UCLOUD_PROJECT_ID"),
"public_key": os.getenv("UCLOUD_PUBLIC_KEY"),
"private_key": os.getenv("UCLOUD_PRIVATE_KEY"),
- "max_retries": 3,
+ "max_retries": 10,
"timeout": 60,
}
)
-@pytest.fixture(scope="module", autouse=True)
-def variables():
+@pytest.fixture(scope="module", autouse=True, name="variables")
+def variables_factory():
return {
"Region": "cn-bj2",
"Zone": "cn-bj2-05",
diff --git a/tests/test_services/test_set_1073.py b/tests/test_services/test_set_1073.py
new file mode 100644
index 0000000..7265c3c
--- /dev/null
+++ b/tests/test_services/test_set_1073.py
@@ -0,0 +1,381 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(1073)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_1073(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Password"] = "dXFhQHVjbG91ZA=="
+ scenario.variables["Type"] = "SSD-2"
+ scenario.variables["Name"] = "test123123"
+ scenario.variables["Remark"] = "test123123"
+ scenario.variables["ChargeType"] = "Month"
+ scenario.variables["ProjectId"] = "ohrg-xbbyex"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostImageResponse"),
+ ],
+ action="DescribePHostImage",
+)
+def describe_phost_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uphost().describe_phost_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ImageID1"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ variables["ImageID2"] = utest.value_at_path(resp, "ImageSet.2.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "GetPHostPriceResponse"),
+ ],
+ action="GetPHostPrice",
+)
+def get_phost_price_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Count": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.uphost().get_phost_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostTagsResponse"),
+ ],
+ action="DescribePHostTags",
+)
+def describe_phost_tags_02(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.uphost().describe_phost_tags(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreatePHostResponse"),
+ ],
+ action="CreatePHost",
+)
+def create_phost_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Remark": variables.get("Remark"),
+ "Region": variables.get("Region"),
+ "Password": variables.get("Password"),
+ "Name": variables.get("Name"),
+ "ImageId": variables.get("ImageID1"),
+ "ChargeType": variables.get("ChargeType"),
+ }
+ try:
+ resp = client.uphost().create_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["PHost"] = utest.value_at_path(resp, "PHostId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=60,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostResponse"),
+ ("str_eq", "PHostSet.0.PHostType", variables.get("Type")),
+ ("str_eq", "PHostSet.0.Name", variables.get("Name")),
+ ("str_eq", "PHostSet.0.PHostId", variables.get("PHost")),
+ ("str_eq", "PHostSet.0.Remark", variables.get("Remark")),
+ ("str_eq", "PHostSet.0.Zone", variables.get("Zone")),
+ ("str_eq", "PHostSet.0.PMStatus", "Running"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("PHost")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=600,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "RebootPHostResponse"),
+ ],
+ action="RebootPHost",
+)
+def reboot_phost_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "ProjectId": variables.get("ProjectId"),
+ "PHostId": variables.get("PHost"),
+ }
+ try:
+ resp = client.uphost().reboot_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=120,
+ retry_interval=60,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "PHostSet.0.PMStatus", "Running"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("PHost")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopPHostResponse"),
+ ],
+ action="StopPHost",
+)
+def stop_phost_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "ProjectId": variables.get("ProjectId"),
+ "PHostId": variables.get("PHost"),
+ }
+ try:
+ resp = client.invoke("StopPHost", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=60,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "PHostSet.0.PMStatus", "Stopped"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("PHost")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ReinstallPHostResponse"),
+ ],
+ action="ReinstallPHost",
+)
+def reinstall_phost_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Password": variables.get("Password"),
+ "PHostId": variables.get("PHost"),
+ "ImageId": variables.get("ImageID2"),
+ }
+ try:
+ resp = client.uphost().reinstall_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=120,
+ retry_interval=60,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostResponse"),
+ ("str_eq", "PHostSet.0.PHostType", variables.get("Type")),
+ ("str_eq", "PHostSet.0.Name", variables.get("Name")),
+ ("str_eq", "PHostSet.0.PHostId", variables.get("PHost")),
+ ("str_eq", "PHostSet.0.Remark", variables.get("Remark")),
+ ("str_eq", "PHostSet.0.Zone", variables.get("Zone")),
+ ("str_eq", "PHostSet.0.PMStatus", "Running"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("PHost")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "PoweroffPHostResponse"),
+ ],
+ action="PoweroffPHost",
+)
+def poweroff_phost_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "ProjectId": variables.get("ProjectId"),
+ "PHostId": variables.get("PHost"),
+ }
+ try:
+ resp = client.uphost().poweroff_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=60,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "PHostSet.0.PMStatus", "Stopped"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("PHost")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "TerminatePHostResponse"),
+ ],
+ action="TerminatePHost",
+)
+def terminate_phost_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "ProjectId": variables.get("ProjectId"),
+ "PHostId": variables.get("PHost"),
+ }
+ try:
+ resp = client.uphost().terminate_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_113.py b/tests/test_services/test_set_113.py
new file mode 100644
index 0000000..5bf1c3b
--- /dev/null
+++ b/tests/test_services/test_set_113.py
@@ -0,0 +1,203 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(113)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_113(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUFSVolume",
+)
+def create_ufs_volume_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 1024,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("CreateUFSVolume", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["Volume_Id"] = utest.value_at_path(resp, "VolumeId")
+ variables["Volume_Name"] = utest.value_at_path(resp, "VolumeName")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUFSVolume",
+)
+def describe_ufs_volume_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VolumeId": variables.get("Volume_Id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeUFSVolume", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUHostLite",
+)
+def describe_uhost_lite_02(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.invoke("DescribeUHostLite", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUFSVolume",
+)
+def describe_ufs_volume_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VolumeId": "Volume_Id",
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeUFSVolume", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ClearUFSVolumeWhiteList",
+)
+def clear_ufs_volume_white_list_04(client, variables):
+ d = {
+ "VolumeId": variables.get("Volume_Id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("ClearUFSVolumeWhiteList", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUFSVolume",
+)
+def describe_ufs_volume_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VolumeId": "Volume_Id",
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeUFSVolume", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ExtendUFSVolume",
+)
+def extend_ufs_volume_06(client, variables):
+ d = {
+ "VolumeId": variables.get("Volume_Id"),
+ "Size": 2048,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("ExtendUFSVolume", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUFSVolume",
+)
+def describe_ufs_volume_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VolumeId": "Volume_Id",
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeUFSVolume", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="RemoveUFSVolume",
+)
+def remove_ufs_volume_08(client, variables):
+ d = {
+ "VolumeId": variables.get("Volume_Id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("RemoveUFSVolume", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_1201.py b/tests/test_services/test_set_1201.py
new file mode 100644
index 0000000..118c3bd
--- /dev/null
+++ b/tests/test_services/test_set_1201.py
@@ -0,0 +1,309 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(1201)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_1201(client, variables):
+ scenario.initial(variables)
+ scenario.variables["ConfigId"] = "03f58ca9-b64d-4bdd-abc7-c6b9a46fd801"
+ scenario.variables["Password"] = "Z3VhbmxpeXVhbm1pbWE="
+ scenario.variables["HighAvailability"] = "disable"
+ scenario.variables["Version"] = 3.2
+ scenario.variables["Protocol"] = "redis"
+ scenario.variables["ResourceType"] = "single"
+ scenario.variables["Name"] = "single_redis"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=100,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateURedisGroup",
+)
+def create_uredis_group_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Version": variables.get("Version"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Protocol": variables.get("Protocol"),
+ "Name": variables.get("Name"),
+ "HighAvailability": variables.get("HighAvailability"),
+ "ConfigId": variables.get("ConfigId"),
+ "ChargeType": "Month",
+ "BackupTime": 3,
+ "AutoBackup": "enable",
+ }
+ try:
+ resp = client.umem().create_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["group_id"] = utest.value_at_path(resp, "GroupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "ResourceType": variables.get("ResourceType"),
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ModifyURedisGroupNameResponse"),
+ ],
+ action="ModifyURedisGroupName",
+)
+def modify_uredis_group_name_02(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "Name": "Redis_Change",
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().modify_uredis_group_name(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "ResourceType": variables.get("ResourceType"),
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeURedisGroup",
+)
+def resize_uredis_group_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 2,
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().resize_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "ResourceType": variables.get("ResourceType"),
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=60,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ModifyURedisGroupPassword",
+)
+def modify_uredis_group_password_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "ResourceType": variables.get("ResourceType"),
+ "Region": variables.get("Region"),
+ "Password": variables.get("Password"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.invoke("ModifyURedisGroupPassword", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CheckURedisAllowanceResponse"),
+ ],
+ action="CheckURedisAllowance",
+)
+def check_uredis_allowance_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SlaveZone": variables.get("Zone"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Count": 1,
+ }
+ try:
+ resp = client.invoke("CheckURedisAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=15,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteURedisGroupResponse"),
+ ],
+ action="DeleteURedisGroup",
+)
+def delete_uredis_group_09(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().delete_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeURedisGroupResponse"),
+ ("object_not_contains", "DataSet", variables.get("group_id")),
+ ],
+ action="DescribeURedisGroup",
+)
+def describe_uredis_group_10(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().describe_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_1202.py b/tests/test_services/test_set_1202.py
new file mode 100644
index 0000000..c0ce2a8
--- /dev/null
+++ b/tests/test_services/test_set_1202.py
@@ -0,0 +1,168 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(1202)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_1202(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Protocol"] = "memcache"
+ scenario.variables["ResourceType"] = "distributed"
+ scenario.variables["Name"] = "distributed_memcache"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUMemSpace",
+)
+def create_umem_space_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 8,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Protocol": variables.get("Protocol"),
+ "Name": variables.get("Name"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.umem().create_umem_space(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["Space_Id"] = utest.value_at_path(resp, "SpaceId")
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_01(client, variables):
+ d = {
+ "ResourceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeUMemSpace",
+)
+def resize_umem_space_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SpaceId": variables.get("Space_Id"),
+ "Size": 14,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.umem().resize_umem_space(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_03(client, variables):
+ d = {
+ "ResourceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUMem",
+)
+def delete_umem_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "ResourceType": variables.get("ResourceType"),
+ "ResourceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DeleteUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUMemSpaceResponse"),
+ ("object_not_contains", "DataSet", variables.get("Space_Id")),
+ ],
+ action="DescribeUMemSpace",
+)
+def describe_umem_space_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SpaceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.umem().describe_umem_space(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_1203.py b/tests/test_services/test_set_1203.py
new file mode 100644
index 0000000..411894c
--- /dev/null
+++ b/tests/test_services/test_set_1203.py
@@ -0,0 +1,271 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(1203)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_1203(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Protocol"] = "redis"
+ scenario.variables["Type"] = "double"
+ scenario.variables["Name"] = "distributed_redis"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CheckUMemSpaceAllowanceResponse"),
+ ],
+ action="CheckUMemSpaceAllowance",
+)
+def check_umem_space_allowance_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 16,
+ "Region": variables.get("Region"),
+ "Count": 1,
+ }
+ try:
+ resp = client.invoke("CheckUMemSpaceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUMemSpace",
+)
+def create_umem_space_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Type": variables.get("Type"),
+ "Size": 16,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Protocol": variables.get("Protocol"),
+ "Name": variables.get("Name"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.umem().create_umem_space(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["Space_Id"] = utest.value_at_path(resp, "SpaceId")
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_02(client, variables):
+ d = {
+ "ResourceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ModifyUMemSpaceNameResponse"),
+ ],
+ action="ModifyUMemSpaceName",
+)
+def modify_umem_space_name_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SpaceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ "Name": "Rename_FBS",
+ }
+ try:
+ resp = client.umem().modify_umem_space_name(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_04(client, variables):
+ d = {
+ "ResourceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "GetUMemSpaceStateResponse"),
+ ],
+ action="GetUMemSpaceState",
+)
+def get_umem_space_state_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SpaceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.umem().get_umem_space_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeUMemSpace",
+)
+def resize_umem_space_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SpaceId": variables.get("Space_Id"),
+ "Size": 17,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.umem().resize_umem_space(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=40,
+ retry_interval=10,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_07(client, variables):
+ d = {
+ "ResourceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteUMemSpaceResponse"),
+ ],
+ action="DeleteUMemSpace",
+)
+def delete_umem_space_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SpaceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.umem().delete_umem_space(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUMemResponse"),
+ ("object_not_contains", "DataSet", variables.get("Space_Id")),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_09(client, variables):
+ d = {
+ "ResourceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_179.py b/tests/test_services/test_set_179.py
new file mode 100644
index 0000000..ad09177
--- /dev/null
+++ b/tests/test_services/test_set_179.py
@@ -0,0 +1,405 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(179)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_179(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.variables["DBTypeId"] = "mongodb-3.2"
+ scenario.variables["InstanceMode"] = "Normal"
+ scenario.variables["InstanceType"] = "Normal"
+ scenario.variables["Port"] = 27017
+ scenario.variables["MemoryLimit"] = 600
+ scenario.variables["DiskSpace"] = 20
+ scenario.variables["DBName"] = "AUTO-"
+ scenario.variables["UseSSD"] = False
+ scenario.variables["GroupName"] = "mongodb3.2默认WiredTiger-configsvr配置"
+ scenario.variables["GroupNameMongos"] = "mongodb3.2默认mongos配置"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBType",
+)
+def describe_udb_type_00(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.udb().describe_udb_type(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBParamGroupResponse"),
+ ],
+ action="DescribeUDBParamGroup",
+)
+def describe_udb_param_group_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udb().describe_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DataSet_paramGroup"] = utest.value_at_path(resp, "DataSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstance",
+)
+def create_udb_instance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Port": variables.get("Port"),
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "GroupName",
+ variables.get("GroupName"),
+ "GroupId",
+ ),
+ "Name": "auto-config3.2",
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceType": "Normal",
+ "InstanceMode": "Configsvr",
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "ChargeType": "Month",
+ "AdminUser": "root",
+ "AdminPassword": "guanliyuanmima",
+ }
+ try:
+ resp = client.udb().create_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["configid"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=500,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("configid"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreateUDBRouteInstanceResponse"),
+ ],
+ action="CreateUDBRouteInstance",
+)
+def create_udb_route_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Port": variables.get("Port"),
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "GroupName",
+ variables.get("GroupNameMongos"),
+ "GroupId",
+ ),
+ "Name": "mongos-auto",
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "ConfigsvrId": [variables.get("configid")],
+ }
+ try:
+ resp = client.udb().create_udb_route_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ModifyUDBInstanceName",
+)
+def modify_udb_instance_name_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Name": "Rename-auto-data3.0",
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().modify_udb_instance_name(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=180,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="RestartUDBInstance",
+)
+def restart_udb_instance_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().restart_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="BackupUDBInstanceErrorLog",
+)
+def backup_udb_instance_error_log_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ "BackupName": "errorlog-test",
+ }
+ try:
+ resp = client.udb().backup_udb_instance_error_log(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBLogPackage",
+)
+def describe_udb_log_package_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Type": 4,
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_log_package(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["backupidlog"] = utest.value_at_path(resp, "DataSet.0.BackupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ action="DescribeUDBBinlogBackupURL",
+)
+def describe_udb_binlog_backup_url_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ "BackupId": variables.get("backupidlog"),
+ }
+ try:
+ resp = client.udb().describe_udb_binlog_backup_url(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDBLogPackage",
+)
+def delete_udb_log_package_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "BackupId": variables.get("backupidlog"),
+ }
+ try:
+ resp = client.udb().delete_udb_log_package(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ClearUDBLog",
+)
+def clear_udb_log_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "LogType": 30,
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().clear_udb_log(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("configid"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=90,
+ fast_fail=False,
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=90,
+ fast_fail=False,
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("configid"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_181.py b/tests/test_services/test_set_181.py
new file mode 100644
index 0000000..92226ea
--- /dev/null
+++ b/tests/test_services/test_set_181.py
@@ -0,0 +1,247 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(181)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_181(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.variables["DBTypeId"] = "mongodb-3.0"
+ scenario.variables["InstanceMode"] = "Normal"
+ scenario.variables["InstanceType"] = "Normal"
+ scenario.variables["Port"] = 27017
+ scenario.variables["MemoryLimit"] = 600
+ scenario.variables["DiskSpace"] = 20
+ scenario.variables["DBName"] = "AUTO"
+ scenario.variables["UseSSD"] = False
+ scenario.variables["GroupName"] = "mongodb3.0默认MMAPv1-shardsvr配置"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBType",
+)
+def describe_udb_type_00(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.udb().describe_udb_type(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBParamGroupResponse"),
+ ],
+ action="DescribeUDBParamGroup",
+)
+def describe_udb_param_group_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udb().describe_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DataSet_paramGroup"] = utest.value_at_path(resp, "DataSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": True,
+ "Region": variables.get("Region"),
+ "MemoryLimit": 6000,
+ "DiskSpace": 200,
+ "Count": 1,
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstance",
+)
+def create_udb_instance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Port": variables.get("Port"),
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "GroupName",
+ variables.get("GroupName"),
+ "GroupId",
+ ),
+ "Name": funcs.concat(
+ variables.get("DBName"), variables.get("DBTypeId")
+ ),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceType": variables.get("InstanceType"),
+ "InstanceMode": variables.get("InstanceMode"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "ChargeType": "Month",
+ "AdminUser": "root",
+ "AdminPassword": "guanliyuanmima",
+ }
+ try:
+ resp = client.udb().create_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBReplicationInstance",
+)
+def create_udb_replication_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SrcId": variables.get("DBId"),
+ "Region": variables.get("Region"),
+ "Port": variables.get("Port"),
+ "Name": "second-auto",
+ }
+ try:
+ resp = client.udb().create_udb_replication_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["secondid"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUDBInstanceResponse"),
+ ],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUDBInstanceResponse"),
+ ],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("secondid"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("secondid"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_207.py b/tests/test_services/test_set_207.py
new file mode 100644
index 0000000..2bd41ad
--- /dev/null
+++ b/tests/test_services/test_set_207.py
@@ -0,0 +1,564 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(207)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_207(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.variables["DBTypeId"] = "percona-5.7"
+ scenario.variables["InstanceMode"] = "Normal"
+ scenario.variables["InstanceType"] = "Normal"
+ scenario.variables["Port"] = 3306
+ scenario.variables["MemoryLimit"] = 1000
+ scenario.variables["DiskSpace"] = 20
+ scenario.variables["DBName"] = "auto_ptbz_"
+ scenario.variables["UseSSD"] = False
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBType",
+)
+def describe_udb_type_00(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.udb().describe_udb_type(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBParamGroup",
+)
+def describe_udb_param_group_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udb().describe_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DataSet_paramGroup"] = utest.value_at_path(resp, "DataSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBInstancePrice",
+)
+def describe_udb_instance_price_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "Count": 1,
+ }
+ try:
+ resp = client.udb().describe_udb_instance_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstance",
+)
+def create_udb_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Port": variables.get("Port"),
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "DBTypeId",
+ variables.get("DBTypeId"),
+ "GroupId",
+ ),
+ "Name": funcs.concat(
+ variables.get("DBName"), variables.get("DBTypeId")
+ ),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceType": variables.get("InstanceType"),
+ "InstanceMode": variables.get("InstanceMode"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "ChargeType": "Month",
+ "AdminPassword": "guanliyuanmima",
+ }
+ try:
+ resp = client.udb().create_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=50,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VirtualIP"] = utest.value_at_path(resp, "DataSet.0.VirtualIP")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBInstanceUpgradePrice",
+)
+def describe_udb_instance_upgrade_price_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit") + 1,
+ "DiskSpace": variables.get("DiskSpace") + 1,
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_upgrade_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit") + 1,
+ "DiskSpace": variables.get("DiskSpace") + 1,
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ResizeUDBInstanceResponse"),
+ ],
+ action="ResizeUDBInstance",
+)
+def resize_udb_instance_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "StartAfterUpgrade": True,
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit") + 1,
+ "DiskSpace": variables.get("DiskSpace") + 1,
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().resize_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ("str_eq", "DataSet.0.MemoryLimit", variables.get("MemoryLimit") + 1),
+ ("str_eq", "DataSet.0.DiskSpace", variables.get("DiskSpace") + 10),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CheckUDBInstanceToHAAllowanceResponse"),
+ ("str_eq", "Allowance", "Yes"),
+ ],
+ action="CheckUDBInstanceToHAAllowance",
+)
+def check_udb_instance_to_ha_allowance_12(client, variables):
+ d = {"Region": variables.get("Region"), "DBId": variables.get("DBId")}
+ try:
+ resp = client.udb().check_udb_instance_to_ha_allowance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePromoteToHAPriceResponse"),
+ ],
+ action="DescribePromoteToHAPrice",
+)
+def describe_promote_to_ha_price_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.invoke("DescribePromoteToHAPrice", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "PromoteUDBInstanceToHAResponse"),
+ ],
+ action="PromoteUDBInstanceToHA",
+)
+def promote_udb_instance_to_ha_14(client, variables):
+ d = {"Region": variables.get("Region"), "DBId": variables.get("DBId")}
+ try:
+ resp = client.udb().promote_udb_instance_to_ha(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceStateResponse"),
+ ("str_eq", "State", "WaitForSwitch"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=10,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "SwitchUDBInstanceToHAResponse"),
+ ],
+ action="SwitchUDBInstanceToHA",
+)
+def switch_udb_instance_to_ha_16(client, variables):
+ d = {"Region": variables.get("Region"), "DBId": variables.get("DBId")}
+ try:
+ resp = client.udb().switch_udb_instance_to_ha(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["HADBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.VirtualIP", variables.get("VirtualIP")),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_17(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("HADBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUDBInstanceResponse"),
+ ],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_18(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("HADBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=6,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceResponse"),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_19(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("HADBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteUDBInstanceResponse"),
+ ],
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_20(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("HADBId"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_2117.py b/tests/test_services/test_set_2117.py
new file mode 100644
index 0000000..1aa89a0
--- /dev/null
+++ b/tests/test_services/test_set_2117.py
@@ -0,0 +1,272 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(2117)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_2117(client, variables):
+ scenario.initial(variables)
+ scenario.variables["ResourceType"] = "single"
+ scenario.variables["ConfigId"] = "9a891891-c245-4b66-bce8-67e59430d67c"
+ scenario.variables["Name"] = "single_memcache"
+ scenario.variables["Protocol"] = "memcache"
+ scenario.variables["Count"] = 1
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreateUMemcacheGroupResponse"),
+ ],
+ action="CreateUMemcacheGroup",
+)
+def create_umem_cache_group_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Name": variables.get("Name"),
+ "ConfigId": variables.get("ConfigId"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.umem().create_umem_cache_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["group_id"] = utest.value_at_path(resp, "GroupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CheckUMemcacheAllowanceResponse"),
+ ],
+ action="CheckUMemcacheAllowance",
+)
+def check_umem_cache_allowance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Count": variables.get("Count"),
+ }
+ try:
+ resp = client.invoke("CheckUMemcacheAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_02(client, variables):
+ d = {
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=100,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUMemcacheGroupResponse"),
+ ],
+ action="DescribeUMemcacheGroup",
+)
+def describe_umem_cache_group_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().describe_umem_cache_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeUMemcacheGroup",
+)
+def resize_umem_cache_group_04(client, variables):
+ d = {
+ "Size": 2,
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.invoke("ResizeUMemcacheGroup", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_05(client, variables):
+ d = {
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="RestartUMemcacheGroup",
+)
+def restart_umem_cache_group_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().restart_umem_cache_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_07(client, variables):
+ d = {
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteUMemcacheGroupResponse"),
+ ],
+ action="DeleteUMemcacheGroup",
+)
+def delete_umem_cache_group_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().delete_umem_cache_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUMemResponse"),
+ ("object_not_contains", "DataSet", variables.get("group_id")),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_09(client, variables):
+ d = {
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_2174.py b/tests/test_services/test_set_2174.py
new file mode 100644
index 0000000..68bb219
--- /dev/null
+++ b/tests/test_services/test_set_2174.py
@@ -0,0 +1,302 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(2174)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_2174(client, variables):
+ scenario.initial(variables)
+ scenario.variables["ConfigId"] = "03f58ca9-b64d-4bdd-abc7-c6b9a46fd801"
+ scenario.variables["Password"] = "Z3VhbmxpeXVhbm1pbWE="
+ scenario.variables["HighAvailability"] = "disable"
+ scenario.variables["Version"] = 3.2
+ scenario.variables["Protocol"] = "redis"
+ scenario.variables["ResourceType"] = "single"
+ scenario.variables["Name"] = "single_redis"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=50,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateURedisGroup",
+)
+def create_uredis_group_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Version": variables.get("Version"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Protocol": variables.get("Protocol"),
+ "Name": variables.get("Name"),
+ "HighAvailability": variables.get("HighAvailability"),
+ "ConfigId": variables.get("ConfigId"),
+ "ChargeType": "Month",
+ "BackupTime": 3,
+ "AutoBackup": "enable",
+ }
+ try:
+ resp = client.umem().create_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["group_id"] = utest.value_at_path(resp, "GroupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_01(client, variables):
+ d = {
+ "ResourceType": variables.get("ResourceType"),
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CheckURedisAllowanceResponse"),
+ ],
+ action="CheckURedisAllowance",
+)
+def check_uredis_allowance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SlaveZone": variables.get("Zone"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Count": 1,
+ }
+ try:
+ resp = client.invoke("CheckURedisAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreateURedisBackupResponse"),
+ ],
+ action="CreateURedisBackup",
+)
+def create_uredis_backup_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ "BackupName": "backup_Redis",
+ }
+ try:
+ resp = client.invoke("CreateURedisBackup", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["backup_id"] = utest.value_at_path(resp, "BackupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_04(client, variables):
+ d = {
+ "ResourceType": variables.get("ResourceType"),
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": variables.get("Protocol"),
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeURedisBackupStateResponse"),
+ ],
+ action="DescribeURedisBackupState",
+)
+def describe_uredis_backup_state_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ "BackupId": variables.get("backup_id"),
+ }
+ try:
+ resp = client.invoke("DescribeURedisBackupState", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeURedisBackupResponse"),
+ ],
+ action="DescribeURedisBackup",
+)
+def describe_uredis_backup_06(client, variables):
+ d = {"Region": variables.get("Region")}
+ try:
+ resp = client.umem().describe_uredis_backup(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeURedisBackupURLResponse"),
+ ],
+ action="DescribeURedisBackupURL",
+)
+def describe_uredis_backup_url_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "BackupId": variables.get("backup_id"),
+ }
+ try:
+ resp = client.umem().describe_uredis_backup_url(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteURedisBackupResponse"),
+ ],
+ action="DeleteURedisBackup",
+)
+def delete_uredis_backup_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "BackupId": variables.get("backup_id"),
+ }
+ try:
+ resp = client.invoke("DeleteURedisBackup", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=15,
+ retry_interval=5,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteURedisGroupResponse"),
+ ],
+ action="DeleteURedisGroup",
+)
+def delete_uredis_group_09(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().delete_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeURedisGroupResponse"),
+ ("object_not_contains", "DataSet", variables.get("group_id")),
+ ],
+ action="DescribeURedisGroup",
+)
+def describe_uredis_group_10(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().describe_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_227.py b/tests/test_services/test_set_227.py
new file mode 100644
index 0000000..541c251
--- /dev/null
+++ b/tests/test_services/test_set_227.py
@@ -0,0 +1,199 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(227)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_227(client, variables):
+ scenario.initial(variables)
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateULB",
+)
+def create_ulb_00(client, variables):
+ d = {
+ "ULBName": "测试",
+ "Tag": "Default",
+ "Region": variables.get("Region"),
+ "OuterMode": "Yes",
+ "InnerMode": "No",
+ }
+ try:
+ resp = client.ulb().create_ulb(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ULBId_outer"] = utest.value_at_path(resp, "ULBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 4107)],
+ action="CreateVServer",
+)
+def create_vserver_01(client, variables):
+ d = {
+ "VServerName": "vserver-http",
+ "ULBId": variables.get("ULBId_outer"),
+ "Region": variables.get("Region"),
+ "Protocol": "HTTP",
+ "PersistenceType": "ServerInsert",
+ "Method": "Roundrobin",
+ "ListenType": "RequestProxy",
+ "FrontendPort": 80,
+ }
+ try:
+ resp = client.ulb().create_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeVServer",
+)
+def describe_vserver_02(client, variables):
+ d = {
+ "ULBId": variables.get("ULBId_outer"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.ulb().describe_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 4107)],
+ action="CreateVServer",
+)
+def create_vserver_03(client, variables):
+ d = {
+ "VServerName": "vserver-https",
+ "ULBId": variables.get("ULBId_outer"),
+ "Region": variables.get("Region"),
+ "Protocol": "HTTPS",
+ "PersistenceType": "UserDefined",
+ "PersistenceInfo": "huangchao",
+ "Method": "Source",
+ "ListenType": "RequestProxy",
+ "FrontendPort": 443,
+ "ClientTimeout": 60,
+ }
+ try:
+ resp = client.ulb().create_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeVServer",
+)
+def describe_vserver_04(client, variables):
+ d = {
+ "ULBId": variables.get("ULBId_outer"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.ulb().describe_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 4107)],
+ action="CreateVServer",
+)
+def create_vserver_05(client, variables):
+ d = {
+ "VServerName": "vserver-https",
+ "ULBId": variables.get("ULBId_outer"),
+ "Region": variables.get("Region"),
+ "Protocol": "TCP",
+ "PersistenceType": "None",
+ "Method": "Source",
+ "ListenType": "RequestProxy",
+ "FrontendPort": 1024,
+ }
+ try:
+ resp = client.ulb().create_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeVServer",
+)
+def describe_vserver_06(client, variables):
+ d = {
+ "ULBId": variables.get("ULBId_outer"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.ulb().describe_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ action="DeleteULB",
+)
+def delete_ulb_07(client, variables):
+ d = {
+ "ULBId": variables.get("ULBId_outer"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.ulb().delete_ulb(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_230.py b/tests/test_services/test_set_230.py
new file mode 100644
index 0000000..8cc36f5
--- /dev/null
+++ b/tests/test_services/test_set_230.py
@@ -0,0 +1,322 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(230)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_230(client, variables):
+ scenario.initial(variables)
+ scenario.variables["sbw_name"] = "sbw_api_auto"
+ scenario.variables["sbw_chargetype"] = "Month"
+ scenario.variables["sbw_bw"] = 20
+ scenario.variables["resize_bw"] = 22
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["eip_operatorname"] = "Bgp"
+ scenario.variables["eip_bw"] = 2
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="AllocateShareBandwidth",
+)
+def allocate_share_bandwidth_00(client, variables):
+ d = {
+ "ShareBandwidth": variables.get("sbw_bw"),
+ "Region": variables.get("Region"),
+ "Name": variables.get("sbw_name"),
+ "ChargeType": variables.get("sbw_chargetype"),
+ }
+ try:
+ resp = client.unet().allocate_share_bandwidth(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["sbw_id"] = utest.value_at_path(resp, "ShareBandwidthId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="AllocateEIP",
+)
+def allocate_eip_01(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "PayMode": "Traffic",
+ "OperatorName": variables.get("eip_operatorname"),
+ "Name": "eip_auto",
+ "ChargeType": "Month",
+ "Bandwidth": variables.get("eip_bw"),
+ }
+ try:
+ resp = client.unet().allocate_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["eip_id"] = utest.value_at_path(resp, "EIPSet.0.EIPId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="AssociateEIPWithShareBandwidth",
+)
+def associate_eip_with_share_bandwidth_02(client, variables):
+ d = {
+ "ShareBandwidthId": variables.get("sbw_id"),
+ "Region": variables.get("Region"),
+ "EIPIds": [variables.get("eip_id")],
+ }
+ try:
+ resp = client.unet().associate_eip_with_share_bandwidth(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("gt", "TotalPrice", 0),
+ ],
+ action="DescribeShareBandwidthPrice",
+)
+def describe_share_bandwidth_price_03(client, variables):
+ d = {
+ "ShareBandwidth": variables.get("sbw_bw"),
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "ChargeType": variables.get("sbw_chargetype"),
+ }
+ try:
+ resp = client.invoke("DescribeShareBandwidthPrice", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.ShareBandwidthId", variables.get("sbw_id")),
+ ("str_eq", "DataSet.0.ShareBandwidth", variables.get("sbw_bw")),
+ ("str_eq", "DataSet.0.ChargeType", variables.get("sbw_chargetype")),
+ ("str_eq", "DataSet.0.Name", variables.get("sbw_name")),
+ ("str_eq", "TotalCount", 1),
+ ("str_eq", "DataSet.0.EIPSet.0.EIPId", variables.get("eip_id")),
+ ],
+ action="DescribeShareBandwidth",
+)
+def describe_share_bandwidth_04(client, variables):
+ d = {
+ "ShareBandwidthIds": [variables.get("sbw_id")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.unet().describe_share_bandwidth(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeShareBandwidth",
+)
+def resize_share_bandwidth_05(client, variables):
+ d = {
+ "ShareBandwidthId": variables.get("sbw_id"),
+ "ShareBandwidth": variables.get("resize_bw"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.unet().resize_share_bandwidth(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.ShareBandwidth", variables.get("resize_bw")),
+ ],
+ action="DescribeShareBandwidth",
+)
+def describe_share_bandwidth_06(client, variables):
+ d = {
+ "ShareBandwidthIds": [variables.get("sbw_id")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.unet().describe_share_bandwidth(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "EIPSet.0.BandwidthType", 1),
+ ("str_eq", "EIPSet.0.PayMode", "ShareBandwidth"),
+ ],
+ action="DescribeEIP",
+)
+def describe_eip_07(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "EIPIds": [variables.get("eip_id")],
+ }
+ try:
+ resp = client.unet().describe_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DisassociateEIPWithShareBandwidth",
+)
+def disassociate_eip_with_share_bandwidth_08(client, variables):
+ d = {
+ "ShareBandwidthId": variables.get("sbw_id"),
+ "Region": variables.get("Region"),
+ "EIPIds": [variables.get("eip_id")],
+ "Bandwidth": variables.get("eip_bw"),
+ }
+ try:
+ resp = client.unet().disassociate_eip_with_share_bandwidth(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "EIPSet.0.BandwidthType", 0),
+ ("str_eq", "EIPSet.0.PayMode", "Bandwidth"),
+ ],
+ action="DescribeEIP",
+)
+def describe_eip_09(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "EIPIds": [variables.get("eip_id")],
+ }
+ try:
+ resp = client.unet().describe_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("gt", "Info.BwOutSum", 0),
+ ("gt", "Info.BwOutShareSum", 0),
+ ("gt", "Info.BwOutAll", 0),
+ ],
+ action="GetBandwidthSum",
+)
+def get_bandwidth_sum_10(client, variables):
+ d = {"Region": variables.get("Region")}
+ try:
+ resp = client.invoke("GetBandwidthSum", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ action="ReleaseEIP",
+)
+def release_eip_11(client, variables):
+ d = {"Region": variables.get("Region"), "EIPId": variables.get("eip_id")}
+ try:
+ resp = client.unet().release_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ReleaseShareBandwidth",
+)
+def release_share_bandwidth_12(client, variables):
+ d = {
+ "ShareBandwidthId": variables.get("sbw_id"),
+ "Region": variables.get("Region"),
+ "EIPBandwidth": 2,
+ }
+ try:
+ resp = client.unet().release_share_bandwidth(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_2377.py b/tests/test_services/test_set_2377.py
new file mode 100644
index 0000000..5bbc8b2
--- /dev/null
+++ b/tests/test_services/test_set_2377.py
@@ -0,0 +1,439 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(2377)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_2377(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Password"] = "YW4mODE1MDI5"
+ scenario.variables["Type"] = "GPU-2080-V5"
+ scenario.variables["ModifyName"] = "TestName"
+ scenario.variables["ModifyRemark"] = "TestRemark"
+ scenario.variables["Cluster"] = "10G"
+ scenario.variables["Raid"] = "NoRaid"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostImageResponse"),
+ ],
+ action="DescribePHostImage",
+)
+def describe_phost_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uphost().describe_phost_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ImageID1"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostMachineTypeResponse"),
+ ],
+ action="DescribePHostMachineType",
+)
+def describe_phost_machine_type_01(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.invoke("DescribePHostMachineType", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostResourceInfoResponse"),
+ ],
+ action="DescribePHostResourceInfo",
+)
+def describe_phost_resource_info_02(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.invoke("DescribePHostResourceInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreatePHostResponse"),
+ ],
+ action="CreatePHost",
+)
+def create_phost_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Type": variables.get("Type"),
+ "Region": variables.get("Region"),
+ "Raid": variables.get("Raid"),
+ "Password": variables.get("Password"),
+ "ImageId": variables.get("ImageID1"),
+ "Cluster": variables.get("Cluster"),
+ }
+ try:
+ resp = client.uphost().create_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["phostId"] = utest.value_at_path(resp, "PHostId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=120,
+ retry_interval=30,
+ startup_delay=20,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostResponse"),
+ ("str_eq", "PHostSet.0.PMStatus", "Running"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("phostId")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "GetPHostKVMInfoResponse"),
+ ],
+ action="GetPHostKVMInfo",
+)
+def get_phost_kvm_info_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": variables.get("phostId"),
+ }
+ try:
+ resp = client.invoke("GetPHostKVMInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ModifyPHostInfoResponse"),
+ ],
+ action="ModifyPHostInfo",
+)
+def modify_phost_info_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Remark": variables.get("ModifyRemark"),
+ "Region": variables.get("Region"),
+ "PHostId": variables.get("phostId"),
+ "Name": variables.get("ModifyName"),
+ }
+ try:
+ resp = client.uphost().modify_phost_info(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostResponse"),
+ ("str_eq", "PHostSet.0.Name", variables.get("ModifyName")),
+ ("str_eq", "PHostSet.0.Remark", variables.get("ModifyRemark")),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("phostId")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopPHostResponse"),
+ ],
+ action="StopPHost",
+)
+def stop_phost_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": variables.get("phostId"),
+ }
+ try:
+ resp = client.invoke("StopPHost", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostResponse"),
+ ("str_eq", "PHostSet.0.PMStatus", "Stopped"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("phostId")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ReinstallPHostResponse"),
+ ],
+ action="ReinstallPHost",
+)
+def reinstall_phost_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Password": variables.get("Password"),
+ "PHostId": variables.get("phostId"),
+ "ImageId": variables.get("ImageID1"),
+ }
+ try:
+ resp = client.uphost().reinstall_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=120,
+ retry_interval=60,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostResponse"),
+ ("str_eq", "PHostSet.0.PMStatus", "Running"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("phostId")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "PoweroffPHostResponse"),
+ ],
+ action="PoweroffPHost",
+)
+def poweroff_phost_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": variables.get("phostId"),
+ }
+ try:
+ resp = client.uphost().poweroff_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=120,
+ retry_interval=60,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostResponse"),
+ ("str_eq", "PHostSet.0.PMStatus", "Stopped"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("phostId")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=120,
+ retry_interval=30,
+ startup_delay=20,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StartPHostResponse"),
+ ],
+ action="StartPHost",
+)
+def start_phost_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": variables.get("phostId"),
+ }
+ try:
+ resp = client.uphost().start_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=120,
+ retry_interval=30,
+ startup_delay=20,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribePHostResponse"),
+ ("str_eq", "PHostSet.0.PMStatus", "Running"),
+ ],
+ action="DescribePHost",
+)
+def describe_phost_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": [variables.get("phostId")],
+ }
+ try:
+ resp = client.uphost().describe_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "TerminatePHostResponse"),
+ ],
+ action="TerminatePHost",
+)
+def terminate_phost_16(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "PHostId": variables.get("phostId"),
+ }
+ try:
+ resp = client.uphost().terminate_phost(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_242.py b/tests/test_services/test_set_242.py
new file mode 100644
index 0000000..688e06d
--- /dev/null
+++ b/tests/test_services/test_set_242.py
@@ -0,0 +1,292 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(242)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_242(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeURedisPrice",
+)
+def describe_uredis_price_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.umem().describe_uredis_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["GetPrice"] = utest.value_at_path(resp, "DataSet.0.Price")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateURedisGroup",
+)
+def create_uredis_group_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Protocol": "redis",
+ "Name": "Redis_zb",
+ "HighAvailability": "disable",
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.umem().create_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["group_id"] = utest.value_at_path(resp, "GroupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=120,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUMem",
+)
+def describe_umem_02(client, variables):
+ d = {
+ "ResourceType": "single",
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": "redis",
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["CreateTime"] = utest.value_at_path(resp, "DataSet.0.CreateTime")
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=1,
+ startup_delay=100,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("float_eq", "OrderInfos.0.Amount", variables.get("GetPrice") / 100),
+ ],
+ action="DescribeOrderDetailInfo",
+)
+def describe_order_detail_info_03(client, variables):
+ d = {
+ "ResourceIds": [variables.get("group_id")],
+ "QueryAll": True,
+ "OrderTypes": ["OT_BUY"],
+ "OrderStates": ["OS_FINISHED"],
+ "EndTime": funcs.get_timestamp(10),
+ "BeginTime": funcs.get_timestamp(10) - 1200,
+ }
+ try:
+ resp = client.invoke("DescribeOrderDetailInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeURedisUpgradePrice",
+)
+def describe_uredis_upgrade_price_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 2,
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().describe_uredis_upgrade_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["UpgradePrice"] = utest.value_at_path(resp, "Price")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeURedisGroup",
+)
+def resize_uredis_group_05(client, variables):
+ d = {
+ "Size": 2,
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().resize_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=1,
+ startup_delay=100,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "lt",
+ "OrderInfos.0.Amount",
+ variables.get("UpgradePrice") / 100 + 0.1,
+ ),
+ (
+ "gt",
+ "OrderInfos.0.Amount",
+ variables.get("UpgradePrice") / 100 - 0.1,
+ ),
+ ],
+ action="DescribeOrderDetailInfo",
+)
+def describe_order_detail_info_06(client, variables):
+ d = {
+ "ResourceIds": [variables.get("group_id")],
+ "QueryAll": True,
+ "OrderTypes": ["OT_UPGRADE"],
+ "OrderStates": ["OS_FINISHED"],
+ "EndTime": funcs.get_timestamp(10),
+ "ChargeTypes": ["Month"],
+ "BeginTime": funcs.get_timestamp(10) - 1200,
+ }
+ try:
+ resp = client.invoke("DescribeOrderDetailInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="GetResourceRenewPrice",
+)
+def get_resource_renew_price_07(client, variables):
+ d = {
+ "ResourceIds": [variables.get("group_id")],
+ "Quantity": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.invoke("GetResourceRenewPrice", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ReNewPrice"] = utest.value_at_path(resp, "RenewPriceSet.0.Price")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateRenew",
+)
+def create_renew_08(client, variables):
+ d = {
+ "ResourceId": variables.get("group_id"),
+ "Quantity": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.invoke("CreateRenew", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "OrderInfos.0.Amount", variables.get("ReNewPrice"))
+ ],
+ action="DescribeOrderDetailInfo",
+)
+def describe_order_detail_info_09(client, variables):
+ d = {
+ "ResourceIds": [variables.get("group_id")],
+ "QueryAll": True,
+ "OrderTypes": ["OT_RENEW"],
+ "OrderStates": ["OS_FINISHED"],
+ "EndTime": funcs.get_timestamp(10),
+ "ChargeTypes": ["Month"],
+ "BeginTime": funcs.get_timestamp(10) - 1200,
+ }
+ try:
+ resp = client.invoke("DescribeOrderDetailInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ action="DeleteURedisGroup",
+)
+def delete_uredis_group_10(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().delete_uredis_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_245.py b/tests/test_services/test_set_245.py
new file mode 100644
index 0000000..e826a8f
--- /dev/null
+++ b/tests/test_services/test_set_245.py
@@ -0,0 +1,295 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(245)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_245(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUMemSpace",
+)
+def create_umem_space_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Type": "double",
+ "Size": 16,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Protocol": "redis",
+ "Name": "Redis_fbs",
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.umem().create_umem_space(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["Space_Id"] = utest.value_at_path(resp, "SpaceId")
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=10,
+ startup_delay=50,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUMem",
+)
+def describe_umem_01(client, variables):
+ d = {
+ "ResourceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ "Protocol": "redis",
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["CreateTime"] = utest.value_at_path(resp, "DataSet.0.CreateTime")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUMemPrice",
+)
+def describe_umem_price_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Type": "double",
+ "Size": 16,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.umem().describe_umem_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["GetPrice"] = utest.value_at_path(resp, "DataSet.0.Price")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("le", "OrderInfos.0.Amount", variables.get("GetPrice") / 100 + 0.6),
+ ("gt", "OrderInfos.0.Amount", variables.get("GetPrice") / 100 - 0.6),
+ ],
+ action="DescribeOrderDetailInfo",
+)
+def describe_order_detail_info_03(client, variables):
+ d = {
+ "ResourceIds": [variables.get("Space_Id")],
+ "QueryAll": True,
+ "OrderTypes": ["OT_BUY"],
+ "OrderStates": ["OS_FINISHED"],
+ "EndTime": funcs.get_timestamp(10),
+ "ChargeTypes": ["Month"],
+ "BeginTime": funcs.get_timestamp(10) - 1200,
+ }
+ try:
+ resp = client.invoke("DescribeOrderDetailInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUMemUpgradePrice",
+)
+def describe_umem_upgrade_price_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Type": "double",
+ "SpaceId": variables.get("Space_Id"),
+ "Size": 18,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.umem().describe_umem_upgrade_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["UpgradePrice"] = utest.value_at_path(resp, "Price")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeUMemSpace",
+)
+def resize_umem_space_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SpaceId": variables.get("Space_Id"),
+ "Size": 18,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.umem().resize_umem_space(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "lt",
+ "OrderInfos.0.Amount",
+ variables.get("UpgradePrice") / 100 + 0.1,
+ ),
+ (
+ "gt",
+ "OrderInfos.0.Amount",
+ variables.get("UpgradePrice") / 100 - 0.1,
+ ),
+ ],
+ action="DescribeOrderDetailInfo",
+)
+def describe_order_detail_info_06(client, variables):
+ d = {
+ "ResourceIds": [variables.get("Space_Id")],
+ "QueryAll": True,
+ "OrderTypes": ["OT_UPGRADE"],
+ "OrderStates": ["OS_FINISHED"],
+ "EndTime": funcs.get_timestamp(10),
+ "ChargeTypes": ["Month"],
+ "BeginTime": funcs.get_timestamp(10) - 1200,
+ }
+ try:
+ resp = client.invoke("DescribeOrderDetailInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="GetResourceRenewPrice",
+)
+def get_resource_renew_price_07(client, variables):
+ d = {
+ "ResourceIds": [variables.get("Space_Id")],
+ "Quantity": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.invoke("GetResourceRenewPrice", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ReNewPrice"] = utest.value_at_path(resp, "RenewPriceSet.0.Price")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateRenew",
+)
+def create_renew_08(client, variables):
+ d = {
+ "ResourceId": variables.get("Space_Id"),
+ "Quantity": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.invoke("CreateRenew", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "OrderInfos.0.Amount", variables.get("ReNewPrice")),
+ ],
+ action="DescribeOrderDetailInfo",
+)
+def describe_order_detail_info_09(client, variables):
+ d = {
+ "ResourceIds": [variables.get("Space_Id")],
+ "QueryAll": True,
+ "OrderTypes": ["OT_RENEW"],
+ "OrderStates": ["OS_FINISHED"],
+ "EndTime": funcs.get_timestamp(10),
+ "ChargeTypes": ["Month"],
+ "BeginTime": funcs.get_timestamp(10) - 1200,
+ }
+ try:
+ resp = client.invoke("DescribeOrderDetailInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ action="DeleteUMemSpace",
+)
+def delete_umem_space_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SpaceId": variables.get("Space_Id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.umem().delete_umem_space(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_2457.py b/tests/test_services/test_set_2457.py
new file mode 100644
index 0000000..4123529
--- /dev/null
+++ b/tests/test_services/test_set_2457.py
@@ -0,0 +1,569 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(2457)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_2457(client, variables):
+ scenario.initial(variables)
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateVPC",
+)
+def create_vpc_00(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "Network": ["192.168.0.0/16"],
+ "Name": "ulb-ssl-vpc",
+ }
+ try:
+ resp = client.vpc().create_vpc(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["vpc_id"] = utest.value_at_path(resp, "VPCId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateSubnet",
+)
+def create_subnet_01(client, variables):
+ d = {
+ "VPCId": variables.get("vpc_id"),
+ "SubnetName": "ulb-ssl-subnet",
+ "Subnet": "192.168.111.0",
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.vpc().create_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["subnet_id"] = utest.value_at_path(resp, "SubnetId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateULB",
+)
+def create_ulb_02(client, variables):
+ d = {
+ "VPCId": variables.get("vpc_id"),
+ "ULBName": "ulb-ssl-test",
+ "Tag": "Default",
+ "SubnetId": variables.get("subnet_id"),
+ "Region": variables.get("Region"),
+ "InnerMode": "No",
+ "ChargeType": "Dynamic",
+ }
+ try:
+ resp = client.ulb().create_ulb(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ULBId"] = utest.value_at_path(resp, "ULBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateVServer",
+)
+def create_vserver_03(client, variables):
+ d = {
+ "VServerName": "vserver-test",
+ "ULBId": variables.get("ULBId"),
+ "Region": variables.get("Region"),
+ "Protocol": "HTTPS",
+ "PersistenceType": "UserDefined",
+ "PersistenceInfo": "huangchao",
+ "Method": "Roundrobin",
+ "ListenType": "RequestProxy",
+ "FrontendPort": 443,
+ "ClientTimeout": 60,
+ }
+ try:
+ resp = client.ulb().create_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VServerId"] = utest.value_at_path(resp, "VServerId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateSSL",
+)
+def create_ssl_04(client, variables):
+ d = {
+ "UserCert": """-----BEGIN CERTIFICATE-----
+MIIFzTCCBLWgAwIBAgIQQ8IswmAhEIKfNhrKqb0F3DANBgkqhkiG9w0BAQsFADCB
+lzELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs
+IEluYy4xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxHTAbBgNVBAsT
+FERvbWFpbiBWYWxpZGF0ZWQgU1NMMSEwHwYDVQQDExhUcnVzdEFzaWEgRFYgU1NM
+IENBIC0gRzUwHhcNMTYxMjA2MDAwMDAwWhcNMTcxMjA2MjM1OTU5WjAgMR4wHAYD
+VQQDDBVtLmVjb2xvZ3ktZW1vYmlsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB
+DwAwggEKAoIBAQDxBsuwGdCZdEUs40SQcvUt+9hlmLTgcfkq/h9f1QVPxLq/PC+O
+sG76hOgy6N8f7k7x5XgtPKi9O4ydFl8ViYhEXRjYQcUrTm3lu7s9UT2AIUmK0dI+
+PZgFU5gDwh8fQLoL24T2lPfkD9TngCnDanfo3xbx/e9hsJkf7hKWix8zrxtYYCUT
+t96pTpQeWjr7ggl2bDEfTayJNM+i5xoGBPiQFdxPnKWCjNmXi2dws0d2whi1euRW
+gI5wIXji5WKfUf6EvzG0Uzz6i8vsSLGv8pL7C0AuUI4MrPNDesFeA2LEYclQkpHE
+E49BkpQvCokCW9d8/r5ASUry+7SrJIncU6FxAgMBAAGjggKJMIIChTAgBgNVHREE
+GTAXghVtLmVjb2xvZ3ktZW1vYmlsZS5jb20wCQYDVR0TBAIwADBhBgNVHSAEWjBY
+MFYGBmeBDAECATBMMCMGCCsGAQUFBwIBFhdodHRwczovL2Quc3ltY2IuY29tL2Nw
+czAlBggrBgEFBQcCAjAZDBdodHRwczovL2Quc3ltY2IuY29tL3JwYTAfBgNVHSME
+GDAWgBRtWMd/GufhPy6mjJc1Qrv00zisPzAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0l
+BBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMIGbBggrBgEFBQcBAQSBjjCBizA8Bggr
+BgEFBQcwAYYwaHR0cDovL3RydXN0YXNpYTItb2NzcC5kaWdpdGFsY2VydHZhbGlk
+YXRpb24uY29tMEsGCCsGAQUFBzAChj9odHRwOi8vdHJ1c3Rhc2lhMi1haWEuZGln
+aXRhbGNlcnR2YWxpZGF0aW9uLmNvbS90cnVzdGFzaWFnNS5jcnQwggEDBgorBgEE
+AdZ5AgQCBIH0BIHxAO8AdQDd6x0reg1PpiCLga2BaHB+Lo6dAdVciI09EcTNtuy+
+zAAAAVjT7zdSAAAEAwBGMEQCIDCzWufc1q7hjmrrCetGyoA8EsEqpRSIhmZXStX5
+8b7zAiA6x5aAaDK+yMyeAgw71yi3tRVrWayHN+W0+4BxC8u5UQB2AO5Lvbd1zmC6
+4UJpH6vhnmajD35fsHLYgwDEe4l6qP3LAAABWNPvN4kAAAQDAEcwRQIgZ/LNgg7n
+7AE4O2yZkrXNcqAOmJ3NU2nT6zcnBxPFTTsCIQCjyPbMfWMZTD3kxgxPQ1COw5zJ
+sM0dfNmSr3MiU7EhqDANBgkqhkiG9w0BAQsFAAOCAQEAeyfgUhg9ZWVCaz0f+BQU
+6fMMfmQ1BDzvVFu+ORoAqyJQogxwIdfjrlz/63YFee5qpUsW/aaz4ma3bb4dpE1K
+GsgYe5N3o0xybYlOj+KB61sufYkzQS3HgDevCwjfUlGEbNl4dpO2xh5s5AANXlnz
+s/X0+AJ33/bm+fWIjAbIjluaEoM6GETHTXi4Tlxy0j3nsXsB9tIIUibAdTtButef
+JJRnikGRN+eHjrsLYe0RUmdKOQz1ik6teHt0MQX0aCe8OlXeyGDd9m8u7+y0nAnH
+TVaNuT7vXMWyyXLVUcV898wkBo3Bo3hUiaw0QR0ttgDrf5ZwqPfqpytRW2K5GMZT
+uw==
+-----END CERTIFICATE-----
+
+
+-----BEGIN CERTIFICATE-----
+MIIFZTCCBE2gAwIBAgIQOhAOfxCeGsWcxf/2QNXkQjANBgkqhkiG9w0BAQsFADCB
+yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
+ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp
+U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW
+ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0
+aG9yaXR5IC0gRzUwHhcNMTYwODExMDAwMDAwWhcNMjYwODEwMjM1OTU5WjCBlzEL
+MAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMsIElu
+Yy4xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxHTAbBgNVBAsTFERv
+bWFpbiBWYWxpZGF0ZWQgU1NMMSEwHwYDVQQDExhUcnVzdEFzaWEgRFYgU1NMIENB
+IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC39aSJZG/97x3a
+6Qmuc9+MubagegRAVUmFYHTYTs8IKB2pM7wXN7W8mekdZaEgUjDFxvRBK/DhTb7U
+8ONLsKKdT86aOhzbz2noCTn9wPWnGwkg+/4YKg/dPQQdV9tMsSu0cwqInWHxSAkm
+AI1hYFC9D7Sf7Hp/5cRcD+dK454YMRzNOGLQnCVI8JEqrz6o9SOvQNTqTcfqt6DC
+0UlXG+MPD1eNPjlzf1Vwaab+VSTgySoC+Ikbq2VsdykeOiGXW/OIiASH7+2LcR05
+PmQ7GEOlM8yzoVojFpM8sHz+WxI05ZOPri5+vX3HhHHjWr5432G0dVmgohnZvlVZ
+oy8XrlbpAgMBAAGjggF2MIIBcjASBgNVHRMBAf8ECDAGAQH/AgEAMC8GA1UdHwQo
+MCYwJKAioCCGHmh0dHA6Ly9zLnN5bWNiLmNvbS9wY2EzLWc1LmNybDAOBgNVHQ8B
+Af8EBAMCAQYwLgYIKwYBBQUHAQEEIjAgMB4GCCsGAQUFBzABhhJodHRwOi8vcy5z
+eW1jZC5jb20wYQYDVR0gBFowWDBWBgZngQwBAgEwTDAjBggrBgEFBQcCARYXaHR0
+cHM6Ly9kLnN5bWNiLmNvbS9jcHMwJQYIKwYBBQUHAgIwGRoXaHR0cHM6Ly9kLnN5
+bWNiLmNvbS9ycGEwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMCkGA1Ud
+EQQiMCCkHjAcMRowGAYDVQQDExFTeW1hbnRlY1BLSS0yLTYwMTAdBgNVHQ4EFgQU
+bVjHfxrn4T8upoyXNUK79NM4rD8wHwYDVR0jBBgwFoAUf9Nlp8Ld7LvwMAnzQzn6
+Aq8zMTMwDQYJKoZIhvcNAQELBQADggEBABUphhBbeG7scE3EveIN0dOjXPgwgQi8
+I2ZAKYm6DawoGz1lEJVdvFmkyMbP973X80b7mKmn0nNbe1kjA4M0O0hHaMM1ZaEv
+7e9vHEAoGyysMO6HzPWYMkyNxcCV7Nos2Uv4RvLDpQHh7P4Kt6fUU13ipcynrtQD
+1lFUM0yoTzwwFsPu3Pk+94hL58ErqwqJQwxoHMgLIQeMVHeNKcWFy1bddSbIbCWU
+Zs6cMxhrra062ZCpDCbxyEaFNGAtYQMqNz55Z/14XgSUONZ/cJTns6QKhpcgTOwB
+fnNzRnk+aWreP7osKhXlz4zs+llP7goBDKFOMMtoEXx3YjJCKgpqmBU=
+-----END CERTIFICATE-----""",
+ "SSLName": "证书-1",
+ "Region": variables.get("Region"),
+ "PrivateKey": "abc",
+ "CaCert": """-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEA8QbLsBnQmXRFLONEkHL1LfvYZZi04HH5Kv4fX9UFT8S6vzwv
+jrBu+oToMujfH+5O8eV4LTyovTuMnRZfFYmIRF0Y2EHFK05t5bu7PVE9gCFJitHS
+Pj2YBVOYA8IfH0C6C9uE9pT35A/U54Apw2p36N8W8f3vYbCZH+4SlosfM68bWGAl
+E7feqU6UHlo6+4IJdmwxH02siTTPoucaBgT4kBXcT5ylgozZl4tncLNHdsIYtXrk
+VoCOcCF44uVin1H+hL8xtFM8+ovL7Eixr/KS+wtALlCODKzzQ3rBXgNixGHJUJKR
+xBOPQZKULwqJAlvXfP6+QElK8vu0qySJ3FOhcQIDAQABAoIBAAPvZnfzk/JNcauv
+8jihh9s+V2QhQCLB+Z14FK8N3U5WGe5xXx1nSAiTDu912d69l1BfvLyQVvjv9fXC
+nb7ORglHs9YkDMIOP8EWdZIkt2pWIMtBbbtSah78JGk7TCLIfcEfzmXwPLPehk1Z
+TFVCcb69lbRRvwzLQ1TAIFGQ5+uCEkW02KAl6kx+JnVpsE8/BjqZKG1Ne+sM6dOC
+GRd44hgiNHKUT3Xtbw6jttiUFDLKYMYtb7PpRAkZFM8tgnBV6dWWJ3xTYW9kOjPh
+XnScNARfphUZVibRhA04og5p1q/MUz9Sz9g2DURuSlo/MP3WZMbVRvZiUN1xhz5v
+2WhsddkCgYEA+gWPFo0TbVbZXUrx9J/ptI9NXNx5zjyUrv87MDt1pnmMDgWrsCEI
+RqQR4Lp2G11GA7IudiA/ipcZqgcRIIFvb+gu1kObox3BGGs59x+DqFeAPXt6dFG2
+W10f9k96/tcbdursurqwd3Zv3cqQqRTKgaP4xHFmexlcwGCF5YwewWMCgYEA9sos
+2acNINXwcNRUPnpg82DOrG9Zjr1aiNo9PDJmwGEdC9QMOUWM85dq0M9g388ttiLU
+Wr/U4r5yDuqWJPcKtff2BaxSsZpcQ4Id9eddD9L+sxaBGyD23RtOC+IOlkG6WS4g
+iUYulQvW69tBHWiwxQu7YMSIE2B3EuySPOQYlBsCgYEAxNwvqB/4lfT2PUDPdj+b
+cnILBf0LY1nL8GZCol2O6z91CW1pm8rGi2iQMxRd/nnYsPxRHO2TWnpS2M+rqp5/
+settRYQCPdMlwSZcg7oqnhgXf1GEP6Y/IX0Xt4cpXxLcKywarYRlggqdVlMyyA74
+zE7hhzuK5442u7rEctN7O+UCgYAoM78ipafp1XAZsT0YAG+Stg504J7CNe5tpL+c
+8sjyRd+pcZ2cJsxTUjNAWMf7LZDQvtPBBMb1OPjznRtgYi4IfqBBRFUkQXUOOkAP
+MuViEokTO3NErBYK5svL+8NMjuCAbpc2RYyJEyiru0fcNpW1Q7f+h4VzQp+jIY6h
+BLdMSQKBgGauU7OQksZCEY2MVAcD5dShYYvWLxOkj4dVVwISN1M6ImCAHwXZ6Nak
+6YlzCGT+NbRJbB2cPfsrKXtAJVX15I3iDCKAoGkb+9kiHnPj7Q71KVuWQE6BQx7E
+vE88TSsshwtX1s+qU9UWUrMPodK32q5nO3p8N033NvS9wLNfbcdc
+-----END RSA PRIVATE KEY-----""",
+ }
+ try:
+ resp = client.ulb().create_ssl(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["SSLId_01"] = utest.value_at_path(resp, "SSLId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateSSL",
+)
+def create_ssl_05(client, variables):
+ d = {
+ "UserCert": """-----BEGIN CERTIFICATE-----
+MIIFzTCCBLWgAwIBAgIQQ8IswmAhEIKfNhrKqb0F3DANBgkqhkiG9w0BAQsFADCB
+lzELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs
+IEluYy4xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxHTAbBgNVBAsT
+FERvbWFpbiBWYWxpZGF0ZWQgU1NMMSEwHwYDVQQDExhUcnVzdEFzaWEgRFYgU1NM
+IENBIC0gRzUwHhcNMTYxMjA2MDAwMDAwWhcNMTcxMjA2MjM1OTU5WjAgMR4wHAYD
+VQQDDBVtLmVjb2xvZ3ktZW1vYmlsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB
+DwAwggEKAoIBAQDxBsuwGdCZdEUs40SQcvUt+9hlmLTgcfkq/h9f1QVPxLq/PC+O
+sG76hOgy6N8f7k7x5XgtPKi9O4ydFl8ViYhEXRjYQcUrTm3lu7s9UT2AIUmK0dI+
+PZgFU5gDwh8fQLoL24T2lPfkD9TngCnDanfo3xbx/e9hsJkf7hKWix8zrxtYYCUT
+t96pTpQeWjr7ggl2bDEfTayJNM+i5xoGBPiQFdxPnKWCjNmXi2dws0d2whi1euRW
+gI5wIXji5WKfUf6EvzG0Uzz6i8vsSLGv8pL7C0AuUI4MrPNDesFeA2LEYclQkpHE
+E49BkpQvCokCW9d8/r5ASUry+7SrJIncU6FxAgMBAAGjggKJMIIChTAgBgNVHREE
+GTAXghVtLmVjb2xvZ3ktZW1vYmlsZS5jb20wCQYDVR0TBAIwADBhBgNVHSAEWjBY
+MFYGBmeBDAECATBMMCMGCCsGAQUFBwIBFhdodHRwczovL2Quc3ltY2IuY29tL2Nw
+czAlBggrBgEFBQcCAjAZDBdodHRwczovL2Quc3ltY2IuY29tL3JwYTAfBgNVHSME
+GDAWgBRtWMd/GufhPy6mjJc1Qrv00zisPzAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0l
+BBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMIGbBggrBgEFBQcBAQSBjjCBizA8Bggr
+BgEFBQcwAYYwaHR0cDovL3RydXN0YXNpYTItb2NzcC5kaWdpdGFsY2VydHZhbGlk
+YXRpb24uY29tMEsGCCsGAQUFBzAChj9odHRwOi8vdHJ1c3Rhc2lhMi1haWEuZGln
+aXRhbGNlcnR2YWxpZGF0aW9uLmNvbS90cnVzdGFzaWFnNS5jcnQwggEDBgorBgEE
+AdZ5AgQCBIH0BIHxAO8AdQDd6x0reg1PpiCLga2BaHB+Lo6dAdVciI09EcTNtuy+
+zAAAAVjT7zdSAAAEAwBGMEQCIDCzWufc1q7hjmrrCetGyoA8EsEqpRSIhmZXStX5
+8b7zAiA6x5aAaDK+yMyeAgw71yi3tRVrWayHN+W0+4BxC8u5UQB2AO5Lvbd1zmC6
+4UJpH6vhnmajD35fsHLYgwDEe4l6qP3LAAABWNPvN4kAAAQDAEcwRQIgZ/LNgg7n
+7AE4O2yZkrXNcqAOmJ3NU2nT6zcnBxPFTTsCIQCjyPbMfWMZTD3kxgxPQ1COw5zJ
+sM0dfNmSr3MiU7EhqDANBgkqhkiG9w0BAQsFAAOCAQEAeyfgUhg9ZWVCaz0f+BQU
+6fMMfmQ1BDzvVFu+ORoAqyJQogxwIdfjrlz/63YFee5qpUsW/aaz4ma3bb4dpE1K
+GsgYe5N3o0xybYlOj+KB61sufYkzQS3HgDevCwjfUlGEbNl4dpO2xh5s5AANXlnz
+s/X0+AJ33/bm+fWIjAbIjluaEoM6GETHTXi4Tlxy0j3nsXsB9tIIUibAdTtButef
+JJRnikGRN+eHjrsLYe0RUmdKOQz1ik6teHt0MQX0aCe8OlXeyGDd9m8u7+y0nAnH
+TVaNuT7vXMWyyXLVUcV898wkBo3Bo3hUiaw0QR0ttgDrf5ZwqPfqpytRW2K5GMZT
+uw==
+-----END CERTIFICATE-----
+
+
+-----BEGIN CERTIFICATE-----
+MIIFZTCCBE2gAwIBAgIQOhAOfxCeGsWcxf/2QNXkQjANBgkqhkiG9w0BAQsFADCB
+yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
+ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp
+U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW
+ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0
+aG9yaXR5IC0gRzUwHhcNMTYwODExMDAwMDAwWhcNMjYwODEwMjM1OTU5WjCBlzEL
+MAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMsIElu
+Yy4xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxHTAbBgNVBAsTFERv
+bWFpbiBWYWxpZGF0ZWQgU1NMMSEwHwYDVQQDExhUcnVzdEFzaWEgRFYgU1NMIENB
+IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC39aSJZG/97x3a
+6Qmuc9+MubagegRAVUmFYHTYTs8IKB2pM7wXN7W8mekdZaEgUjDFxvRBK/DhTb7U
+8ONLsKKdT86aOhzbz2noCTn9wPWnGwkg+/4YKg/dPQQdV9tMsSu0cwqInWHxSAkm
+AI1hYFC9D7Sf7Hp/5cRcD+dK454YMRzNOGLQnCVI8JEqrz6o9SOvQNTqTcfqt6DC
+0UlXG+MPD1eNPjlzf1Vwaab+VSTgySoC+Ikbq2VsdykeOiGXW/OIiASH7+2LcR05
+PmQ7GEOlM8yzoVojFpM8sHz+WxI05ZOPri5+vX3HhHHjWr5432G0dVmgohnZvlVZ
+oy8XrlbpAgMBAAGjggF2MIIBcjASBgNVHRMBAf8ECDAGAQH/AgEAMC8GA1UdHwQo
+MCYwJKAioCCGHmh0dHA6Ly9zLnN5bWNiLmNvbS9wY2EzLWc1LmNybDAOBgNVHQ8B
+Af8EBAMCAQYwLgYIKwYBBQUHAQEEIjAgMB4GCCsGAQUFBzABhhJodHRwOi8vcy5z
+eW1jZC5jb20wYQYDVR0gBFowWDBWBgZngQwBAgEwTDAjBggrBgEFBQcCARYXaHR0
+cHM6Ly9kLnN5bWNiLmNvbS9jcHMwJQYIKwYBBQUHAgIwGRoXaHR0cHM6Ly9kLnN5
+bWNiLmNvbS9ycGEwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMCkGA1Ud
+EQQiMCCkHjAcMRowGAYDVQQDExFTeW1hbnRlY1BLSS0yLTYwMTAdBgNVHQ4EFgQU
+bVjHfxrn4T8upoyXNUK79NM4rD8wHwYDVR0jBBgwFoAUf9Nlp8Ld7LvwMAnzQzn6
+Aq8zMTMwDQYJKoZIhvcNAQELBQADggEBABUphhBbeG7scE3EveIN0dOjXPgwgQi8
+I2ZAKYm6DawoGz1lEJVdvFmkyMbP973X80b7mKmn0nNbe1kjA4M0O0hHaMM1ZaEv
+7e9vHEAoGyysMO6HzPWYMkyNxcCV7Nos2Uv4RvLDpQHh7P4Kt6fUU13ipcynrtQD
+1lFUM0yoTzwwFsPu3Pk+94hL58ErqwqJQwxoHMgLIQeMVHeNKcWFy1bddSbIbCWU
+Zs6cMxhrra062ZCpDCbxyEaFNGAtYQMqNz55Z/14XgSUONZ/cJTns6QKhpcgTOwB
+fnNzRnk+aWreP7osKhXlz4zs+llP7goBDKFOMMtoEXx3YjJCKgpqmBU=
+-----END CERTIFICATE-----""",
+ "SSLName": "证书-2",
+ "Region": variables.get("Region"),
+ "PrivateKey": "abc",
+ "CaCert": """-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEA8QbLsBnQmXRFLONEkHL1LfvYZZi04HH5Kv4fX9UFT8S6vzwv
+jrBu+oToMujfH+5O8eV4LTyovTuMnRZfFYmIRF0Y2EHFK05t5bu7PVE9gCFJitHS
+Pj2YBVOYA8IfH0C6C9uE9pT35A/U54Apw2p36N8W8f3vYbCZH+4SlosfM68bWGAl
+E7feqU6UHlo6+4IJdmwxH02siTTPoucaBgT4kBXcT5ylgozZl4tncLNHdsIYtXrk
+VoCOcCF44uVin1H+hL8xtFM8+ovL7Eixr/KS+wtALlCODKzzQ3rBXgNixGHJUJKR
+xBOPQZKULwqJAlvXfP6+QElK8vu0qySJ3FOhcQIDAQABAoIBAAPvZnfzk/JNcauv
+8jihh9s+V2QhQCLB+Z14FK8N3U5WGe5xXx1nSAiTDu912d69l1BfvLyQVvjv9fXC
+nb7ORglHs9YkDMIOP8EWdZIkt2pWIMtBbbtSah78JGk7TCLIfcEfzmXwPLPehk1Z
+TFVCcb69lbRRvwzLQ1TAIFGQ5+uCEkW02KAl6kx+JnVpsE8/BjqZKG1Ne+sM6dOC
+GRd44hgiNHKUT3Xtbw6jttiUFDLKYMYtb7PpRAkZFM8tgnBV6dWWJ3xTYW9kOjPh
+XnScNARfphUZVibRhA04og5p1q/MUz9Sz9g2DURuSlo/MP3WZMbVRvZiUN1xhz5v
+2WhsddkCgYEA+gWPFo0TbVbZXUrx9J/ptI9NXNx5zjyUrv87MDt1pnmMDgWrsCEI
+RqQR4Lp2G11GA7IudiA/ipcZqgcRIIFvb+gu1kObox3BGGs59x+DqFeAPXt6dFG2
+W10f9k96/tcbdursurqwd3Zv3cqQqRTKgaP4xHFmexlcwGCF5YwewWMCgYEA9sos
+2acNINXwcNRUPnpg82DOrG9Zjr1aiNo9PDJmwGEdC9QMOUWM85dq0M9g388ttiLU
+Wr/U4r5yDuqWJPcKtff2BaxSsZpcQ4Id9eddD9L+sxaBGyD23RtOC+IOlkG6WS4g
+iUYulQvW69tBHWiwxQu7YMSIE2B3EuySPOQYlBsCgYEAxNwvqB/4lfT2PUDPdj+b
+cnILBf0LY1nL8GZCol2O6z91CW1pm8rGi2iQMxRd/nnYsPxRHO2TWnpS2M+rqp5/
+settRYQCPdMlwSZcg7oqnhgXf1GEP6Y/IX0Xt4cpXxLcKywarYRlggqdVlMyyA74
+zE7hhzuK5442u7rEctN7O+UCgYAoM78ipafp1XAZsT0YAG+Stg504J7CNe5tpL+c
+8sjyRd+pcZ2cJsxTUjNAWMf7LZDQvtPBBMb1OPjznRtgYi4IfqBBRFUkQXUOOkAP
+MuViEokTO3NErBYK5svL+8NMjuCAbpc2RYyJEyiru0fcNpW1Q7f+h4VzQp+jIY6h
+BLdMSQKBgGauU7OQksZCEY2MVAcD5dShYYvWLxOkj4dVVwISN1M6ImCAHwXZ6Nak
+6YlzCGT+NbRJbB2cPfsrKXtAJVX15I3iDCKAoGkb+9kiHnPj7Q71KVuWQE6BQx7E
+vE88TSsshwtX1s+qU9UWUrMPodK32q5nO3p8N033NvS9wLNfbcdc
+-----END RSA PRIVATE KEY-----""",
+ }
+ try:
+ resp = client.ulb().create_ssl(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["SSLId_02"] = utest.value_at_path(resp, "SSLId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.SSLId", variables.get("SSLId_01")),
+ ],
+ action="DescribeSSL",
+)
+def describe_ssl_06(client, variables):
+ d = {"SSLId": variables.get("SSLId_01"), "Region": variables.get("Region")}
+ try:
+ resp = client.ulb().describe_ssl(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.SSLId", variables.get("SSLId_02")),
+ ],
+ action="DescribeSSL",
+)
+def describe_ssl_07(client, variables):
+ d = {"SSLId": variables.get("SSLId_02"), "Region": variables.get("Region")}
+ try:
+ resp = client.ulb().describe_ssl(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="BindSSL",
+)
+def bind_ssl_08(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "ULBId": variables.get("ULBId"),
+ "SSLId": variables.get("SSLId_01"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.ulb().bind_ssl(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UpdateSSLBinding",
+)
+def update_ssl_binding_09(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "ULBId": variables.get("ULBId"),
+ "Region": variables.get("Region"),
+ "OldSSLId": variables.get("SSLId_01"),
+ "NewSSLId": variables.get("SSLId_02"),
+ }
+ try:
+ resp = client.invoke("UpdateSSLBinding", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UnbindSSL",
+)
+def unbind_ssl_10(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "ULBId": variables.get("ULBId"),
+ "SSLId": variables.get("SSLId_02"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.ulb().unbind_ssl(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteSSL",
+)
+def delete_ssl_11(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "ULBId": variables.get("ULBId"),
+ "SSLId": variables.get("SSLId_01"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.ulb().delete_ssl(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteSSL",
+)
+def delete_ssl_12(client, variables):
+ d = {"SSLId": variables.get("SSLId_02"), "Region": variables.get("Region")}
+ try:
+ resp = client.ulb().delete_ssl(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteVServer",
+)
+def delete_vserver_13(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "ULBId": variables.get("ULBId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.ulb().delete_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteULB",
+)
+def delete_ulb_14(client, variables):
+ d = {"ULBId": variables.get("ULBId"), "Region": variables.get("Region")}
+ try:
+ resp = client.ulb().delete_ulb(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteSubnet",
+)
+def delete_subnet_15(client, variables):
+ d = {
+ "SubnetId": variables.get("subnet_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.vpc().delete_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteVPC",
+)
+def delete_vpc_16(client, variables):
+ d = {"VPCId": variables.get("vpc_id"), "Region": variables.get("Region")}
+ try:
+ resp = client.vpc().delete_vpc(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_268.py b/tests/test_services/test_set_268.py
new file mode 100644
index 0000000..4f92fa4
--- /dev/null
+++ b/tests/test_services/test_set_268.py
@@ -0,0 +1,339 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(268)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_268(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["eip_bw"] = 2
+ scenario.variables["bwp1_bw"] = 3
+ scenario.variables["eip_operatorname"] = "Bgp"
+ scenario.variables["bwp2_bw"] = 4
+ scenario.variables["Image_Id"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["Image_Id"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="AllocateEIP",
+)
+def allocate_eip_01(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "PayMode": "Bandwidth",
+ "OperatorName": variables.get("eip_operatorname"),
+ "Name": "eip_auto",
+ "ChargeType": "Month",
+ "Bandwidth": variables.get("eip_bw"),
+ }
+ try:
+ resp = client.unet().allocate_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["eip_id"] = utest.value_at_path(resp, "EIPSet.0.EIPId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("len_ge", "UHostIds", 0),
+ ],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "TimemachineFeature": "No",
+ "Tag": "Default",
+ "Region": variables.get("Region"),
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "Name": "packet-s1-bgp",
+ "Memory": 1024,
+ "LoginMode": "Password",
+ "ImageId": variables.get("Image_Id"),
+ "HotplugFeature": False,
+ "DiskSpace": 0,
+ "CPU": 1,
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["UHostId"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=180,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="BindEIP",
+)
+def bind_eip_03(client, variables):
+ d = {
+ "ResourceType": "uhost",
+ "ResourceId": variables.get("UHostId"),
+ "Region": variables.get("Region"),
+ "EIPId": variables.get("eip_id"),
+ }
+ try:
+ resp = client.unet().bind_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateBandwidthPackage",
+)
+def create_bandwidth_package_04(client, variables):
+ d = {
+ "TimeRange": 2,
+ "Region": variables.get("Region"),
+ "EnableTime": 30 + funcs.get_timestamp(10),
+ "EIPId": variables.get("eip_id"),
+ "Bandwidth": variables.get("bwp1_bw"),
+ }
+ try:
+ resp = client.unet().create_bandwidth_package(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["bwp_id1"] = utest.value_at_path(resp, "BandwidthPackageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSets.0.EIPId", variables.get("eip_id")),
+ ("str_eq", "DataSets.0.Bandwidth", variables.get("bwp1_bw")),
+ ("str_eq", "DataSets.0.BandwidthPackageId", variables.get("bwp_id1")),
+ ],
+ action="DescribeBandwidthPackage",
+)
+def describe_bandwidth_package_05(client, variables):
+ d = {"Region": variables.get("Region"), "Offset": 0, "Limit": 1}
+ try:
+ resp = client.unet().describe_bandwidth_package(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteBandwidthPackage",
+)
+def delete_bandwidth_package_06(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "BandwidthPackageId": variables.get("bwp_id1"),
+ }
+ try:
+ resp = client.unet().delete_bandwidth_package(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateBandwidthPackage",
+)
+def create_bandwidth_package_07(client, variables):
+ d = {
+ "TimeRange": 1,
+ "Region": variables.get("Region"),
+ "EIPId": variables.get("eip_id"),
+ "Bandwidth": variables.get("bwp2_bw"),
+ }
+ try:
+ resp = client.unet().create_bandwidth_package(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["bwp_id2"] = utest.value_at_path(resp, "BandwidthPackageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSets.0.EIPId", variables.get("eip_id")),
+ ("str_eq", "DataSets.0.Bandwidth", variables.get("bwp2_bw")),
+ ("str_eq", "DataSets.0.BandwidthPackageId", variables.get("bwp_id2")),
+ ],
+ action="DescribeBandwidthPackage",
+)
+def describe_bandwidth_package_08(client, variables):
+ d = {"Region": variables.get("Region"), "Offset": 0, "Limit": 1}
+ try:
+ resp = client.unet().describe_bandwidth_package(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteBandwidthPackage",
+)
+def delete_bandwidth_package_09(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "BandwidthPackageId": variables.get("bwp_id2"),
+ }
+ try:
+ resp = client.unet().delete_bandwidth_package(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UnBindEIP",
+)
+def un_bind_eip_10(client, variables):
+ d = {
+ "ResourceType": "uhost",
+ "ResourceId": variables.get("UHostId"),
+ "Region": variables.get("Region"),
+ "EIPId": variables.get("eip_id"),
+ }
+ try:
+ resp = client.unet().un_bind_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ReleaseEIP",
+)
+def release_eip_11(client, variables):
+ d = {"Region": variables.get("Region"), "EIPId": variables.get("eip_id")}
+ try:
+ resp = client.unet().release_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ action="PoweroffUHostInstance",
+)
+def poweroff_uhost_instance_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("UHostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().poweroff_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("UHostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_279.py b/tests/test_services/test_set_279.py
new file mode 100644
index 0000000..2c8644a
--- /dev/null
+++ b/tests/test_services/test_set_279.py
@@ -0,0 +1,452 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(279)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_279(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Image_Id"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["Image_Id"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("len_ge", "UHostIds", 0),
+ ],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "TimemachineFeature": "No",
+ "Tag": "Default",
+ "Region": variables.get("Region"),
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "Name": "eip-s1-bgp",
+ "Memory": 1024,
+ "LoginMode": "Password",
+ "ImageId": variables.get("Image_Id"),
+ "HotplugFeature": False,
+ "DiskSpace": 0,
+ "CPU": 1,
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["UHostId"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=120,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="AllocateEIP",
+)
+def allocate_eip_02(client, variables):
+ d = {
+ "Tag": "Default",
+ "Remark": "test",
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "PayMode": "Bandwidth",
+ "OperatorName": "Bgp",
+ "Name": "eip-bgp-01",
+ "ChargeType": "Dynamic",
+ "Bandwidth": 2,
+ }
+ try:
+ resp = client.unet().allocate_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["EIPId_01"] = utest.value_at_path(resp, "EIPSet.0.EIPId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "EIPSet.0.EIPId", variables.get("EIPId_01")),
+ ],
+ action="DescribeEIP",
+)
+def describe_eip_03(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "EIPIds": [variables.get("EIPId_01")],
+ }
+ try:
+ resp = client.unet().describe_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UpdateEIPAttribute",
+)
+def update_eip_attribute_04(client, variables):
+ d = {
+ "Tag": "huangchao",
+ "Remark": "test-gai",
+ "Region": variables.get("Region"),
+ "Name": "eip-auto-gai",
+ "EIPId": variables.get("EIPId_01"),
+ }
+ try:
+ resp = client.unet().update_eip_attribute(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="GetEIPPrice",
+)
+def get_eip_price_05(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "OperatorName": "Bgp",
+ "Bandwidth": 2,
+ }
+ try:
+ resp = client.unet().get_eip_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="BindEIP",
+)
+def bind_eip_06(client, variables):
+ d = {
+ "ResourceType": "uhost",
+ "ResourceId": variables.get("UHostId"),
+ "Region": variables.get("Region"),
+ "EIPId": variables.get("EIPId_01"),
+ }
+ try:
+ resp = client.unet().bind_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "EIPSet.0.Resource.ResourceID", variables.get("UHostId")),
+ ],
+ action="DescribeEIP",
+)
+def describe_eip_07(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "EIPIds": [variables.get("EIPId_01")],
+ }
+ try:
+ resp = client.unet().describe_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ModifyEIPBandwidth",
+)
+def modify_eip_bandwidth_08(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "EIPId": variables.get("EIPId_01"),
+ "Bandwidth": 3,
+ }
+ try:
+ resp = client.unet().modify_eip_bandwidth(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="SetEIPPayMode",
+)
+def set_eip_pay_mode_09(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "PayMode": "Traffic",
+ "EIPId": variables.get("EIPId_01"),
+ "Bandwidth": 2,
+ }
+ try:
+ resp = client.unet().set_eip_pay_mode(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ModifyEIPWeight",
+)
+def modify_eip_weight_10(client, variables):
+ d = {
+ "Weight": 100,
+ "Region": variables.get("Region"),
+ "EIPId": variables.get("EIPId_01"),
+ }
+ try:
+ resp = client.unet().modify_eip_weight(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "UnBindEIPResponse"),
+ ],
+ action="UnBindEIP",
+)
+def un_bind_eip_11(client, variables):
+ d = {
+ "ResourceType": "uhost",
+ "ResourceId": variables.get("UHostId"),
+ "Region": variables.get("Region"),
+ "EIPId": variables.get("EIPId_01"),
+ }
+ try:
+ resp = client.unet().un_bind_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="AllocateEIP",
+)
+def allocate_eip_12(client, variables):
+ d = {
+ "Tag": "Default",
+ "Remark": "test",
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "PayMode": "Bandwidth",
+ "OperatorName": "Bgp",
+ "Name": "eip-bgp-01",
+ "ChargeType": "Dynamic",
+ "Bandwidth": 2,
+ }
+ try:
+ resp = client.unet().allocate_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["EIPId_02"] = utest.value_at_path(resp, "EIPSet.0.EIPId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("gt", "TotalCount", 1),
+ ("len_eq", "EIPSet", 1),
+ ],
+ action="DescribeEIP",
+)
+def describe_eip_13(client, variables):
+ d = {"Region": variables.get("Region"), "Limit": 1}
+ try:
+ resp = client.unet().describe_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 8039)],
+ action="ReleaseEIP",
+)
+def release_eip_14(client, variables):
+ d = {"Region": variables.get("Region"), "EIPId": variables.get("EIPId_01")}
+ try:
+ resp = client.unet().release_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "TotalCount", 0),
+ ],
+ action="DescribeEIP",
+)
+def describe_eip_15(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "EIPIds": [variables.get("EIPId_01")],
+ }
+ try:
+ resp = client.unet().describe_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ReleaseEIP",
+)
+def release_eip_16(client, variables):
+ d = {"Region": variables.get("Region"), "EIPId": variables.get("EIPId_02")}
+ try:
+ resp = client.unet().release_eip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ action="PoweroffUHostInstance",
+)
+def poweroff_uhost_instance_17(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("UHostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().poweroff_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_18(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("UHostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_283.py b/tests/test_services/test_set_283.py
new file mode 100644
index 0000000..807b2b9
--- /dev/null
+++ b/tests/test_services/test_set_283.py
@@ -0,0 +1,618 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(283)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_283(client, variables):
+ scenario.initial(variables)
+ scenario.variables["HostName"] = "auto_host_test1"
+ scenario.variables["Password"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["ChargeType"] = "Month"
+ scenario.variables["CreateCPU"] = 1
+ scenario.variables["CreateMem"] = 1024
+ scenario.variables["ImageId"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.variables["BootSize"] = 20
+ scenario.variables["BootType"] = "CLOUD_SSD"
+ scenario.variables["BootBackup"] = "NONE"
+ scenario.variables["DiskSize"] = 20
+ scenario.variables["DiskType"] = "CLOUD_NORMAL"
+ scenario.variables["DiskBackup"] = "NONE"
+ scenario.variables["UHostType"] = "N2"
+ scenario.variables["UDiskType"] = "DataDisk"
+ scenario.variables["UDiskName"] = "auto_udisk_noArk"
+ scenario.variables["UDataArkMode"] = "No"
+ scenario.variables["Size"] = 1
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ImageId"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDiskPrice",
+)
+def describe_udisk_price_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDataArkMode": variables.get("UDataArkMode"),
+ "Size": variables.get("Size"),
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "DiskType": variables.get("UDiskType"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udisk().describe_udisk_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDiskAllowance",
+)
+def check_udisk_allowance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": variables.get("Size"),
+ "Region": variables.get("Region"),
+ "Count": 1,
+ }
+ try:
+ resp = client.invoke("CheckUDiskAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDisk",
+)
+def create_udisk_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDataArkMode": variables.get("UDataArkMode"),
+ "Size": variables.get("Size"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Name": variables.get("UDiskName"),
+ "DiskType": variables.get("UDiskType"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udisk().create_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["udisk_noArk_id"] = utest.value_at_path(resp, "UDiskId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDiskResponse"),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ("str_eq", "DataSet.0.Tag", "Default"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="RenameUDisk",
+)
+def rename_udisk_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskName": funcs.concat("re_", variables.get("UDiskName")),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().rename_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat("re_", variables.get("UDiskName")),
+ ),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDiskUpgradePriceResponse"),
+ ],
+ action="DescribeUDiskUpgradePrice",
+)
+def describe_udisk_upgrade_price_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SourceId": variables.get("udisk_noArk_id"),
+ "Size": variables.get("Size") + 1,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk_upgrade_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ResizeUDiskResponse"),
+ ],
+ action="ResizeUDisk",
+)
+def resize_udisk_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Size": variables.get("Size") + 1,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().resize_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDiskResponse"),
+ ("str_eq", "DataSet.0.Size", variables.get("Size") + 1),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ImageId"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreateUHostInstanceResponse"),
+ ],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostType": variables.get("UHostType"),
+ "TimemachineFeature": "No",
+ "Tag": "Default",
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Password": "VGVzdDEyMzRUZXN0MTIzNA==",
+ "NetCapability": "Normal",
+ "Name": variables.get("HostName"),
+ "Memory": variables.get("CreateMem"),
+ "LoginMode": "Password",
+ "ImageId": variables.get("ImageId"),
+ "HotplugFeature": False,
+ "GPU": False,
+ "Disks": [
+ {
+ "BackupType": variables.get("BootBackup"),
+ "IsBoot": True,
+ "Size": variables.get("BootSize"),
+ "Type": variables.get("BootType"),
+ }
+ ],
+ "ChargeType": variables.get("ChargeType"),
+ "CPU": variables.get("CreateCPU"),
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["uhost_id"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.UHostId", variables.get("uhost_id")),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("uhost_id")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=120,
+ retry_interval=5,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("uhost_id")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("ne", "TotalCount", 0),
+ ],
+ action="DescribeUHostLite",
+)
+def describe_uhost_lite_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 60,
+ }
+ try:
+ resp = client.invoke("DescribeUHostLite", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="AttachUDisk",
+)
+def attach_udisk_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("uhost_id"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().attach_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=200,
+ retry_interval=3,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Status", "InUse"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_16(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UDiskId", variables.get("udisk_noArk_id")),
+ ("str_eq", "UHostId", variables.get("uhost_id")),
+ ],
+ action="DetachUDisk",
+)
+def detach_udisk_17(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("uhost_id"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().detach_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=5,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_18(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDisk",
+)
+def delete_udisk_19(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().delete_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="PoweroffUHostInstance",
+)
+def poweroff_uhost_instance_20(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("uhost_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().poweroff_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_21(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("uhost_id")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_22(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("uhost_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_286.py b/tests/test_services/test_set_286.py
new file mode 100644
index 0000000..dc7af7b
--- /dev/null
+++ b/tests/test_services/test_set_286.py
@@ -0,0 +1,332 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(286)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_286(client, variables):
+ scenario.initial(variables)
+ scenario.variables["UDiskType"] = "DataDisk"
+ scenario.variables["Size"] = 1
+ scenario.variables["UDataArkMode"] = "No"
+ scenario.variables["UDiskName"] = "auto_udisk_noArk"
+ scenario.variables["UDiskCloneName"] = "auto_udisk_noArk_Clone"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDiskPrice",
+)
+def describe_udisk_price_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDataArkMode": variables.get("UDataArkMode"),
+ "Size": variables.get("Size"),
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "DiskType": variables.get("UDiskType"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udisk().describe_udisk_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CheckUDiskAllowanceResponse"),
+ ],
+ action="CheckUDiskAllowance",
+)
+def check_udisk_allowance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 10,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("CheckUDiskAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDisk",
+)
+def create_udisk_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDataArkMode": variables.get("UDataArkMode"),
+ "Tag": "test",
+ "Size": variables.get("Size"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Name": variables.get("UDiskName"),
+ "DiskType": variables.get("UDiskType"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udisk().create_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["udisk_noArk_id"] = utest.value_at_path(resp, "UDiskId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ("str_eq", "DataSet.0.Tag", "test"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CloneUDiskResponse"),
+ ],
+ action="CloneUDisk",
+)
+def clone_udisk_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SourceId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Name": variables.get("UDiskCloneName"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udisk().clone_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["udisk_noArk_id_clone"] = utest.value_at_path(resp, "UDiskId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDiskUpgradePrice",
+)
+def describe_udisk_upgrade_price_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDataArkMode": variables.get("UDataArkMode"),
+ "SourceId": variables.get("udisk_noArk_id"),
+ "Size": variables.get("Size") + 1,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk_upgrade_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=80,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeUDisk",
+)
+def resize_udisk_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Size": variables.get("Size") + 1,
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().resize_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Size", variables.get("Size") + 1),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=40,
+ retry_interval=3,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDiskResponse"),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id_clone"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDisk",
+)
+def delete_udisk_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().delete_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDisk",
+)
+def describe_udisk_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteUDiskResponse"),
+ ],
+ action="DeleteUDisk",
+)
+def delete_udisk_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id_clone"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().delete_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDisk",
+)
+def describe_udisk_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id_clone"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_293.py b/tests/test_services/test_set_293.py
new file mode 100644
index 0000000..59cbd9d
--- /dev/null
+++ b/tests/test_services/test_set_293.py
@@ -0,0 +1,616 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(293)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_293(client, variables):
+ scenario.initial(variables)
+ scenario.variables["HostName"] = "auto_host_test4"
+ scenario.variables["Password"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["ChargeType"] = "Month"
+ scenario.variables["CreateCPU"] = 1
+ scenario.variables["CreateMem"] = 1024
+ scenario.variables["ImageId"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.variables["BootSize"] = 20
+ scenario.variables["BootType"] = "CLOUD_SSD"
+ scenario.variables["BootBackup"] = "NONE"
+ scenario.variables["DiskSize"] = 20
+ scenario.variables["DiskType"] = "CLOUD_NORMAL"
+ scenario.variables["DiskBackup"] = "NONE"
+ scenario.variables["UHostType"] = "N2"
+ scenario.variables["UDiskType"] = "DataDisk"
+ scenario.variables["UDiskName"] = "auto_udisk_noArk4"
+ scenario.variables["UDataArkMode"] = "No"
+ scenario.variables["Size"] = 1
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDiskPrice",
+)
+def describe_udisk_price_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDataArkMode": variables.get("UDataArkMode"),
+ "Size": variables.get("Size"),
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "DiskType": variables.get("UDiskType"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udisk().describe_udisk_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CheckUDiskAllowanceResponse"),
+ ],
+ action="CheckUDiskAllowance",
+)
+def check_udisk_allowance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 100,
+ "Region": variables.get("Region"),
+ "Count": 1,
+ }
+ try:
+ resp = client.invoke("CheckUDiskAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreateUDiskResponse"),
+ ],
+ action="CreateUDisk",
+)
+def create_udisk_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDataArkMode": variables.get("UDataArkMode"),
+ "Size": variables.get("Size"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Name": variables.get("UDiskName"),
+ "DiskType": variables.get("UDiskType"),
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udisk().create_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["udisk_noArk_id"] = utest.value_at_path(resp, "UDiskId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "SetUDiskUDataArkModeResponse"),
+ ],
+ action="SetUDiskUDataArkMode",
+)
+def set_udisk__udataark_mode_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "UDataArkMode": "Yes",
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().set_udisk__udataark_mode(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=5,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.UDataArkMode", "Yes"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=300,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreateUDiskSnapshotResponse"),
+ ],
+ action="CreateUDiskSnapshot",
+)
+def create_udisk_snapshot_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ "Name": "snapshot_01_Ark",
+ "Comment": "comment_01_Ark",
+ }
+ try:
+ resp = client.udisk().create_udisk_snapshot(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["snapshot_id"] = utest.value_at_path(resp, "SnapshotId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=3,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.SnapshotLimit", 3),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ("str_eq", "DataSet.0.SnapshotCount", 1),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDiskSnapshotResponse"),
+ ("str_eq", "DataSet.0.UDiskId", variables.get("udisk_noArk_id")),
+ ("str_eq", "DataSet.0.Status", "Normal"),
+ ],
+ action="DescribeUDiskSnapshot",
+)
+def describe_udisk_snapshot_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SnapshotId": variables.get("snapshot_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk_snapshot(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CloneUDiskSnapshotResponse"),
+ ],
+ action="CloneUDiskSnapshot",
+)
+def clone_udisk_snapshot_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDataArkMode": "Yes",
+ "SourceId": variables.get("snapshot_id"),
+ "Size": variables.get("Size"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Name": "snap1_clone_Ark",
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udisk().clone_udisk_snapshot(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["snapClone1_udisk_id"] = utest.value_at_path(resp, "UDiskId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=5,
+ startup_delay=120,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ("str_eq", "DataSet.0.Name", "snap1_clone_Ark"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("snapClone1_udisk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CloneUDiskSnapshot",
+)
+def clone_udisk_snapshot_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDataArkMode": "No",
+ "SourceId": variables.get("snapshot_id"),
+ "Size": variables.get("Size"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Name": "snap1_clone_noArk",
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udisk().clone_udisk_snapshot(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["snapClone2_udisk_id"] = utest.value_at_path(resp, "UDiskId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=5,
+ startup_delay=120,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ("str_eq", "DataSet.0.Name", "snap1_clone_noArk"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("snapClone2_udisk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "RestoreUDiskResponse"),
+ ],
+ action="RestoreUDisk",
+)
+def restore_udisk_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "SnapshotId": variables.get("snapshot_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().restore_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=1,
+ startup_delay=120,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDiskResponse"),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteSnapshotResponse"),
+ ("str_eq", "SnapshotId", variables.get("snapshot_id")),
+ ],
+ action="DeleteSnapshot",
+)
+def delete_snapshot_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SnapshotId": variables.get("snapshot_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DeleteSnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDiskSnapshotResponse"),
+ ("str_eq", "TotalCount", 0),
+ ],
+ action="DescribeUDiskSnapshot",
+)
+def describe_udisk_snapshot_16(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SnapshotId": variables.get("snapshot_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk_snapshot(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=2,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_17(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteUDiskResponse"),
+ ],
+ action="DeleteUDisk",
+)
+def delete_udisk_18(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("udisk_noArk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().delete_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_19(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("snapClone1_udisk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteUDiskResponse"),
+ ],
+ action="DeleteUDisk",
+)
+def delete_udisk_20(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("snapClone1_udisk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().delete_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.Status", "Available"),
+ ],
+ action="DescribeUDisk",
+)
+def describe_udisk_21(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("snapClone2_udisk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().describe_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=2,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteUDiskResponse"),
+ ],
+ action="DeleteUDisk",
+)
+def delete_udisk_22(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UDiskId": variables.get("snapClone2_udisk_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.udisk().delete_udisk(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_2935.py b/tests/test_services/test_set_2935.py
new file mode 100644
index 0000000..103c045
--- /dev/null
+++ b/tests/test_services/test_set_2935.py
@@ -0,0 +1,153 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(2935)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_2935(client, variables):
+ scenario.initial(variables)
+ scenario.variables[
+ "Image_Id_ucloud"
+ ] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.variables["saopaulo_image"] = "uimage-1bkjka"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["Image_Id_ucloud"] = utest.value_at_path(
+ resp, "ImageSet.0.ImageId"
+ )
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateULB",
+)
+def create_ulb_01(client, variables):
+ d = {
+ "ULBName": "测试",
+ "Tag": "Default",
+ "Region": variables.get("Region"),
+ "InnerMode": "No",
+ }
+ try:
+ resp = client.ulb().create_ulb(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ULBId"] = utest.value_at_path(resp, "ULBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("len_ge", "DataSet", 1),
+ ],
+ action="DescribeULBSimple",
+)
+def describe_ulb_simple_02(client, variables):
+ d = {"Region": variables.get("Region")}
+ try:
+ resp = client.invoke("DescribeULBSimple", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("len_eq", "DataSet", 1),
+ ],
+ action="DescribeULBSimple",
+)
+def describe_ulb_simple_03(client, variables):
+ d = {"ULBId": variables.get("ULBId"), "Region": variables.get("Region")}
+ try:
+ resp = client.invoke("DescribeULBSimple", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.ULBId", variables.get("ULBId")),
+ ],
+ action="DescribeULB",
+)
+def describe_ulb_04(client, variables):
+ d = {
+ "ULBId": variables.get("ULBId"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 60,
+ }
+ try:
+ resp = client.ulb().describe_ulb(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteULB",
+)
+def delete_ulb_05(client, variables):
+ d = {"ULBId": variables.get("ULBId"), "Region": variables.get("Region")}
+ try:
+ resp = client.ulb().delete_ulb(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_302.py b/tests/test_services/test_set_302.py
new file mode 100644
index 0000000..53ced59
--- /dev/null
+++ b/tests/test_services/test_set_302.py
@@ -0,0 +1,477 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(302)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_302(client, variables):
+ scenario.initial(variables)
+ scenario.variables["tag"] = "tag_api_test"
+ scenario.variables["remark"] = "remark_api_test"
+ scenario.variables["fw_name_1"] = funcs.concat(
+ "fw_A_", funcs.get_timestamp(13), "_"
+ )
+ scenario.variables["fw_rule_1_protocol"] = "TCP"
+ scenario.variables["fw_rule_1_port"] = 1111
+ scenario.variables["fw_rule_1_srcip"] = "0.0.0.0/0"
+ scenario.variables["fw_rule_1_action"] = "ACCEPT"
+ scenario.variables["fw_rule_1_priority"] = "HIGH"
+ scenario.variables["uhost_name_1"] = "firewall_api_test"
+ scenario.variables["fw_rule_2_protocol"] = "UDP"
+ scenario.variables["fw_rule_2_port"] = 2222
+ scenario.variables["fw_rule_2_srcip"] = "10.0.0.0/8"
+ scenario.variables["fw_rule_2_action"] = "DROP"
+ scenario.variables["fw_rule_2_priority"] = "LOW"
+ scenario.variables["fw_name_2"] = funcs.concat(
+ "fw_B_", funcs.get_timestamp(13), "_"
+ )
+ scenario.variables["tag_2"] = "tag_api_test_3"
+ scenario.variables["remark_2"] = "remark_api_test_3"
+ scenario.variables["Image_Id"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.variables["recommend_web"] = "recommend web"
+ scenario.variables["fw_rule_1"] = "TCP|1111|0.0.0.0/0|ACCEPT|HIGH"
+ scenario.variables["fw_rule_2"] = "UDP|2222|10.0.0.0/8|DROP|LOW"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["Image_Id"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeFirewall",
+)
+def describe_firewall_01(client, variables):
+ d = {"Region": variables.get("Region")}
+ try:
+ resp = client.unet().describe_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Tag": variables.get("tag"),
+ "Region": variables.get("Region"),
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "Name": variables.get("uhost_name_1"),
+ "Memory": 1024,
+ "LoginMode": "Password",
+ "ImageId": variables.get("Image_Id"),
+ "DiskSpace": 0,
+ "CPU": 1,
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["uhost_id1"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=180,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateFirewall",
+)
+def create_firewall_03(client, variables):
+ d = {
+ "Tag": variables.get("tag"),
+ "Rule": [variables.get("fw_rule_1")],
+ "Remark": variables.get("remark"),
+ "Region": variables.get("Region"),
+ "Name": funcs.concat(variables.get("fw_name_1"), variables.get("Zone")),
+ }
+ try:
+ resp = client.unet().create_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["fw_id1"] = utest.value_at_path(resp, "FWId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.FWId", variables.get("fw_id1")),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("fw_name_1"), variables.get("Zone")),
+ ),
+ ("str_eq", "DataSet.0.Tag", variables.get("tag")),
+ ("str_eq", "DataSet.0.Remark", variables.get("remark")),
+ ("str_eq", "DataSet.0.ResourceCount", 0),
+ ("str_eq", "DataSet.0.Type", "user defined"),
+ (
+ "str_eq",
+ "DataSet.0.Rule.0.ProtocolType",
+ variables.get("fw_rule_1_protocol"),
+ ),
+ ("str_eq", "DataSet.0.Rule.0.DstPort", variables.get("fw_rule_1_port")),
+ ("str_eq", "DataSet.0.Rule.0.SrcIP", variables.get("fw_rule_1_srcip")),
+ (
+ "str_eq",
+ "DataSet.0.Rule.0.RuleAction",
+ variables.get("fw_rule_1_action"),
+ ),
+ (
+ "str_eq",
+ "DataSet.0.Rule.0.Priority",
+ variables.get("fw_rule_1_priority"),
+ ),
+ ],
+ action="DescribeFirewall",
+)
+def describe_firewall_04(client, variables):
+ d = {"Region": variables.get("Region"), "FWId": variables.get("fw_id1")}
+ try:
+ resp = client.unet().describe_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeFirewall",
+)
+def describe_firewall_05(client, variables):
+ d = {"Region": variables.get("Region")}
+ try:
+ resp = client.unet().describe_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="GrantFirewall",
+)
+def grant_firewall_06(client, variables):
+ d = {
+ "ResourceType": "UHost",
+ "ResourceId": variables.get("uhost_id1"),
+ "Region": variables.get("Region"),
+ "FWId": variables.get("fw_id1"),
+ }
+ try:
+ resp = client.unet().grant_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "ResourceSet.0.Name", variables.get("uhost_name_1")),
+ ("str_eq", "ResourceSet.0.ResourceType", "uhost"),
+ ("str_eq", "ResourceSet.0.ResourceID", variables.get("uhost_id1")),
+ ("str_eq", "TotalCount", 1),
+ ("str_eq", "ResourceSet.0.Tag", variables.get("tag")),
+ ],
+ action="DescribeFirewallResource",
+)
+def describe_firewall_resource_07(client, variables):
+ d = {"Region": variables.get("Region"), "FWId": variables.get("fw_id1")}
+ try:
+ resp = client.unet().describe_firewall_resource(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UpdateFirewall",
+)
+def update_firewall_08(client, variables):
+ d = {
+ "Rule": [variables.get("fw_rule_2")],
+ "Region": variables.get("Region"),
+ "FWId": variables.get("fw_id1"),
+ }
+ try:
+ resp = client.unet().update_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UpdateFirewallAttribute",
+)
+def update_firewall_attribute_09(client, variables):
+ d = {
+ "Tag": variables.get("tag_2"),
+ "Remark": variables.get("remark_2"),
+ "Region": variables.get("Region"),
+ "Name": funcs.concat(variables.get("fw_name_2"), variables.get("Zone")),
+ "FWId": variables.get("fw_id1"),
+ }
+ try:
+ resp = client.unet().update_firewall_attribute(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.FWId", variables.get("fw_id1")),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("fw_name_2"), variables.get("Zone")),
+ ),
+ ("str_eq", "DataSet.0.Tag", variables.get("tag_2")),
+ ("str_eq", "DataSet.0.Remark", variables.get("remark_2")),
+ ("str_eq", "DataSet.0.ResourceCount", 1),
+ ("str_eq", "DataSet.0.Type", "user defined"),
+ (
+ "str_eq",
+ "DataSet.0.Rule.0.ProtocolType",
+ variables.get("fw_rule_2_protocol"),
+ ),
+ ("str_eq", "DataSet.0.Rule.0.DstPort", variables.get("fw_rule_2_port")),
+ ("str_eq", "DataSet.0.Rule.0.SrcIP", variables.get("fw_rule_2_srcip")),
+ (
+ "str_eq",
+ "DataSet.0.Rule.0.RuleAction",
+ variables.get("fw_rule_2_action"),
+ ),
+ (
+ "str_eq",
+ "DataSet.0.Rule.0.Priority",
+ variables.get("fw_rule_2_priority"),
+ ),
+ ],
+ action="DescribeFirewall",
+)
+def describe_firewall_10(client, variables):
+ d = {"Region": variables.get("Region"), "FWId": variables.get("fw_id1")}
+ try:
+ resp = client.unet().describe_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ action="DescribeFirewall",
+)
+def describe_firewall_11(client, variables):
+ d = {"Region": variables.get("Region"), "Offset": 0, "Limit": 20}
+ try:
+ resp = client.unet().describe_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["fw_dataset"] = utest.value_at_path(resp, "DataSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="GrantFirewall",
+)
+def grant_firewall_12(client, variables):
+ d = {
+ "ResourceType": "UHost",
+ "ResourceId": variables.get("uhost_id1"),
+ "Region": variables.get("Region"),
+ "FWId": funcs.search_value(
+ variables.get("fw_dataset"),
+ "Type",
+ variables.get("recommend_web"),
+ "FWId",
+ ),
+ }
+ try:
+ resp = client.unet().grant_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=60,
+ startup_delay=30,
+ fast_fail=False,
+ action="PoweroffUHostInstance",
+)
+def poweroff_uhost_instance_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("uhost_id1"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().poweroff_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=10,
+ startup_delay=90,
+ fast_fail=False,
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("uhost_id1"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.ResourceCount", 0),
+ ],
+ action="DescribeFirewall",
+)
+def describe_firewall_15(client, variables):
+ d = {"Region": variables.get("Region"), "FWId": variables.get("fw_id1")}
+ try:
+ resp = client.unet().describe_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=1,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteFirewall",
+)
+def delete_firewall_16(client, variables):
+ d = {"Region": variables.get("Region"), "FWId": variables.get("fw_id1")}
+ try:
+ resp = client.unet().delete_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("object_not_contains", "DataSet", variables.get("fw_id1")),
+ ],
+ action="DescribeFirewall",
+)
+def describe_firewall_17(client, variables):
+ d = {"Region": variables.get("Region"), "Offset": 0, "Limit": 10}
+ try:
+ resp = client.unet().describe_firewall(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_3278.py b/tests/test_services/test_set_3278.py
new file mode 100644
index 0000000..05ddaa7
--- /dev/null
+++ b/tests/test_services/test_set_3278.py
@@ -0,0 +1,331 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(3278)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_3278(client, variables):
+ scenario.initial(variables)
+ scenario.variables[
+ "Image_Id_cloud"
+ ] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.variables["saopaulo_image"] = "uimage-1bkjka"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["Image_Id_cloud"] = utest.value_at_path(
+ resp, "ImageSet.0.ImageId"
+ )
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "TimemachineFeature": "No",
+ "Tag": "Default",
+ "Region": variables.get("Region"),
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "Name": "ulb-host",
+ "Memory": 1024,
+ "LoginMode": "Password",
+ "ImageId": variables.get("Image_Id_cloud"),
+ "HotplugFeature": False,
+ "DiskSpace": 0,
+ "CPU": 1,
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["UHostId_01"] = utest.value_at_path(resp, "UHostIds.0")
+ variables["IP_01"] = utest.value_at_path(resp, "IPs.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=180,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateULB",
+)
+def create_ulb_02(client, variables):
+ d = {
+ "ULBName": "测试",
+ "Tag": "Default",
+ "Region": variables.get("Region"),
+ "InnerMode": "No",
+ }
+ try:
+ resp = client.ulb().create_ulb(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ULBId"] = utest.value_at_path(resp, "ULBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 4107)],
+ action="CreateVServer",
+)
+def create_vserver_03(client, variables):
+ d = {
+ "VServerName": "vserver-test",
+ "ULBId": variables.get("ULBId"),
+ "Region": variables.get("Region"),
+ "Protocol": "HTTP",
+ "PersistenceType": "UserDefined",
+ "PersistenceInfo": "huangchao",
+ "Method": "Roundrobin",
+ "ListenType": "RequestProxy",
+ "FrontendPort": 80,
+ "ClientTimeout": 60,
+ }
+ try:
+ resp = client.ulb().create_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("len_eq", "DataSet", 1),
+ ],
+ action="DescribeVServer",
+)
+def describe_vserver_04(client, variables):
+ d = {"ULBId": variables.get("ULBId"), "Region": variables.get("Region")}
+ try:
+ resp = client.ulb().describe_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VServerId"] = utest.value_at_path(resp, "DataSet.0.VServerId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 63016)],
+ action="AllocateBackend",
+)
+def allocate_backend_05(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "ULBId": variables.get("ULBId"),
+ "ResourceType": "UHost",
+ "ResourceId": variables.get("UHostId_01"),
+ "Region": variables.get("Region"),
+ "Port": 80,
+ "Enabled": 1,
+ }
+ try:
+ resp = client.ulb().allocate_backend(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("len_eq", "DataSet.0.BackendSet", 1),
+ ],
+ action="DescribeVServer",
+)
+def describe_vserver_06(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "ULBId": variables.get("ULBId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.ulb().describe_vserver(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["BackendId"] = utest.value_at_path(
+ resp, "DataSet.0.BackendSet.0.BackendId"
+ )
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreatePolicy",
+)
+def create_policy_07(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "ULBId": variables.get("ULBId"),
+ "Type": "Domain",
+ "Region": variables.get("Region"),
+ "Match": "www.test.com",
+ "BackendId": [variables.get("BackendId")],
+ }
+ try:
+ resp = client.ulb().create_policy(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["PolicyId"] = utest.value_at_path(resp, "PolicyId")
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UpdatePolicy",
+)
+def update_policy_08(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "ULBId": variables.get("ULBId"),
+ "Type": "Domain",
+ "Region": variables.get("Region"),
+ "PolicyId": variables.get("PolicyId"),
+ "Match": "www.testgai.com",
+ "BackendId": [variables.get("BackendId")],
+ }
+ try:
+ resp = client.ulb().update_policy(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeletePolicy",
+)
+def delete_policy_09(client, variables):
+ d = {
+ "VServerId": variables.get("VServerId"),
+ "Region": variables.get("Region"),
+ "PolicyId": variables.get("PolicyId"),
+ }
+ try:
+ resp = client.ulb().delete_policy(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ action="DeleteULB",
+)
+def delete_ulb_10(client, variables):
+ d = {"ULBId": variables.get("ULBId"), "Region": variables.get("Region")}
+ try:
+ resp = client.ulb().delete_ulb(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=30,
+ startup_delay=5,
+ fast_fail=False,
+ action="PoweroffUHostInstance",
+)
+def poweroff_uhost_instance_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("UHostId_01"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().poweroff_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("UHostId_01"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_330.py b/tests/test_services/test_set_330.py
new file mode 100644
index 0000000..864e2dd
--- /dev/null
+++ b/tests/test_services/test_set_330.py
@@ -0,0 +1,282 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(330)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_330(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUMemcacheGroup",
+)
+def create_umem_cache_group_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Name": "umem_charge",
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.umem().create_umem_cache_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["group_id"] = utest.value_at_path(resp, "GroupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUMem",
+)
+def describe_umem_01(client, variables):
+ d = {
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ "Protocol": "memcache",
+ "Offset": 0,
+ "Limit": 1000,
+ }
+ try:
+ resp = client.invoke("DescribeUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["CreateTime"] = utest.value_at_path(resp, "DataSet.0.CreateTime")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUMemcachePrice",
+)
+def describe_umem_cache_price_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Size": 1,
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.umem().describe_umem_cache_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["GetPrice"] = utest.value_at_path(resp, "DataSet.0.Price")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("float_eq", "OrderInfos.0.Amount", variables.get("GetPrice") / 100),
+ ],
+ action="DescribeOrderDetailInfo",
+)
+def describe_order_detail_info_03(client, variables):
+ d = {
+ "ResourceIds": [variables.get("group_id")],
+ "QueryAll": True,
+ "OrderTypes": ["OT_BUY"],
+ "OrderStates": ["OS_FINISHED"],
+ "EndTime": funcs.get_timestamp(10),
+ "ChargeTypes": ["Month"],
+ "BeginTime": funcs.get_timestamp(10) - 1200,
+ }
+ try:
+ resp = client.invoke("DescribeOrderDetailInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUMemcacheUpgradePrice",
+)
+def describe_umem_cache_upgrade_price_04(client, variables):
+ d = {
+ "Size": 2,
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.umem().describe_umem_cache_upgrade_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["UpgradePrice"] = utest.value_at_path(resp, "Price")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeUMemcacheGroup",
+)
+def resize_umem_cache_group_05(client, variables):
+ d = {
+ "Size": 2,
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("group_id"),
+ }
+ try:
+ resp = client.invoke("ResizeUMemcacheGroup", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("float_eq", "OrderInfos.0.Amount", variables.get("GetPrice") / 100),
+ ],
+ action="DescribeOrderDetailInfo",
+)
+def describe_order_detail_info_06(client, variables):
+ d = {
+ "ResourceIds": [variables.get("group_id")],
+ "QueryAll": True,
+ "OrderTypes": ["OT_BUY"],
+ "OrderStates": ["OS_FINISHED"],
+ "EndTime": funcs.get_timestamp(10),
+ "ChargeTypes": ["Month"],
+ "BeginTime": funcs.get_timestamp(10) - 1200,
+ }
+ try:
+ resp = client.invoke("DescribeOrderDetailInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="GetResourceRenewPrice",
+)
+def get_resource_renew_price_07(client, variables):
+ d = {
+ "ResourceIds": [variables.get("group_id")],
+ "Quantity": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.invoke("GetResourceRenewPrice", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ReNewPrice"] = utest.value_at_path(resp, "RenewPriceSet.0.Price")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateRenew",
+)
+def create_renew_08(client, variables):
+ d = {
+ "ResourceId": variables.get("group_id"),
+ "Quantity": 1,
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.invoke("CreateRenew", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "OrderInfos.0.Amount", variables.get("ReNewPrice")),
+ ],
+ action="DescribeOrderDetailInfo",
+)
+def describe_order_detail_info_09(client, variables):
+ d = {
+ "ResourceIds": [variables.get("group_id")],
+ "QueryAll": True,
+ "OrderTypes": ["OT_RENEW"],
+ "OrderStates": ["OS_FINISHED"],
+ "EndTime": funcs.get_timestamp(10),
+ "ChargeTypes": ["Month"],
+ "BeginTime": funcs.get_timestamp(10) - 1200,
+ }
+ try:
+ resp = client.invoke("DescribeOrderDetailInfo", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ action="DeleteUMem",
+)
+def delete_umem_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "ResourceType": "single",
+ "ResourceId": variables.get("group_id"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DeleteUMem", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_333.py b/tests/test_services/test_set_333.py
new file mode 100644
index 0000000..80eba24
--- /dev/null
+++ b/tests/test_services/test_set_333.py
@@ -0,0 +1,618 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(333)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_333(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Password"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["ImageName"] = "ImageTest"
+ scenario.variables["TargetImageName"] = "ImageCopyTest"
+ scenario.variables["TargetRegion"] = "cn-sh2"
+ scenario.variables["TargetZone"] = "cn-sh2-01"
+ scenario.variables["myImage"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["myImage"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "Memory": 1024,
+ "LoginMode": "Password",
+ "ImageId": variables.get("myImage"),
+ "DiskSpace": 0,
+ "CPU": 1,
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["hostId"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=60,
+ startup_delay=400,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUHostInstanceResponse"),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUHostInstanceResponse"),
+ ],
+ action="StopUHostInstance",
+)
+def stop_uhost_instance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().stop_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=30,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUHostInstanceResponse"),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateCustomImage",
+)
+def create_custom_image_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ "ImageName": variables.get("ImageName"),
+ }
+ try:
+ resp = client.uhost().create_custom_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["newImageId"] = utest.value_at_path(resp, "ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=30,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ("str_eq", "ImageSet.0.State", "Available"),
+ ("str_eq", "ImageSet.0.ImageId", variables.get("newImageId")),
+ ],
+ action="DescribeImage",
+)
+def describe_image_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "ImageId": variables.get("newImageId"),
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "Memory": 1024,
+ "LoginMode": "Password",
+ "ImageId": variables.get("newImageId"),
+ "DiskSpace": 0,
+ "CPU": 1,
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["hostId2"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=30,
+ startup_delay=60,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUHostInstanceResponse"),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_08(client, variables):
+ d = {
+ "UHostIds": [variables.get("hostId2")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "GetProjectListResponse"),
+ ],
+ action="GetProjectList",
+)
+def get_project_list_09(client, variables):
+ d = {}
+ try:
+ resp = client.uaccount().get_project_list(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["TargetProjectID"] = utest.value_at_path(
+ resp, "ProjectSet.0.ProjectId"
+ )
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CopyCustomImage",
+)
+def copy_custom_image_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "TargetRegion": variables.get("TargetRegion"),
+ "TargetProjectId": variables.get("TargetProjectID"),
+ "TargetImageName": variables.get("TargetImageName"),
+ "SourceImageId": variables.get("newImageId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().copy_custom_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["cpImageId"] = utest.value_at_path(resp, "TargetImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=30,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("float_eq", "ProgressInfo", 100),
+ ],
+ action="GetImageCopyProgress",
+)
+def get_image_copy_progress_11(client, variables):
+ d = {
+ "Region": variables.get("TargetRegion"),
+ "ProjectId": variables.get("TargetProjectID"),
+ "ImageId": variables.get("cpImageId"),
+ }
+ try:
+ resp = client.invoke("GetImageCopyProgress", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=30,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ("str_eq", "ImageSet.0.State", "Available"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_12(client, variables):
+ d = {
+ "Region": variables.get("TargetRegion"),
+ "ProjectId": variables.get("TargetProjectID"),
+ "ImageId": variables.get("cpImageId"),
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_13(client, variables):
+ d = {
+ "Zone": variables.get("TargetZone"),
+ "Region": variables.get("TargetRegion"),
+ "ProjectId": variables.get("TargetProjectID"),
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "Memory": 1024,
+ "LoginMode": "Password",
+ "ImageId": variables.get("cpImageId"),
+ "DiskSpace": 0,
+ "CPU": 1,
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["hostId_new"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=60,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUHostInstanceResponse"),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_14(client, variables):
+ d = {
+ "Zone": variables.get("TargetZone"),
+ "UHostIds": [variables.get("hostId_new")],
+ "Region": variables.get("TargetRegion"),
+ "ProjectId": variables.get("TargetProjectID"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="TerminateCustomImage",
+)
+def terminate_custom_image_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "ImageId": variables.get("newImageId"),
+ }
+ try:
+ resp = client.uhost().terminate_custom_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUHostInstance",
+)
+def stop_uhost_instance_16(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().stop_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUHostInstance",
+)
+def stop_uhost_instance_17(client, variables):
+ d = {"UHostId": variables.get("hostId2"), "Region": variables.get("Region")}
+ try:
+ resp = client.uhost().stop_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUHostInstanceResponse"),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ("str_eq", "UHostSet.1.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_18(client, variables):
+ d = {
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_19(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_20(client, variables):
+ d = {"UHostId": variables.get("hostId2"), "Region": variables.get("Region")}
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=100,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="TerminateCustomImage",
+)
+def terminate_custom_image_21(client, variables):
+ d = {
+ "Zone": variables.get("TargetZone"),
+ "Region": variables.get("TargetRegion"),
+ "ProjectId": variables.get("TargetProjectID"),
+ "ImageId": variables.get("cpImageId"),
+ }
+ try:
+ resp = client.uhost().terminate_custom_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUHostInstance",
+)
+def stop_uhost_instance_22(client, variables):
+ d = {
+ "Zone": variables.get("TargetZone"),
+ "UHostId": variables.get("hostId_new"),
+ "Region": variables.get("TargetRegion"),
+ "ProjectId": variables.get("TargetProjectID"),
+ }
+ try:
+ resp = client.uhost().stop_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUHostInstanceResponse"),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_23(client, variables):
+ d = {
+ "Zone": variables.get("TargetZone"),
+ "UHostIds": [variables.get("hostId_new")],
+ "Region": variables.get("TargetRegion"),
+ "ProjectId": variables.get("TargetProjectID"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_24(client, variables):
+ d = {
+ "Zone": variables.get("TargetZone"),
+ "UHostId": variables.get("hostId_new"),
+ "Region": variables.get("TargetRegion"),
+ "ProjectId": variables.get("TargetProjectID"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_448.py b/tests/test_services/test_set_448.py
new file mode 100644
index 0000000..19c558a
--- /dev/null
+++ b/tests/test_services/test_set_448.py
@@ -0,0 +1,378 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(448)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_448(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Password"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["CreateBootDisk"] = 20
+ scenario.variables["ChargeType"] = "Month"
+ scenario.variables["CreateCPU"] = 1
+ scenario.variables["CreateMem"] = 1024
+ scenario.variables["CreateDiskspace"] = 20
+ scenario.variables["UpgradeDiskSpace"] = 30
+ scenario.variables["NewPassword"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["Name"] = "uhost-basic-api-N2-Normal-LocalDisk-1"
+ scenario.variables["ImageID"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.variables["UpgradeBootDisk"] = 40
+ scenario.variables["UpgradeCPU"] = 2
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ImageID"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "TimemachineFeature": "No",
+ "Tag": "Default",
+ "StorageType": "LocalDisk",
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "NetCapability": "Normal",
+ "Name": variables.get("Name"),
+ "Memory": variables.get("CreateMem"),
+ "LoginMode": "Password",
+ "ImageId": variables.get("ImageID"),
+ "HotplugFeature": False,
+ "HostType": "N2",
+ "GPU": False,
+ "DiskSpace": variables.get("CreateDiskspace"),
+ "ChargeType": variables.get("ChargeType"),
+ "CPU": variables.get("CreateCPU"),
+ "BootDiskSpace": variables.get("CreateBootDisk"),
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["hostId"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=200,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.CPU", variables.get("CreateCPU")),
+ ("str_eq", "UHostSet.0.Memory", variables.get("CreateMem")),
+ ("str_eq", "UHostSet.0.UHostId", variables.get("hostId")),
+ ("str_eq", "UHostSet.0.Name", variables.get("Name")),
+ (
+ "str_eq",
+ "UHostSet.0.TotalDiskSpace",
+ variables.get("CreateDiskspace"),
+ ),
+ ("str_eq", "UHostSet.0.HostType", "N2"),
+ ("str_eq", "UHostSet.0.UHostType", "Normal"),
+ ("str_eq", "UHostSet.0.StorageType", "LocalDisk"),
+ ("str_eq", "UHostSet.0.BasicImageId", variables.get("ImageID")),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=60,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="RebootUHostInstance",
+)
+def reboot_uhost_instance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().reboot_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.CPU", variables.get("CreateCPU")),
+ ("str_eq", "UHostSet.0.Memory", variables.get("CreateMem")),
+ ("str_eq", "UHostSet.0.UHostId", variables.get("hostId")),
+ ("str_eq", "UHostSet.0.Name", variables.get("Name")),
+ (
+ "str_eq",
+ "UHostSet.0.TotalDiskSpace",
+ variables.get("CreateDiskspace"),
+ ),
+ ("str_eq", "UHostSet.0.HostType", "N2"),
+ ("str_eq", "UHostSet.0.UHostType", "Normal"),
+ ("str_eq", "UHostSet.0.StorageType", "LocalDisk"),
+ ("str_eq", "UHostSet.0.BasicImageId", variables.get("ImageID")),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUHostInstance",
+)
+def stop_uhost_instance_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().stop_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "GetRestResourceResponse"),
+ ("str_eq", "UpgradeStatus", True),
+ ],
+ action="GetRestResource",
+)
+def get_rest_resource_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ "CPU": variables.get("UpgradeCPU"),
+ }
+ try:
+ resp = client.invoke("GetRestResource", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=45,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeUHostInstance",
+)
+def resize_uhost_instance_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ "CPU": variables.get("UpgradeCPU"),
+ }
+ try:
+ resp = client.uhost().resize_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=30,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.Memory", variables.get("CreateMem")),
+ ("str_eq", "UHostSet.0.UHostId", variables.get("hostId")),
+ ("str_eq", "UHostSet.0.Name", variables.get("Name")),
+ ("str_eq", "UHostSet.0.CPU", variables.get("UpgradeCPU")),
+ ("str_eq", "UHostSet.0.HostType", "N2"),
+ ("str_eq", "UHostSet.0.UHostType", "Normal"),
+ ("str_eq", "UHostSet.0.StorageType", "LocalDisk"),
+ ("str_eq", "UHostSet.0.BasicImageId", variables.get("ImageID")),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="PoweroffUHostInstance",
+)
+def poweroff_uhost_instance_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().poweroff_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_449.py b/tests/test_services/test_set_449.py
new file mode 100644
index 0000000..35da0c9
--- /dev/null
+++ b/tests/test_services/test_set_449.py
@@ -0,0 +1,313 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(449)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_449(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Password"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["CreateBootDisk"] = 20
+ scenario.variables["ChargeType"] = "Month"
+ scenario.variables["CreateCPU"] = 1
+ scenario.variables["CreateMem"] = 1024
+ scenario.variables["CreateDiskspace"] = 0
+ scenario.variables["NewPassword"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["Name"] = "uhost-basic-api"
+ scenario.variables["ImageID"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ImageID"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=10,
+ startup_delay=20,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "TimemachineFeature": "No",
+ "Tag": "Default",
+ "StorageType": "LocalDisk",
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "NetCapability": "Normal",
+ "Name": variables.get("Name"),
+ "Memory": variables.get("CreateMem"),
+ "LoginMode": "Password",
+ "ImageId": variables.get("ImageID"),
+ "HotplugFeature": False,
+ "HostType": "N2",
+ "GPU": False,
+ "DiskSpace": variables.get("CreateDiskspace"),
+ "ChargeType": variables.get("ChargeType"),
+ "CPU": variables.get("CreateCPU"),
+ "BootDiskSpace": variables.get("CreateBootDisk"),
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["hostId"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=200,
+ retry_interval=30,
+ startup_delay=60,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.BasicImageId", variables.get("ImageID")),
+ ("str_eq", "UHostSet.0.CPU", variables.get("CreateCPU")),
+ ("str_eq", "UHostSet.0.Memory", variables.get("CreateMem")),
+ ("str_eq", "UHostSet.0.UHostId", variables.get("hostId")),
+ ("str_eq", "UHostSet.0.Name", variables.get("Name")),
+ (
+ "str_eq",
+ "UHostSet.0.TotalDiskSpace",
+ variables.get("CreateDiskspace"),
+ ),
+ ("str_eq", "UHostSet.0.HostType", "N2"),
+ ("str_eq", "UHostSet.0.UHostType", "Normal"),
+ ("str_eq", "UHostSet.0.StorageType", "LocalDisk"),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUHostInstanceResponse"),
+ ],
+ action="StopUHostInstance",
+)
+def stop_uhost_instance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().stop_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.BasicImageId", variables.get("ImageID")),
+ ("str_eq", "UHostSet.0.CPU", variables.get("CreateCPU")),
+ ("str_eq", "UHostSet.0.Memory", variables.get("CreateMem")),
+ ("str_eq", "UHostSet.0.UHostId", variables.get("hostId")),
+ ("str_eq", "UHostSet.0.Name", variables.get("Name")),
+ (
+ "str_eq",
+ "UHostSet.0.TotalDiskSpace",
+ variables.get("CreateDiskspace"),
+ ),
+ ("str_eq", "UHostSet.0.HostType", "N2"),
+ ("str_eq", "UHostSet.0.UHostType", "Normal"),
+ ("str_eq", "UHostSet.0.StorageType", "LocalDisk"),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=60,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ReinstallUHostInstance",
+)
+def reinstall_uhost_instance_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ "Password": variables.get("NewPassword"),
+ "ImageId": variables.get("ImageID"),
+ }
+ try:
+ resp = client.uhost().reinstall_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=200,
+ retry_interval=30,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.BasicImageId", variables.get("ImageID")),
+ ("str_eq", "UHostSet.0.Memory", variables.get("CreateMem")),
+ ("str_eq", "UHostSet.0.UHostId", variables.get("hostId")),
+ (
+ "str_eq",
+ "UHostSet.0.TotalDiskSpace",
+ variables.get("CreateDiskspace"),
+ ),
+ ("str_eq", "UHostSet.0.Name", variables.get("Name")),
+ ("str_eq", "UHostSet.0.CPU", variables.get("CreateCPU")),
+ ("str_eq", "UHostSet.0.HostType", "N2"),
+ ("str_eq", "UHostSet.0.UHostType", "Normal"),
+ ("str_eq", "UHostSet.0.StorageType", "LocalDisk"),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=60,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="PoweroffUHostInstance",
+)
+def poweroff_uhost_instance_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().poweroff_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=60,
+ fast_fail=False,
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_471.py b/tests/test_services/test_set_471.py
new file mode 100644
index 0000000..ffeaced
--- /dev/null
+++ b/tests/test_services/test_set_471.py
@@ -0,0 +1,284 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(471)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_471(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Password"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["CreateBootDisk"] = 20
+ scenario.variables["ChargeType"] = "Month"
+ scenario.variables["CreateCPU"] = 1
+ scenario.variables["CreateMem"] = 1024
+ scenario.variables["CreateDiskspace"] = 0
+ scenario.variables["NewPassword"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["Name"] = "uhost-basic-api-ResetPassword"
+ scenario.variables["ImageID"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ImageID"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "TimemachineFeature": "No",
+ "Tag": "Default",
+ "StorageType": "LocalDisk",
+ "Region": variables.get("Region"),
+ "Quantity": 1,
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "NetCapability": "Normal",
+ "Name": variables.get("Name"),
+ "Memory": variables.get("CreateMem"),
+ "LoginMode": "Password",
+ "ImageId": variables.get("ImageID"),
+ "HotplugFeature": False,
+ "GPU": False,
+ "DiskSpace": variables.get("CreateDiskspace"),
+ "ChargeType": variables.get("ChargeType"),
+ "CPU": variables.get("CreateCPU"),
+ "BootDiskSpace": variables.get("CreateBootDisk"),
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["hostId"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=120,
+ retry_interval=30,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.CPU", variables.get("CreateCPU")),
+ ("str_eq", "UHostSet.0.Memory", variables.get("CreateMem")),
+ ("str_eq", "UHostSet.0.UHostId", variables.get("hostId")),
+ ("str_eq", "UHostSet.0.Name", variables.get("Name")),
+ (
+ "str_eq",
+ "UHostSet.0.TotalDiskSpace",
+ variables.get("CreateDiskspace"),
+ ),
+ ("str_eq", "UHostSet.0.StorageType", "LocalDisk"),
+ ("str_eq", "UHostSet.0.BasicImageId", variables.get("ImageID")),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=5,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUHostInstanceResponse"),
+ ],
+ action="StopUHostInstance",
+)
+def stop_uhost_instance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().stop_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=60,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=30,
+ startup_delay=20,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResetUHostInstancePassword",
+)
+def reset_uhost_instance_password_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ "Password": variables.get("NewPassword"),
+ }
+ try:
+ resp = client.uhost().reset_uhost_instance_password(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=60,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="PoweroffUHostInstance",
+)
+def poweroff_uhost_instance_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().poweroff_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=30,
+ fast_fail=True,
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_488.py b/tests/test_services/test_set_488.py
new file mode 100644
index 0000000..66f8474
--- /dev/null
+++ b/tests/test_services/test_set_488.py
@@ -0,0 +1,550 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(488)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_488(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.variables["DBTypeId"] = "percona-5.6"
+ scenario.variables["InstanceMode"] = "HA"
+ scenario.variables["InstanceType"] = "Normal"
+ scenario.variables["Port"] = 3306
+ scenario.variables["MemoryLimit"] = 1000
+ scenario.variables["DiskSpace"] = 20
+ scenario.variables["DBName"] = "auto_habz_"
+ scenario.variables["UseSSD"] = False
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBType",
+)
+def describe_udb_type_01(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.udb().describe_udb_type(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBParamGroup",
+)
+def describe_udb_param_group_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udb().describe_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DataSet_paramGroup"] = utest.value_at_path(resp, "DataSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBInstancePrice",
+)
+def describe_udb_instance_price_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "Count": 1,
+ }
+ try:
+ resp = client.udb().describe_udb_instance_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstance",
+)
+def create_udb_instance_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Port": variables.get("Port"),
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "DBTypeId",
+ variables.get("DBTypeId"),
+ "GroupId",
+ ),
+ "Name": funcs.concat(
+ variables.get("DBName"), variables.get("DBTypeId")
+ ),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceType": variables.get("InstanceType"),
+ "InstanceMode": variables.get("InstanceMode"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "ChargeType": "Month",
+ "AdminPassword": "guanliyuanmima",
+ }
+ try:
+ resp = client.udb().create_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=50,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstancePhpMyAdminURLResponse"),
+ ("ne", "PMAPath", ""),
+ ],
+ action="DescribeUDBInstancePhpMyAdminURL",
+)
+def describe_udb_instance_php_my_admin_url_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.invoke("DescribeUDBInstancePhpMyAdminURL", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ModifyUDBInstanceName",
+)
+def modify_udb_instance_name_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Name": funcs.concat("rename_", variables.get("DBTypeId")),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().modify_udb_instance_name(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat("rename_", variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ModifyUDBInstancePassword",
+)
+def modify_udb_instance_password_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Password": "Guanliyuanmima",
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().modify_udb_instance_password(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="RestartUDBInstance",
+)
+def restart_udb_instance_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().restart_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StartUDBInstance",
+)
+def start_udb_instance_16(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().start_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_17(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_18(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_19(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=10,
+ fast_fail=False,
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_20(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_489.py b/tests/test_services/test_set_489.py
new file mode 100644
index 0000000..f30580c
--- /dev/null
+++ b/tests/test_services/test_set_489.py
@@ -0,0 +1,880 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(489)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_489(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.variables["DBTypeId"] = "mysql-5.6"
+ scenario.variables["InstanceMode"] = "HA"
+ scenario.variables["InstanceType"] = "SATA_SSD"
+ scenario.variables["Port"] = 3306
+ scenario.variables["MemoryLimit"] = 1000
+ scenario.variables["DiskSpace"] = 20
+ scenario.variables["DBName"] = "auto_hassd_"
+ scenario.variables["BackupName"] = "handbf_test_02"
+ scenario.variables["UseSSD"] = True
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBType",
+)
+def describe_udb_type_00(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.udb().describe_udb_type(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBParamGroup",
+)
+def describe_udb_param_group_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udb().describe_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DataSet_paramGroup"] = utest.value_at_path(resp, "DataSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBInstancePrice",
+)
+def describe_udb_instance_price_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "Count": 1,
+ }
+ try:
+ resp = client.udb().describe_udb_instance_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstance",
+)
+def create_udb_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Port": variables.get("Port"),
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "DBTypeId",
+ variables.get("DBTypeId"),
+ "GroupId",
+ ),
+ "Name": funcs.concat(
+ variables.get("DBName"), variables.get("DBTypeId")
+ ),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceType": variables.get("InstanceType"),
+ "InstanceMode": variables.get("InstanceMode"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "ChargeType": "Month",
+ "AdminPassword": "guanliyuanmima",
+ }
+ try:
+ resp = client.udb().create_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=50,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UpdateUDBInstanceBackupStrategy",
+)
+def update_udb_instance_backup_strategy_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ "BackupTime": 13,
+ "BackupDate": 1111110,
+ }
+ try:
+ resp = client.udb().update_udb_instance_backup_strategy(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="EditUDBBackupBlacklist",
+)
+def edit_udb_backup_blacklist_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ "Blacklist": "test.%",
+ }
+ try:
+ resp = client.udb().edit_udb_backup_blacklist(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Blacklist", "test.%"),
+ ],
+ action="DescribeUDBBackupBlacklist",
+)
+def describe_udb_backup_blacklist_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_backup_blacklist(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=2,
+ retry_interval=1,
+ startup_delay=15,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="BackupUDBInstance",
+)
+def backup_udb_instance_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseBlacklist": True,
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ "BackupName": variables.get("BackupName"),
+ }
+ try:
+ resp = client.udb().backup_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=50,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.State", "Success"),
+ ],
+ action="DescribeUDBBackup",
+)
+def describe_udb_backup_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_backup(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["BackupId"] = utest.value_at_path(resp, "DataSet.0.BackupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Success"),
+ ("ne", "BackupSize", 0),
+ ("ne", "BackupEndTime", 0),
+ ],
+ action="DescribeUDBInstanceBackupState",
+)
+def describe_udb_instance_backup_state_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "BackupId": variables.get("BackupId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_backup_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("contains", "BackupPath", "http://"),
+ ],
+ action="DescribeUDBInstanceBackupURL",
+)
+def describe_udb_instance_backup_url_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ "BackupId": variables.get("BackupId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_backup_url(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstance",
+)
+def create_udb_instance_16(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Port": 3306,
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "DBTypeId",
+ "mysql-5.6",
+ "GroupId",
+ ),
+ "Name": "frombf-hassd-56",
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceType": variables.get("InstanceType"),
+ "InstanceMode": variables.get("InstanceMode"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": "mysql-5.6",
+ "ChargeType": "Month",
+ "BackupId": variables.get("BackupId"),
+ "AdminPassword": "guanliyuanmima",
+ }
+ try:
+ resp = client.udb().create_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DBId_frombf_56"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_17(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId_frombf_56"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=5,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceResponse"),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_18(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId_frombf_56"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=2,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUDBInstanceResponse"),
+ ],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_19(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId_frombf_56"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceResponse"),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_20(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId_frombf_56"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("ne", "EarliestTime", 0),
+ ],
+ action="FetchUDBInstanceEarliestRecoverTime",
+)
+def fetch_udb_instance_earliest_recover_time_21(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().fetch_udb_instance_earliest_recover_time(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["EarliestTime"] = utest.value_at_path(resp, "EarliestTime")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_22(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstanceByRecovery",
+)
+def create_udb_instance_by_recovery_23(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SrcDBId": variables.get("DBId"),
+ "Region": variables.get("Region"),
+ "RecoveryTime": variables.get("EarliestTime"),
+ "Quantity": 0,
+ "Name": "56-hd-frombf",
+ "ChargeType": "Month",
+ }
+ try:
+ resp = client.udb().create_udb_instance_by_recovery(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["HD_DBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_24(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("HD_DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=5,
+ startup_delay=3,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceResponse"),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_25(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("HD_DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUDBInstanceResponse"),
+ ],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_26(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("HD_DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceResponse"),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_27(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("HD_DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDBBackup",
+)
+def delete_udb_backup_28(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "BackupId": variables.get("BackupId"),
+ }
+ try:
+ resp = client.udb().delete_udb_backup(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUDBInstanceResponse"),
+ ],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_29(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceResponse"),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_30(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_31(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId_frombf_56"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_32(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("HD_DBId"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_33(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_490.py b/tests/test_services/test_set_490.py
new file mode 100644
index 0000000..cbed224
--- /dev/null
+++ b/tests/test_services/test_set_490.py
@@ -0,0 +1,713 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(490)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_490(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.variables["DBTypeId"] = "mysql-5.7"
+ scenario.variables["InstanceMode"] = "HA"
+ scenario.variables["InstanceType"] = "SATA_SSD"
+ scenario.variables["Port"] = 3306
+ scenario.variables["MemoryLimit"] = 1000
+ scenario.variables["DiskSpace"] = 20
+ scenario.variables["DBName"] = "auto_hassd_"
+ scenario.variables["UseSSD"] = True
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBType",
+)
+def describe_udb_type_00(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.udb().describe_udb_type(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBParamGroup",
+)
+def describe_udb_param_group_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udb().describe_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DataSet_paramGroup"] = utest.value_at_path(resp, "DataSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBInstancePrice",
+)
+def describe_udb_instance_price_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "Count": 1,
+ }
+ try:
+ resp = client.udb().describe_udb_instance_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceMode": variables.get("InstanceMode"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstance",
+)
+def create_udb_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Port": variables.get("Port"),
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "DBTypeId",
+ variables.get("DBTypeId"),
+ "GroupId",
+ ),
+ "Name": funcs.concat(
+ variables.get("DBName"), variables.get("DBTypeId")
+ ),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceType": variables.get("InstanceType"),
+ "InstanceMode": variables.get("InstanceMode"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "ChargeType": "Month",
+ "AdminPassword": "guanliyuanmima",
+ }
+ try:
+ resp = client.udb().create_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=50,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceConnection",
+)
+def check_udb_instance_connection_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceConnection", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CheckUDBEngineResponse"),
+ ("str_eq", "Used", False),
+ ],
+ action="CheckUDBEngine",
+)
+def check_udb_engine_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "EngineType": "MyISAM",
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.invoke("CheckUDBEngine", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBSlave",
+)
+def create_udb_slave_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "SrcId": variables.get("DBId"),
+ "Region": variables.get("Region"),
+ "Port": 3307,
+ "Name": "auto_slave-create_3307",
+ "IsLock": True,
+ }
+ try:
+ resp = client.udb().create_udb_slave(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["slave_dbid"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=90,
+ retry_interval=2,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "UpdateUDBInstanceSlaveBackupSwitchResponse"),
+ ],
+ action="UpdateUDBInstanceSlaveBackupSwitch",
+)
+def update_udb_instance_slave_backup_switch_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SlaveDBId": variables.get("slave_dbid"),
+ "Region": variables.get("Region"),
+ "MasterDBId": variables.get("DBId"),
+ "BackupSwitch": 1,
+ }
+ try:
+ resp = client.udb().update_udb_instance_slave_backup_switch(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBSlaveOrSecondaryInstance",
+)
+def describe_udb_slave_or_secondary_instance_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ "ClassType": "mysql",
+ }
+ try:
+ resp = client.invoke("DescribeUDBSlaveOrSecondaryInstance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="RestartUDBInstance",
+)
+def restart_udb_instance_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().restart_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=35,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_16(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Shutoff"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_17(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StartUDBInstance",
+)
+def start_udb_instance_18(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().start_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_19(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="PromoteUDBSlave",
+)
+def promote_udb_slave_20(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "IsForce": True,
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().promote_udb_slave(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUDBInstanceResponse"),
+ ],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_21(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=20,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_22(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("slave_dbid"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUDBInstanceResponse"),
+ ],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_23(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=45,
+ retry_interval=2,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_24(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ListMonitorItemsResponse"),
+ ],
+ action="ListMonitorItems",
+)
+def list_monitor_items_25(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.invoke("ListMonitorItems", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=10,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_26(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("slave_dbid"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=20,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_27(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_499.py b/tests/test_services/test_set_499.py
new file mode 100644
index 0000000..933876f
--- /dev/null
+++ b/tests/test_services/test_set_499.py
@@ -0,0 +1,554 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(499)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_499(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.variables["DBTypeId"] = "percona-5.5"
+ scenario.variables["InstanceMode"] = "HA"
+ scenario.variables["InstanceType"] = "SATA_SSD"
+ scenario.variables["Port"] = 3306
+ scenario.variables["MemoryLimit"] = 1000
+ scenario.variables["DiskSpace"] = 20
+ scenario.variables["DBName"] = "auto_hassd_"
+ scenario.variables["UseSSD"] = True
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBType",
+)
+def describe_udb_type_00(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.udb().describe_udb_type(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBParamGroup",
+)
+def describe_udb_param_group_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udb().describe_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DataSet_paramGroup"] = utest.value_at_path(resp, "DataSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBInstancePrice",
+)
+def describe_udb_instance_price_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "Count": 1,
+ }
+ try:
+ resp = client.udb().describe_udb_instance_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstance",
+)
+def create_udb_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Port": variables.get("Port"),
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "DBTypeId",
+ variables.get("DBTypeId"),
+ "GroupId",
+ ),
+ "Name": funcs.concat(
+ variables.get("DBName"), variables.get("DBTypeId")
+ ),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceType": variables.get("InstanceType"),
+ "InstanceMode": variables.get("InstanceMode"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "ChargeType": "Month",
+ "AdminPassword": "guanliyuanmima",
+ }
+ try:
+ resp = client.udb().create_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=50,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBParamGroup",
+)
+def create_udb_param_group_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SrcGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "DBTypeId",
+ variables.get("DBTypeId"),
+ "GroupId",
+ ),
+ "Region": variables.get("Region"),
+ "GroupName": "auto_config_create",
+ "Description": "self_create",
+ "DBTypeId": variables.get("DBTypeId"),
+ }
+ try:
+ resp = client.udb().create_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["create_config_id"] = utest.value_at_path(resp, "GroupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UpdateUDBParamGroup",
+)
+def update_udb_param_group_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Value": 2,
+ "Region": variables.get("Region"),
+ "Key": "auto_increment_increment",
+ "GroupId": variables.get("create_config_id"),
+ }
+ try:
+ resp = client.udb().update_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="UploadUDBParamGroup",
+)
+def upload_udb_param_group_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupName": "auto_config_upload",
+ "Description": "self_upload",
+ "DBTypeId": variables.get("DBTypeId"),
+ "Content": "W215c3FsZF0KYXV0b19pbmNyZW1lbnRfaW5jcmVtZW50ID0gMgpiYWNrX2xvZyA9IDIwMDAKYmlubG9nLWZvcm1hdCA9IE1JWEVECmNoYXJhY3Rlcl9zZXRfc2VydmVyID0gdXRmOApldmVudF9zY2hlZHVsZXIgPSBPTgpleHBpcmVfbG9nc19kYXlzID0gNwppbm5vZGJfYnVmZmVyX3Bvb2xfc2l6ZSA9IDUzNjg3MDkxMjAwCmlubm9kYl9maWxlX3Blcl90YWJsZSA9IDEKaW5ub2RiX2ZsdXNoX2xvZ19hdF90cnhfY29tbWl0ID0gMgppbm5vZGJfZmx1c2hfbWV0aG9kID0gT19ESVJFQ1QKaW5ub2RiX2lvX2NhcGFjaXR5ID0gMjAwMAppbm5vZGJfbG9nX2J1ZmZlcl9zaXplID0gODM4ODYwOAppbm5vZGJfbWF4X2RpcnR5X3BhZ2VzX3BjdCA9IDUwCmlubm9kYl9vcGVuX2ZpbGVzID0gMTAyNAppbm5vZGJfcmVhZF9pb190aHJlYWRzID0gOAppbm5vZGJfc29ydF9idWZmZXJfc2l6ZSA9IDEwNDg1NzYKaW5ub2RiX3RocmVhZF9jb25jdXJyZW5jeSA9IDIwCmlubm9kYl93cml0ZV9pb190aHJlYWRzID0gOAprZXlfYnVmZmVyX3NpemUgPSAzMzU1NDQzMgpsb2NhbF9pbmZpbGUgPSAxCmxvZ19iaW5fdHJ1c3RfZnVuY3Rpb25fY3JlYXRvcnMgPSAxCmxvbmdfcXVlcnlfdGltZSA9IDMKbWF4X2FsbG93ZWRfcGFja2V0ID0gMTY3NzcyMTYKbWF4X2Nvbm5lY3RfZXJyb3JzID0gMTAwMDAwMAptYXhfY29ubmVjdGlvbnMgPSAyMDAwCm15aXNhbV9zb3J0X2J1ZmZlcl9zaXplID0gODM4ODYwOApuZXRfYnVmZmVyX2xlbmd0aCA9IDgxOTIKcGVyZm9ybWFuY2Vfc2NoZW1hID0gMApwZXJmb3JtYW5jZV9zY2hlbWFfbWF4X3RhYmxlX2luc3RhbmNlcyA9IDIwMApxdWVyeV9jYWNoZV9zaXplID0gMApxdWVyeV9jYWNoZV90eXBlID0gMApyZWFkX2J1ZmZlcl9zaXplID0gMjYyMTQ0CnJlYWRfcm5kX2J1ZmZlcl9zaXplID0gNTI0Mjg4CnNraXBfbmFtZV9yZXNvbHZlID0gMQpzb3J0X2J1ZmZlcl9zaXplID0gNTI0Mjg4CnN5bmNfYmlubG9nID0gMQp0YWJsZV9vcGVuX2NhY2hlID0gMTI4CnRocmVhZF9jYWNoZV9zaXplID0gNTA=",
+ }
+ try:
+ resp = client.udb().upload_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["upload_config_id"] = utest.value_at_path(resp, "GroupId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ExtractUDBParamGroupResponse"),
+ ],
+ action="ExtractUDBParamGroup",
+)
+def extract_udb_param_group_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("upload_config_id"),
+ }
+ try:
+ resp = client.invoke("ExtractUDBParamGroup", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ChangeUDBParamGroupResponse"),
+ ],
+ action="ChangeUDBParamGroup",
+)
+def change_udb_param_group_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("upload_config_id"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.invoke("ChangeUDBParamGroup", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceResponse"),
+ ("str_eq", "DataSet.0.ParamGroupId", variables.get("upload_config_id")),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "RestartUDBInstanceResponse"),
+ ],
+ action="RestartUDBInstance",
+)
+def restart_udb_instance_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().restart_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceResponse"),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUDBInstanceByParamGroupResponse"),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ],
+ action="DescribeUDBInstanceByParamGroup",
+)
+def describe_udb_instance_by_param_group_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("upload_config_id"),
+ }
+ try:
+ resp = client.invoke("DescribeUDBInstanceByParamGroup", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 7064)],
+ action="DeleteUDBParamGroup",
+)
+def delete_udb_param_group_16(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("upload_config_id"),
+ }
+ try:
+ resp = client.udb().delete_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUDBInstanceResponse"),
+ ],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_17(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_18(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=10,
+ fast_fail=False,
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_19(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteUDBParamGroup",
+)
+def delete_udb_param_group_20(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "GroupId": variables.get("create_config_id"),
+ }
+ try:
+ resp = client.udb().delete_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_503.py b/tests/test_services/test_set_503.py
new file mode 100644
index 0000000..e9c6fa0
--- /dev/null
+++ b/tests/test_services/test_set_503.py
@@ -0,0 +1,391 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(503)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_503(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Region"] = "cn-bj2"
+ scenario.variables["Zone"] = "cn-bj2-02"
+ scenario.variables["DBTypeId"] = "mysql-5.7"
+ scenario.variables["InstanceMode"] = "HA"
+ scenario.variables["InstanceType"] = "Normal"
+ scenario.variables["Port"] = 3306
+ scenario.variables["MemoryLimit"] = 1000
+ scenario.variables["DiskSpace"] = 20
+ scenario.variables["DBName"] = "auto_habz_"
+ scenario.variables["UseSSD"] = False
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBType",
+)
+def describe_udb_type_00(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.udb().describe_udb_type(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBParamGroup",
+)
+def describe_udb_param_group_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ }
+ try:
+ resp = client.udb().describe_udb_param_group(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DataSet_paramGroup"] = utest.value_at_path(resp, "DataSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBInstancePrice",
+)
+def describe_udb_instance_price_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "Count": 1,
+ }
+ try:
+ resp = client.udb().describe_udb_instance_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUDBInstance",
+)
+def create_udb_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Quantity": 0,
+ "Port": variables.get("Port"),
+ "ParamGroupId": funcs.search_value(
+ variables.get("DataSet_paramGroup"),
+ "DBTypeId",
+ variables.get("DBTypeId"),
+ "GroupId",
+ ),
+ "Name": funcs.concat(
+ variables.get("DBName"), variables.get("DBTypeId")
+ ),
+ "MemoryLimit": variables.get("MemoryLimit"),
+ "InstanceType": variables.get("InstanceType"),
+ "InstanceMode": variables.get("InstanceMode"),
+ "DiskSpace": variables.get("DiskSpace"),
+ "DBTypeId": variables.get("DBTypeId"),
+ "ChargeType": "Month",
+ "AdminPassword": "guanliyuanmima",
+ }
+ try:
+ resp = client.udb().create_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["DBId"] = utest.value_at_path(resp, "DBId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=50,
+ retry_interval=10,
+ startup_delay=30,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "State", "Running"),
+ ],
+ action="DescribeUDBInstanceState",
+)
+def describe_udb_instance_state_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_state(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeUDBInstanceUpgradePrice",
+)
+def describe_udb_instance_upgrade_price_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit") + 1,
+ "DiskSpace": variables.get("DiskSpace") + 1,
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().describe_udb_instance_upgrade_price(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CheckUDBInstanceAllowance",
+)
+def check_udb_instance_allowance_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit") + 1,
+ "DiskSpace": variables.get("DiskSpace") + 1,
+ "Count": 1,
+ "ClassType": "SQL",
+ }
+ try:
+ resp = client.invoke("CheckUDBInstanceAllowance", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=60,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ResizeUDBInstance",
+)
+def resize_udb_instance_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UseSSD": variables.get("UseSSD"),
+ "Region": variables.get("Region"),
+ "MemoryLimit": variables.get("MemoryLimit") + 1,
+ "DiskSpace": variables.get("DiskSpace") + 1,
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().resize_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=90,
+ retry_interval=10,
+ startup_delay=240,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Running"),
+ ("str_eq", "DataSet.0.MemoryLimit", variables.get("MemoryLimit") + 1),
+ ("str_eq", "DataSet.0.DiskSpace", variables.get("DiskSpace") + 10),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=5,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="StopUDBInstance",
+)
+def stop_udb_instance_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().stop_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=3,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ (
+ "str_eq",
+ "DataSet.0.Name",
+ funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
+ ),
+ ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
+ ("str_eq", "DataSet.0.State", "Shutoff"),
+ ],
+ action="DescribeUDBInstance",
+)
+def describe_udb_instance_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 100,
+ "DBId": variables.get("DBId"),
+ "ClassType": "sql",
+ }
+ try:
+ resp = client.udb().describe_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=10,
+ fast_fail=False,
+ action="DeleteUDBInstance",
+)
+def delete_udb_instance_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "DBId": variables.get("DBId"),
+ }
+ try:
+ resp = client.udb().delete_udb_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_687.py b/tests/test_services/test_set_687.py
new file mode 100644
index 0000000..3ac0902
--- /dev/null
+++ b/tests/test_services/test_set_687.py
@@ -0,0 +1,554 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(687)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_687(client, variables):
+ scenario.initial(variables)
+ scenario.variables["VPC_name_1"] = "VPC_api_test_1"
+ scenario.variables["remark"] = "remark_api_test"
+ scenario.variables["tag"] = "tag_api_test"
+ scenario.variables["Subnet_name_1_1"] = "subnet_1_1"
+ scenario.variables["subnet_netmask"] = 24
+ scenario.variables["project_id"] = "org-achi1o"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "GetProjectListResponse"),
+ ],
+ action="GetProjectList",
+)
+def get_project_list_00(client, variables):
+ d = {}
+ try:
+ resp = client.uaccount().get_project_list(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["project_list"] = utest.value_at_path(resp, "ProjectSet")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateVPC",
+)
+def create_vpc_01(client, variables):
+ d = {
+ "Tag": variables.get("tag"),
+ "Remark": variables.get("remark"),
+ "Region": variables.get("Region"),
+ "Network": ["172.16.16.0/20"],
+ "Name": variables.get("VPC_name_1"),
+ }
+ try:
+ resp = client.vpc().create_vpc(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VPCId_1"] = utest.value_at_path(resp, "VPCId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateSubnet",
+)
+def create_subnet_02(client, variables):
+ d = {
+ "VPCId": variables.get("VPCId_1"),
+ "Tag": variables.get("tag"),
+ "SubnetName": variables.get("Subnet_name_1_1"),
+ "Subnet": "172.16.17.0",
+ "Remark": variables.get("remark"),
+ "Region": variables.get("Region"),
+ "Netmask": variables.get("subnet_netmask"),
+ }
+ try:
+ resp = client.vpc().create_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["SubnetId_1_1"] = utest.value_at_path(resp, "SubnetId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "UpdateSubnetAttributeResponse"),
+ ],
+ action="UpdateSubnetAttribute",
+)
+def update_subnet_attribute_03(client, variables):
+ d = {
+ "Tag": "qa",
+ "SubnetId": variables.get("SubnetId_1_1"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.vpc().update_subnet_attribute(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DescribeSubnet",
+)
+def describe_subnet_04(client, variables):
+ d = {
+ "SubnetId": variables.get("SubnetId_1_1"),
+ "Region": variables.get("Region"),
+ "Offset": 1,
+ "Limit": 1,
+ }
+ try:
+ resp = client.vpc().describe_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ action="CreateVPC",
+)
+def create_vpc_05(client, variables):
+ d = {
+ "Region": variables.get("Region"),
+ "Network": ["192.168.16.0/20"],
+ "Name": "vpc_2",
+ }
+ try:
+ resp = client.vpc().create_vpc(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VPCId_2"] = utest.value_at_path(resp, "VPCId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateSubnet",
+)
+def create_subnet_06(client, variables):
+ d = {
+ "VPCId": variables.get("VPCId_2"),
+ "SubnetName": "Subnet_2_1",
+ "Subnet": "192.168.17.0",
+ "Region": variables.get("Region"),
+ "Netmask": variables.get("subnet_netmask"),
+ }
+ try:
+ resp = client.vpc().create_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["SubnetId_2_1"] = utest.value_at_path(resp, "SubnetId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreateSubnetResponse"),
+ ],
+ action="CreateSubnet",
+)
+def create_subnet_07(client, variables):
+ d = {
+ "VPCId": variables.get("VPCId_2"),
+ "Tag": "Subnet_2_2",
+ "SubnetName": "Subnet_2_2",
+ "Subnet": "192.168.18.0",
+ "Region": variables.get("Region"),
+ "Netmask": variables.get("subnet_netmask"),
+ }
+ try:
+ resp = client.vpc().create_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["SubnetId_2_2"] = utest.value_at_path(resp, "SubnetId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.VPCId", variables.get("VPCId_1")),
+ ("str_eq", "DataSet.0.VPCName", variables.get("VPC_name_1")),
+ ("str_eq", "DataSet.0.SubnetId", variables.get("SubnetId_1_1")),
+ ("str_eq", "DataSet.0.SubnetName", variables.get("Subnet_name_1_1")),
+ ("str_eq", "DataSet.0.Tag", "qa"),
+ ("str_eq", "DataSet.0.Remark", variables.get("remark")),
+ ("str_eq", "DataSet.0.SubnetType", 2),
+ ("str_eq", "DataSet.0.Netmask", 24),
+ ],
+ action="DescribeSubnet",
+)
+def describe_subnet_08(client, variables):
+ d = {
+ "VPCId": variables.get("VPCId_1"),
+ "SubnetId": variables.get("SubnetId_1_1"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.vpc().describe_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="AllocateVIP",
+)
+def allocate_vip_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VPCId": variables.get("VPCId_1"),
+ "SubnetId": variables.get("SubnetId_1_1"),
+ "Remark": "vip_tag1",
+ "Region": variables.get("Region"),
+ "Name": "vip_api_auto",
+ }
+ try:
+ resp = client.unet().allocate_vip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VIPId_1"] = utest.value_at_path(resp, "VIPSet.0.VIPId")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "VIPSet.0.VPCId", variables.get("VPCId_1")),
+ ("str_eq", "VIPSet.0.VIPId", variables.get("VIPId_1")),
+ ("str_eq", "VIPSet.0.SubnetId", variables.get("SubnetId_1_1")),
+ ],
+ action="DescribeVIP",
+)
+def describe_vip_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VPCId": variables.get("VPCId_1"),
+ "SubnetId": variables.get("SubnetId_1_1"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.unet().describe_vip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VIP_ip_1"] = utest.value_at_path(resp, "DataSet.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "TotalCount", 1),
+ ("str_eq", "DataSet.0.ResourceId", variables.get("VIPId_1")),
+ ("str_eq", "DataSet.0.IP", variables.get("VIP_ip_1")),
+ ],
+ action="DescribeSubnetResource",
+)
+def describe_subnet_resource_11(client, variables):
+ d = {
+ "SubnetId": variables.get("SubnetId_1_1"),
+ "Region": variables.get("Region"),
+ "Offset": 0,
+ "Limit": 20,
+ }
+ try:
+ resp = client.vpc().describe_subnet_resource(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="ReleaseVIP",
+)
+def release_vip_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VIPId": variables.get("VIPId_1"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.unet().release_vip(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteSubnet",
+)
+def delete_subnet_13(client, variables):
+ d = {
+ "SubnetId": variables.get("SubnetId_1_1"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.vpc().delete_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteSubnet",
+)
+def delete_subnet_14(client, variables):
+ d = {
+ "SubnetId": variables.get("SubnetId_2_1"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.vpc().delete_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=1,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteSubnet",
+)
+def delete_subnet_15(client, variables):
+ d = {
+ "SubnetId": variables.get("SubnetId_2_2"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.vpc().delete_subnet(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "AddVPCNetworkResponse"),
+ ],
+ action="AddVPCNetwork",
+)
+def add_vpc_network_16(client, variables):
+ d = {
+ "VPCId": variables.get("VPCId_1"),
+ "Region": variables.get("Region"),
+ "Network": ["10.100.96.0/20"],
+ }
+ try:
+ resp = client.vpc().add_vpc_network(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeVPCResponse"),
+ ],
+ action="DescribeVPC",
+)
+def describe_vpc_17(client, variables):
+ d = {
+ "VPCIds": [variables.get("VPCId_1")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.vpc().describe_vpc(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateVPCIntercom",
+)
+def create_vpc_intercom_18(client, variables):
+ d = {
+ "VPCId": variables.get("VPCId_1"),
+ "Region": variables.get("Region"),
+ "DstVPCId": variables.get("VPCId_2"),
+ "DstRegion": variables.get("Region"),
+ "DstProjectId": funcs.search_value(
+ variables.get("project_list"), "IsDefault", True, "ProjectId"
+ ),
+ }
+ try:
+ resp = client.vpc().create_vpc_intercom(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "DataSet.0.VPCId", variables.get("VPCId_2")),
+ ],
+ action="DescribeVPCIntercom",
+)
+def describe_vpc_intercom_19(client, variables):
+ d = {"VPCId": variables.get("VPCId_1"), "Region": variables.get("Region")}
+ try:
+ resp = client.vpc().describe_vpc_intercom(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=0,
+ retry_interval=0,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteVPCIntercom",
+)
+def delete_vpc_intercom_20(client, variables):
+ d = {
+ "VPCId": variables.get("VPCId_1"),
+ "Region": variables.get("Region"),
+ "DstVPCId": variables.get("VPCId_2"),
+ "DstRegion": variables.get("Region"),
+ "DstProjectId": funcs.search_value(
+ variables.get("project_list"), "IsDefault", True, "ProjectId"
+ ),
+ }
+ try:
+ resp = client.vpc().delete_vpc_intercom(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="DeleteVPC",
+)
+def delete_vpc_21(client, variables):
+ d = {"VPCId": variables.get("VPCId_1"), "Region": variables.get("Region")}
+ try:
+ resp = client.vpc().delete_vpc(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=2,
+ fast_fail=False,
+ action="DeleteVPC",
+)
+def delete_vpc_22(client, variables):
+ d = {"VPCId": variables.get("VPCId_2"), "Region": variables.get("Region")}
+ try:
+ resp = client.vpc().delete_vpc(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_services/test_set_867.py b/tests/test_services/test_set_867.py
new file mode 100644
index 0000000..032be42
--- /dev/null
+++ b/tests/test_services/test_set_867.py
@@ -0,0 +1,711 @@
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+import pytest
+import logging
+from ucloud.core import exc
+from ucloud.testing import env, funcs, op, utest
+
+logger = logging.getLogger(__name__)
+scenario = utest.Scenario(867)
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_set_867(client, variables):
+ scenario.initial(variables)
+ scenario.variables["Password"] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["SnapshotSysName"] = "snapshot-ARK-SYS-01"
+ scenario.variables["SnapshotSysDesc"] = "snapshot-ARK-SYS-01-desc"
+ scenario.variables["SnapDiskType"] = "LocalBoot"
+ scenario.variables["SnapshotDataNameModify"] = "snapshot-ARK-DATA-01-modify"
+ scenario.variables[
+ "SnapshotDataDescModify"
+ ] = "snapshot-ARK-DATA-01-desc-Modify"
+ scenario.variables["UhostName"] = "uhost-snapshot-ARK-auto-api-1"
+ scenario.variables["SnapshotDataName"] = "snapshot-ARK-DATA-01"
+ scenario.variables["SnapshotDataDesc"] = "snapshot-ARK-DATA-01-desc"
+ scenario.variables[
+ "CreateFromTimeMachinePassword"
+ ] = "Z3VhbmxpeXVhbm1pbWExMjMhQCM="
+ scenario.variables["ImageID"] = "#{u_get_image_resource($Region,$Zone)}"
+ scenario.run(client)
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=False,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeImageResponse"),
+ ],
+ action="DescribeImage",
+)
+def describe_image_00(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "Region": variables.get("Region"),
+ "OsType": "Linux",
+ "ImageType": "Base",
+ }
+ try:
+ resp = client.uhost().describe_image(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["ImageID"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [("str_eq", "RetCode", 0)],
+ action="CreateUHostInstance",
+)
+def create_uhost_instance_01(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "TimemachineFeature": "no",
+ "Region": variables.get("Region"),
+ "Password": "VXFhNzg5VGVzdCFAIyQ7LA==",
+ "Name": variables.get("UhostName"),
+ "Memory": 1024,
+ "LoginMode": "Password",
+ "ImageId": variables.get("ImageID"),
+ "HotplugFeature": False,
+ "GPU": False,
+ "DiskSpace": 10,
+ "CPU": 1,
+ }
+ try:
+ resp = client.uhost().create_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["hostId"] = utest.value_at_path(resp, "UHostIds.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=100,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ("str_eq", "UHostSet.0.TimemachineFeature", "no"),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_02(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUHostInstanceResponse"),
+ ],
+ action="StopUHostInstance",
+)
+def stop_uhost_instance_03(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().stop_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=10,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_04(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "UpgradeToArkUHostInstanceResponse"),
+ ],
+ action="UpgradeToArkUHostInstance",
+)
+def upgrade_to_ark_uhost_instance_05(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().upgrade_to_ark_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=200,
+ retry_interval=30,
+ startup_delay=100,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ("str_eq", "UHostSet.0.TimemachineFeature", "yes"),
+ ("str_eq", "UHostSet.0.BootDiskState", "Normal"),
+ ("str_eq", "UHostSet.0.DiskSet.0.BackupType", "DATAARK"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_06(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StartUHostInstanceResponse"),
+ ],
+ action="StartUHostInstance",
+)
+def start_uhost_instance_07(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().start_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Running"),
+ ("str_eq", "UHostSet.0.TimemachineFeature", "yes"),
+ ("str_eq", "UHostSet.0.DiskSet.0.BackupType", "DATAARK"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_08(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=60,
+ retry_interval=60,
+ startup_delay=100,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeUhostTmMetaResponse"),
+ ("str_eq", "UtmStatus", "normal"),
+ ],
+ action="DescribeUhostTmMeta",
+)
+def describe_uhost_tm_meta_09(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UhostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeUhostTmMeta", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VdiskIdSys"] = utest.value_at_path(resp, "DataSet.0.VdiskId")
+ variables["VdiskIdData"] = utest.value_at_path(resp, "DataSet.1.VdiskId")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeVDiskTmListResponse"),
+ ],
+ action="DescribeVDiskTmList",
+)
+def describe_v_disk_tm_list_10(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VDiskId": variables.get("VdiskIdSys"),
+ "SnapshotType": "all",
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeVDiskTmList", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeVDiskTmListResponse"),
+ ],
+ action="DescribeVDiskTmList",
+)
+def describe_v_disk_tm_list_11(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VDiskId": variables.get("VdiskIdData"),
+ "SnapshotType": "all",
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeVDiskTmList", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreateUserVDiskSnapshotResponse"),
+ ],
+ action="CreateUserVDiskSnapshot",
+)
+def create_user_v_disk_snapshot_12(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VDiskId": variables.get("VdiskIdSys"),
+ "Region": variables.get("Region"),
+ "Name": variables.get("SnapshotSysName"),
+ "Comment": variables.get("SnapshotSysDesc"),
+ }
+ try:
+ resp = client.invoke("CreateUserVDiskSnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VdiskSnapIDSys"] = utest.value_at_path(resp, "SnapshotId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "CreateUserVDiskSnapshotResponse"),
+ ],
+ action="CreateUserVDiskSnapshot",
+)
+def create_user_v_disk_snapshot_13(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "VDiskId": variables.get("VdiskIdData"),
+ "Region": variables.get("Region"),
+ "Name": variables.get("SnapshotDataName"),
+ "Comment": variables.get("SnapshotDataDesc"),
+ }
+ try:
+ resp = client.invoke("CreateUserVDiskSnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ variables["VdiskSnapIDData"] = utest.value_at_path(resp, "SnapshotId.0")
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeSnapshotResponse"),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.SnapshotId",
+ variables.get("VdiskSnapIDSys"),
+ ),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.SnapshotName",
+ variables.get("SnapshotSysName"),
+ ),
+ ("str_eq", "UHostSnapshotSet.0.DiskType", "LocalBoot"),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.ResourceName",
+ variables.get("UhostName"),
+ ),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.SnapshotDescription",
+ variables.get("SnapshotSysDesc"),
+ ),
+ ("str_eq", "UHostSnapshotSet.0.State", "Normal"),
+ ],
+ action="DescribeSnapshot",
+)
+def describe_snapshot_14(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "SnapshotIds": [variables.get("VdiskSnapIDSys")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeSnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeSnapshotResponse"),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.SnapshotId",
+ variables.get("VdiskSnapIDData"),
+ ),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.SnapshotName",
+ variables.get("SnapshotDataName"),
+ ),
+ ("str_eq", "UHostSnapshotSet.0.DiskType", "LocalData"),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.ResourceName",
+ variables.get("UhostName"),
+ ),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.SnapshotDescription",
+ variables.get("SnapshotDataDesc"),
+ ),
+ ("str_eq", "UHostSnapshotSet.0.State", "Normal"),
+ ],
+ action="DescribeSnapshot",
+)
+def describe_snapshot_15(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "SnapshotIds": [variables.get("VdiskSnapIDData")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeSnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "ModifySnapshotResponse"),
+ ],
+ action="ModifySnapshot",
+)
+def modify_snapshot_16(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SnapshotName": variables.get("SnapshotDataNameModify"),
+ "SnapshotId": variables.get("VdiskSnapIDData"),
+ "SnapshotDescription": variables.get("SnapshotDataDescModify"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("ModifySnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeSnapshotResponse"),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.SnapshotId",
+ variables.get("VdiskSnapIDData"),
+ ),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.SnapshotName",
+ variables.get("SnapshotDataNameModify"),
+ ),
+ ("str_eq", "UHostSnapshotSet.0.DiskType", "LocalData"),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.ResourceName",
+ variables.get("UhostName"),
+ ),
+ (
+ "str_eq",
+ "UHostSnapshotSet.0.SnapshotDescription",
+ variables.get("SnapshotDataDescModify"),
+ ),
+ ("str_eq", "UHostSnapshotSet.0.State", "Normal"),
+ ],
+ action="DescribeSnapshot",
+)
+def describe_snapshot_17(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "SnapshotIds": [variables.get("VdiskSnapIDData")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DescribeSnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteSnapshotResponse"),
+ ],
+ action="DeleteSnapshot",
+)
+def delete_snapshot_18(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SnapshotId": variables.get("VdiskSnapIDSys"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DeleteSnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DeleteSnapshotResponse"),
+ ],
+ action="DeleteSnapshot",
+)
+def delete_snapshot_19(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "SnapshotId": variables.get("VdiskSnapIDData"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.invoke("DeleteSnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=30,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "DescribeSnapshotResponse"),
+ (
+ "object_not_contains",
+ "UHostSnapshotSet",
+ variables.get("VdiskSnapIDSys"),
+ ),
+ (
+ "object_not_contains",
+ "UHostSnapshotSet",
+ variables.get("VdiskSnapIDData"),
+ ),
+ ],
+ action="DescribeSnapshot",
+)
+def describe_snapshot_20(client, variables):
+ d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}
+ try:
+ resp = client.invoke("DescribeSnapshot", d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "StopUHostInstanceResponse"),
+ ],
+ action="StopUHostInstance",
+)
+def stop_uhost_instance_21(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().stop_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=30,
+ retry_interval=10,
+ startup_delay=10,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "UHostSet.0.State", "Stopped"),
+ ],
+ action="DescribeUHostInstance",
+)
+def describe_uhost_instance_22(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostIds": [variables.get("hostId")],
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().describe_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
+
+
+@scenario.step(
+ max_retries=3,
+ retry_interval=1,
+ startup_delay=0,
+ fast_fail=True,
+ validators=lambda variables: [
+ ("str_eq", "RetCode", 0),
+ ("str_eq", "Action", "TerminateUHostInstanceResponse"),
+ ],
+ action="TerminateUHostInstance",
+)
+def terminate_uhost_instance_23(client, variables):
+ d = {
+ "Zone": variables.get("Zone"),
+ "UHostId": variables.get("hostId"),
+ "Region": variables.get("Region"),
+ }
+ try:
+ resp = client.uhost().terminate_uhost_instance(d)
+ except exc.RetCodeException as e:
+ resp = e.json()
+ return resp
diff --git a/tests/test_testing/test_utest.py b/tests/test_testing/test_utest.py
index d2c4135..a75429f 100644
--- a/tests/test_testing/test_utest.py
+++ b/tests/test_testing/test_utest.py
@@ -1,7 +1,15 @@
# -*- coding: utf-8 -*-
import pytest
-from ucloud.testing import utest
+from ucloud.testing import utest, env
+
+
+@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
+def test_acc_pre_check(client):
+ assert str(client)
+ assert client.config.to_dict()
+ assert client.credential.to_dict()
+ env.pre_check_env()
def test_value_at_path():
@@ -21,4 +29,7 @@ def test_value_at_path():
"TotalBandwidth": 6,
"TotalCount": 3,
}
- assert utest.value_at_path(d, "EIPSet.0.Resource.ResourceID") == "uhost-war3png3"
+ assert (
+ utest.value_at_path(d, "EIPSet.0.Resource.ResourceID")
+ == "uhost-war3png3"
+ )
diff --git a/tox.ini b/tox.ini
deleted file mode 100644
index 1170d17..0000000
--- a/tox.ini
+++ /dev/null
@@ -1,21 +0,0 @@
-[tox]
-skipsdist = True
-
-[global]
-wheel_dir = {homedir}/.wheelhouse
-find_links =
- {homedir}/.wheelhouse
- {homedir}/.pip-cache
-
-[testenv]
-deps =
- wheel
-
-basepython =
- py27: python2.7
-
-passenv = *
-
-commands =
- pip install -e .[test]
- pytest -v .
diff --git a/ucloud/__init__.py b/ucloud/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/__init__.py
+++ b/ucloud/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/client.py b/ucloud/client.py
index 2fcdc0d..b73fc01 100644
--- a/ucloud/client.py
+++ b/ucloud/client.py
@@ -1,74 +1,94 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core import client
-
-
-class Client(client.Client):
- def __init__(self, config, transport=None, middleware=None):
- self._config = config
- super(Client, self).__init__(config, transport, middleware)
-
- def pathx(self):
- from ucloud.services.pathx.client import PathXClient
-
- return PathXClient(self._config, self.transport, self.middleware, self.logger)
-
- def stepflow(self):
- from ucloud.services.stepflow.client import StepFlowClient
-
- return StepFlowClient(
- self._config, self.transport, self.middleware, self.logger
- )
-
- def uaccount(self):
- from ucloud.services.uaccount.client import UAccountClient
-
- return UAccountClient(
- self._config, self.transport, self.middleware, self.logger
- )
-
- def udb(self):
- from ucloud.services.udb.client import UDBClient
-
- return UDBClient(self._config, self.transport, self.middleware, self.logger)
-
- def udpn(self):
- from ucloud.services.udpn.client import UDPNClient
-
- return UDPNClient(self._config, self.transport, self.middleware, self.logger)
-
- def udisk(self):
- from ucloud.services.udisk.client import UDiskClient
-
- return UDiskClient(self._config, self.transport, self.middleware, self.logger)
-
- def uhost(self):
- from ucloud.services.uhost.client import UHostClient
-
- return UHostClient(self._config, self.transport, self.middleware, self.logger)
-
- def ulb(self):
- from ucloud.services.ulb.client import ULBClient
-
- return ULBClient(self._config, self.transport, self.middleware, self.logger)
-
- def umem(self):
- from ucloud.services.umem.client import UMemClient
-
- return UMemClient(self._config, self.transport, self.middleware, self.logger)
-
- def unet(self):
- from ucloud.services.unet.client import UNetClient
-
- return UNetClient(self._config, self.transport, self.middleware, self.logger)
-
- def uphost(self):
- from ucloud.services.uphost.client import UPHostClient
-
- return UPHostClient(self._config, self.transport, self.middleware, self.logger)
-
- def vpc(self):
- from ucloud.services.vpc.client import VPCClient
-
- return VPCClient(self._config, self.transport, self.middleware, self.logger)
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core import client
+
+
+class Client(client.Client):
+ def __init__(self, config, transport=None, middleware=None):
+ self._config = config
+ super(Client, self).__init__(config, transport, middleware)
+
+ def pathx(self):
+ from ucloud.services.pathx.client import PathXClient
+
+ return PathXClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def stepflow(self):
+ from ucloud.services.stepflow.client import StepFlowClient
+
+ return StepFlowClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def uaccount(self):
+ from ucloud.services.uaccount.client import UAccountClient
+
+ return UAccountClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def udb(self):
+ from ucloud.services.udb.client import UDBClient
+
+ return UDBClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def udpn(self):
+ from ucloud.services.udpn.client import UDPNClient
+
+ return UDPNClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def udisk(self):
+ from ucloud.services.udisk.client import UDiskClient
+
+ return UDiskClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def uhost(self):
+ from ucloud.services.uhost.client import UHostClient
+
+ return UHostClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def ulb(self):
+ from ucloud.services.ulb.client import ULBClient
+
+ return ULBClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def umem(self):
+ from ucloud.services.umem.client import UMemClient
+
+ return UMemClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def unet(self):
+ from ucloud.services.unet.client import UNetClient
+
+ return UNetClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def uphost(self):
+ from ucloud.services.uphost.client import UPHostClient
+
+ return UPHostClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
+
+ def vpc(self):
+ from ucloud.services.vpc.client import VPCClient
+
+ return VPCClient(
+ self._config, self.transport, self.middleware, self.logger
+ )
diff --git a/ucloud/core/__init__.py b/ucloud/core/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/core/__init__.py
+++ b/ucloud/core/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/core/auth/__init__.py b/ucloud/core/auth/__init__.py
index 1abbd15..09e1eff 100644
--- a/ucloud/core/auth/__init__.py
+++ b/ucloud/core/auth/__init__.py
@@ -1,5 +1,5 @@
-# -*- coding: utf-8 -*-
-
-from ucloud.core.auth._cfg import Credential
-
-__all__ = ["Credential"]
+# -*- coding: utf-8 -*-
+
+from ucloud.core.auth._cfg import Credential
+
+__all__ = ["Credential"]
diff --git a/ucloud/core/auth/_cfg.py b/ucloud/core/auth/_cfg.py
index ae7b4d5..7b2264f 100644
--- a/ucloud/core/auth/_cfg.py
+++ b/ucloud/core/auth/_cfg.py
@@ -1,72 +1,72 @@
-# -*- coding: utf-8 -*-
-
-import hashlib
-from collections import OrderedDict
-from ucloud.core.typesystem import schema, fields
-
-
-class CredentialSchema(schema.Schema):
- fields = {
- "public_key": fields.Str(required=True),
- "private_key": fields.Str(required=True),
- }
-
-
-def verify_ac(private_key, params):
- """ calculate signature by private_key/public_key
-
- the keys can be found on `APIKey documentation `__
-
- >>> verify_ac("my_private_key", {"foo": "bar"})
- '634edc1bb957c0d65e5ab5494cf3b7784fbc87af'
-
- >>> verify_ac("my_private_key", {"foo": "bar"})
- '634edc1bb957c0d65e5ab5494cf3b7784fbc87af'
-
- :param private_key: private key
- :param params:
- :return:
- """
- params = OrderedDict(sorted(params.items(), key=lambda item: item[0]))
- simplified = ""
- for key, value in params.items():
- simplified += str(key) + str(value)
- simplified += private_key
- hash_new = hashlib.sha1()
- hash_new.update(simplified.encode("utf-8"))
- hash_value = hash_new.hexdigest()
- return hash_value
-
-
-class Credential(object):
- """ credential is the object to store credential information
-
- the keys can be found on `APIKey documentation `__
-
- it can calculate signature for OpenAPI:
-
- >>> cred = Credential('my_public_key', 'my_private_key')
- >>> cred.verify_ac({"foo": "bar"})
- 'd4411ab30953fb0bbcb1e7313081f05e4e91a394'
-
- :param public_key:
- :param private_key:
- """
-
- PUBLIC_KEY_NAME = "PublicKey"
-
- def __init__(self, public_key, private_key, **kwargs):
- self.public_key = public_key
- self.private_key = private_key
-
- def verify_ac(self, args):
- args[Credential.PUBLIC_KEY_NAME] = self.public_key
- return verify_ac(self.private_key, args)
-
- @classmethod
- def from_dict(cls, d):
- parsed = CredentialSchema().dumps(d)
- return cls(**parsed)
-
- def to_dict(self):
- return {"public_key": self.public_key, "private_key": self.private_key}
+# -*- coding: utf-8 -*-
+
+import hashlib
+from collections import OrderedDict
+from ucloud.core.typesystem import schema, fields, encoder
+
+
+class CredentialSchema(schema.Schema):
+ fields = {
+ "public_key": fields.Str(required=True),
+ "private_key": fields.Str(required=True),
+ }
+
+
+def verify_ac(private_key, params):
+ """ calculate signature by private_key/public_key
+
+ the keys can be found on `APIKey documentation `__
+
+ >>> verify_ac("my_private_key", {"foo": "bar"})
+ '634edc1bb957c0d65e5ab5494cf3b7784fbc87af'
+
+ >>> verify_ac("my_private_key", {"foo": "bar"})
+ '634edc1bb957c0d65e5ab5494cf3b7784fbc87af'
+
+ :param private_key: private key
+ :param params:
+ :return:
+ """
+ params = OrderedDict(sorted(params.items(), key=lambda item: item[0]))
+ simplified = ""
+ for key, value in params.items():
+ simplified += str(key) + encoder.encode_value(value)
+ simplified += private_key
+ hash_new = hashlib.sha1()
+ hash_new.update(simplified.encode("utf-8"))
+ hash_value = hash_new.hexdigest()
+ return hash_value
+
+
+class Credential(object):
+ """ credential is the object to store credential information
+
+ the keys can be found on `APIKey documentation `__
+
+ it can calculate signature for OpenAPI:
+
+ >>> cred = Credential('my_public_key', 'my_private_key')
+ >>> cred.verify_ac({"foo": "bar"})
+ 'd4411ab30953fb0bbcb1e7313081f05e4e91a394'
+
+ :param public_key:
+ :param private_key:
+ """
+
+ PUBLIC_KEY_NAME = "PublicKey"
+
+ def __init__(self, public_key, private_key, **kwargs):
+ self.public_key = public_key
+ self.private_key = private_key
+
+ def verify_ac(self, args):
+ args[Credential.PUBLIC_KEY_NAME] = self.public_key
+ return verify_ac(self.private_key, args)
+
+ @classmethod
+ def from_dict(cls, d):
+ parsed = CredentialSchema().dumps(d)
+ return cls(**parsed)
+
+ def to_dict(self):
+ return {"public_key": self.public_key, "private_key": self.private_key}
diff --git a/ucloud/core/client/__init__.py b/ucloud/core/client/__init__.py
index 3a5f8b7..7db5e85 100644
--- a/ucloud/core/client/__init__.py
+++ b/ucloud/core/client/__init__.py
@@ -1,9 +1,9 @@
-# -*- coding: utf-8 -*-
-
-"""
-Client
-"""
-from ucloud.core.client._cfg import Config
-from ucloud.core.client._client import Client
-
-__all__ = ["Config", "Client"]
+# -*- coding: utf-8 -*-
+
+"""
+Client
+"""
+from ucloud.core.client._cfg import Config
+from ucloud.core.client._client import Client
+
+__all__ = ["Config", "Client"]
diff --git a/ucloud/core/client/_cfg.py b/ucloud/core/client/_cfg.py
index c263d8d..4314822 100644
--- a/ucloud/core/client/_cfg.py
+++ b/ucloud/core/client/_cfg.py
@@ -1,81 +1,81 @@
-# -*- coding: utf-8 -*-
-
-import logging
-from ucloud.core.typesystem import schema, fields
-
-
-class ConfigSchema(schema.Schema):
- fields = {
- "region": fields.Str(required=True),
- "project_id": fields.Str(),
- "base_url": fields.Str(default="https://api.ucloud.cn"),
- "user_agent": fields.Str(),
- "timeout": fields.Int(default=30),
- "max_retries": fields.Int(default=3),
- "log_level": fields.Int(default=logging.INFO),
- "validate_request": fields.Bool(default=True),
- }
-
-
-class Config(object):
- """
- Config is the config of ucloud sdk, use for setting up
-
- :type region: str
- :param region: Region is the region of backend service,
- See also `Region list Documentation `_
- :type project_id: str
- :param project_id: ProjectId is the unique identify of project, used for organize resources,
- Most of resources should belong to a project. Sub-Account must have an project id.
- See also `Project list Documentation `_
- :type base_url: str
- :param base_url: BaseUrl is the url of backend api
- :param user_agent: UserAgent is an attribute for sdk client, used for distinguish who is using sdk.
- See also `User Agent `_
- It will be appended to the end of sdk user-agent.
- eg. "MyAPP/0.10.1" -> "Python/3.7.0 Python-SDK/0.1.0 MyAPP/0.10.1"
- :type timeout: int
- :param timeout: Timeout is timeout for every request.
- :type max_retries: int
- :param max_retries: MaxRetries is the number of max retry times.
- Set MaxRetries more than 0 to enable auto-retry for network and service availability problem
- if auto-retry is enabled, it will enable default retry policy using exponential backoff.
- :type log_level: int
- :param log_level: LogLevel is equal to builtin logging level,
- if logLevel not be set, use INFO level as default.
- """
-
- def __init__(
- self,
- region,
- project_id=None,
- base_url="https://api.ucloud.cn",
- user_agent=None,
- timeout=30,
- max_retries=3,
- log_level=logging.INFO,
- **kwargs
- ):
- self.region = region
- self.project_id = project_id
- self.base_url = base_url
- self.user_agent = user_agent
- self.timeout = timeout
- self.max_retries = max_retries
- self.log_level = log_level
-
- @classmethod
- def from_dict(cls, d):
- parsed = ConfigSchema().dumps(d)
- return cls(**parsed)
-
- def to_dict(self):
- return {
- "region": self.region,
- "project_id": self.project_id,
- "base_url": self.base_url,
- "user_agent": self.user_agent,
- "timeout": self.timeout,
- "max_retries": self.max_retries,
- "log_level": self.log_level,
- }
+# -*- coding: utf-8 -*-
+
+import logging
+from ucloud.core.typesystem import schema, fields
+
+
+class ConfigSchema(schema.Schema):
+ fields = {
+ "region": fields.Str(required=True),
+ "project_id": fields.Str(),
+ "base_url": fields.Str(default="https://api.ucloud.cn"),
+ "user_agent": fields.Str(),
+ "timeout": fields.Int(default=30),
+ "max_retries": fields.Int(default=3),
+ "log_level": fields.Int(default=logging.INFO),
+ "validate_request": fields.Bool(default=True),
+ }
+
+
+class Config(object):
+ """
+ Config is the config of ucloud sdk, use for setting up
+
+ :type region: str
+ :param region: Region is the region of backend service,
+ See also `Region list Documentation `_
+ :type project_id: str
+ :param project_id: ProjectId is the unique identify of project, used for organize resources,
+ Most of resources should belong to a project. Sub-Account must have an project id.
+ See also `Project list Documentation `_
+ :type base_url: str
+ :param base_url: BaseUrl is the url of backend api
+ :param user_agent: UserAgent is an attribute for sdk client, used for distinguish who is using sdk.
+ See also `User Agent `_
+ It will be appended to the end of sdk user-agent.
+ eg. "MyAPP/0.10.1" -> "Python/3.7.0 Python-SDK/0.1.0 MyAPP/0.10.1"
+ :type timeout: int
+ :param timeout: Timeout is timeout for every request.
+ :type max_retries: int
+ :param max_retries: MaxRetries is the number of max retry times.
+ Set MaxRetries more than 0 to enable auto-retry for network and service availability problem
+ if auto-retry is enabled, it will enable default retry policy using exponential backoff.
+ :type log_level: int
+ :param log_level: LogLevel is equal to builtin logging level,
+ if logLevel not be set, use INFO level as default.
+ """
+
+ def __init__(
+ self,
+ region,
+ project_id=None,
+ base_url="https://api.ucloud.cn",
+ user_agent=None,
+ timeout=30,
+ max_retries=3,
+ log_level=logging.INFO,
+ **kwargs
+ ):
+ self.region = region
+ self.project_id = project_id
+ self.base_url = base_url
+ self.user_agent = user_agent
+ self.timeout = timeout
+ self.max_retries = max_retries
+ self.log_level = log_level
+
+ @classmethod
+ def from_dict(cls, d):
+ parsed = ConfigSchema().dumps(d)
+ return cls(**parsed)
+
+ def to_dict(self):
+ return {
+ "region": self.region,
+ "project_id": self.project_id,
+ "base_url": self.base_url,
+ "user_agent": self.user_agent,
+ "timeout": self.timeout,
+ "max_retries": self.max_retries,
+ "log_level": self.log_level,
+ }
diff --git a/ucloud/core/client/_client.py b/ucloud/core/client/_client.py
index d60405c..236b68d 100644
--- a/ucloud/core/client/_client.py
+++ b/ucloud/core/client/_client.py
@@ -1,111 +1,119 @@
-# -*- coding: utf-8 -*-
-
-import logging
-import sys
-from ucloud import version
-from ucloud.core.client._cfg import Config
-from ucloud.core.transport import Transport, RequestsTransport, Request, Response
-from ucloud.core.utils import log
-from ucloud.core.utils.middleware import Middleware
-from ucloud.core import auth, exc
-
-default_transport = RequestsTransport()
-
-
-class Client(object):
- def __init__(self, config, transport=None, middleware=None, logger=None):
- cfg, cred = self._parse_dict_config(config)
- self.config = cfg
- self.credential = cred
- self.transport = transport or default_transport
- self.logger = logger or log.default_logger
- if middleware is None:
- middleware = Middleware()
- middleware.response(self.logged_response_handler)
- middleware.request(self.logged_request_handler)
- self._middleware = middleware
-
- def invoke(self, action, args=None, **options):
- """ invoke will invoke the action with arguments data and options
-
- :param str action: the api action, like `CreateUHostInstance`
- :param dict args: arguments of api(action), see doc: `UCloud API Documentation `__
- :return:
- """
- retries = 0
- max_retries = options.get("max_retries") or self.config.max_retries
- while retries <= max_retries:
- try:
- return self._send(action, args or {}, **options)
- except exc.UCloudException as e:
- if e.retryable and retries != max_retries:
- logging.info(
- "Retrying {action}: {args}".format(action=action, args=args)
- )
- retries += 1
- continue
- raise e
- except Exception as e:
- raise e
- raise exc.RetryTimeoutException("max retries is reached")
-
- @property
- def middleware(self):
- return self._middleware
-
- def logged_request_handler(self, req):
- self.logger.info("[request] {} {}".format(req.get("Action", ""), req))
- return req
-
- def logged_response_handler(self, resp):
- self.logger.info("[response] {} {}".format(resp.get("Action", ""), resp))
- return resp
-
- def __enter__(self):
- yield self
-
- @staticmethod
- def _parse_dict_config(config):
- return Config.from_dict(config), auth.Credential.from_dict(config)
-
- def _send(self, action, args, **options):
- args["Action"] = action
- for handler in self.middleware.request_handlers:
- args = handler(args)
- req = self._build_http_request(args)
- max_retries = options.get("max_retries") or self.config.max_retries
- timeout = options.get("timeout") or self.config.timeout
- resp = self.transport.send(req, timeout=timeout, max_retries=max_retries).json()
- for handler in self.middleware.response_handlers:
- resp = handler(resp)
- if int(resp.get("RetCode", -1)) != 0:
- raise exc.RetCodeException(
- action=req.data.get("Action"),
- code=int(resp.get("RetCode")),
- message=resp.get("Message"),
- )
- return resp
-
- def _build_http_request(self, args):
- payload = {"Region": self.config.region, "ProjectId": self.config.project_id}
- payload.update({k: v for k, v in args.items() if v is not None})
- payload["Signature"] = self.credential.verify_ac(payload)
- return Request(
- url=self.config.base_url,
- method="post",
- data=payload,
- headers={
- "User-Agent": self._build_user_agent(),
- "Content-Type": "application/x-www-form-urlencoded",
- },
- )
-
- def _build_user_agent(self):
- python_version = "{v[0]}.{v[1]}.{v[2]}".format(v=sys.version_info)
- user_agent = "Python/{python_version} Python-SDK/{sdk_version}".format(
- python_version=python_version, sdk_version=version.version
- ) + (self.config.user_agent or "")
- return user_agent
-
- def __repr__(self):
- return "<{}('{}')>".format(self.__class__.__name__, self.config.region)
+# -*- coding: utf-8 -*-
+
+import logging
+import sys
+from ucloud import version
+from ucloud.core.client._cfg import Config
+from ucloud.core.transport import Transport, RequestsTransport, Request
+from ucloud.core.typesystem import encoder
+from ucloud.core.utils import log
+from ucloud.core.utils.middleware import Middleware
+from ucloud.core import auth, exc
+
+default_transport = RequestsTransport()
+
+
+class Client(object):
+ def __init__(self, config, transport=None, middleware=None, logger=None):
+ cfg, cred = self._parse_dict_config(config)
+ self.config = cfg
+ self.credential = cred
+ self.transport = transport or default_transport
+ self.logger = logger or log.default_logger
+ if middleware is None:
+ middleware = Middleware()
+ middleware.response(self.logged_response_handler)
+ middleware.request(self.logged_request_handler)
+ self._middleware = middleware
+
+ def invoke(self, action, args=None, **options):
+ """ invoke will invoke the action with arguments data and options
+
+ :param str action: the api action, like `CreateUHostInstance`
+ :param dict args: arguments of api(action), see doc: `UCloud API Documentation `__
+ :return:
+ """
+ retries = 0
+ max_retries = options.get("max_retries") or self.config.max_retries
+ while retries <= max_retries:
+ try:
+ return self._send(action, args or {}, **options)
+ except exc.UCloudException as e:
+ if e.retryable and retries != max_retries:
+ logging.info(
+ "Retrying {action}: {args}".format(
+ action=action, args=args
+ )
+ )
+ retries += 1
+ continue
+ raise e
+ except Exception as e:
+ raise e
+
+ @property
+ def middleware(self):
+ return self._middleware
+
+ def logged_request_handler(self, req):
+ self.logger.info("[request] {} {}".format(req.get("Action", ""), req))
+ return req
+
+ def logged_response_handler(self, resp):
+ self.logger.info(
+ "[response] {} {}".format(resp.get("Action", ""), resp)
+ )
+ return resp
+
+ @staticmethod
+ def _parse_dict_config(config):
+ return Config.from_dict(config), auth.Credential.from_dict(config)
+
+ def _send(self, action, args, **options):
+ args["Action"] = action
+ for handler in self.middleware.request_handlers:
+ args = handler(args)
+ req = self._build_http_request(args)
+ max_retries = options.get("max_retries") or self.config.max_retries
+ timeout = options.get("timeout") or self.config.timeout
+ resp = self.transport.send(
+ req, timeout=timeout, max_retries=max_retries
+ ).json()
+ for handler in self.middleware.response_handlers:
+ resp = handler(resp)
+ if int(resp.get("RetCode", -1)) != 0:
+ raise exc.RetCodeException(
+ action=req.data.get("Action"),
+ code=int(resp.get("RetCode")),
+ message=resp.get("Message"),
+ )
+ return resp
+
+ def _build_http_request(self, args):
+ config = {
+ "Region": self.config.region,
+ "ProjectId": self.config.project_id,
+ }
+ payload = {k: v for k, v in config.items() if v is not None}
+ payload.update({k: v for k, v in args.items() if v is not None})
+ payload = encoder.encode(payload)
+ payload["Signature"] = self.credential.verify_ac(payload)
+ return Request(
+ url=self.config.base_url,
+ method="post",
+ data=payload,
+ headers={
+ "User-Agent": self._build_user_agent(),
+ "Content-Type": "application/x-www-form-urlencoded",
+ },
+ )
+
+ def _build_user_agent(self):
+ python_version = "{v[0]}.{v[1]}.{v[2]}".format(v=sys.version_info)
+ user_agent = "Python/{python_version} Python-SDK/{sdk_version}".format(
+ python_version=python_version, sdk_version=version.version
+ ) + (self.config.user_agent or "")
+ return user_agent
+
+ def __repr__(self):
+ return '<{}("{}")>'.format(self.__class__.__name__, self.config.region)
diff --git a/ucloud/core/exc/__init__.py b/ucloud/core/exc/__init__.py
index 91c86f3..65bf867 100644
--- a/ucloud/core/exc/__init__.py
+++ b/ucloud/core/exc/__init__.py
@@ -1,15 +1,15 @@
-# -*- coding: utf-8 -*-
-
-from ucloud.core.exc._exc import (
- UCloudException,
- ValidationException,
- RetCodeException,
- RetryTimeoutException,
-)
-
-__all__ = [
- "UCloudException",
- "ValidationException",
- "RetCodeException",
- "RetryTimeoutException",
-]
+# -*- coding: utf-8 -*-
+
+from ucloud.core.exc._exc import (
+ UCloudException,
+ ValidationException,
+ RetCodeException,
+ RetryTimeoutException,
+)
+
+__all__ = [
+ "UCloudException",
+ "ValidationException",
+ "RetCodeException",
+ "RetryTimeoutException",
+]
diff --git a/ucloud/core/exc/_exc.py b/ucloud/core/exc/_exc.py
index d916edd..7c8af49 100644
--- a/ucloud/core/exc/_exc.py
+++ b/ucloud/core/exc/_exc.py
@@ -1,51 +1,55 @@
-# -*- coding: utf-8 -*-
-
-import collections
-from ucloud.core.utils import compact
-
-
-class UCloudException(Exception):
- @property
- def retryable(self):
- return False
-
-
-MAX_COMMON_RET_CODE = 2000
-
-
-class RetCodeException(UCloudException):
- def __init__(self, action, code, message):
- self.action = action
- self.code = code
- self.message = message
-
- @property
- def retryable(self):
- return self.code > MAX_COMMON_RET_CODE
-
- def __str__(self):
- return "{self.action} - {self.code}: {self.message}".format(self=self)
-
- def json(self):
- return {"RetCode": self.code, "Message": self.message, "Action": self.action}
-
-
-class RetryTimeoutException(UCloudException):
- pass
-
-
-class ValidationException(UCloudException):
- def __init__(self, e=None):
- if isinstance(e, compact.string_types):
- self.errors = [e]
- elif isinstance(e, collections.Iterable):
- self.errors = e or []
- else:
- self.errors = [e]
-
- @property
- def retryable(self):
- return False
-
- def __str__(self):
- return str([str(e) for e in self.errors])
+# -*- coding: utf-8 -*-
+
+import collections
+from ucloud.core.utils import compat
+
+
+class UCloudException(Exception):
+ @property
+ def retryable(self):
+ return False
+
+
+MAX_COMMON_RET_CODE = 2000
+
+
+class RetCodeException(UCloudException):
+ def __init__(self, action, code, message):
+ self.action = action
+ self.code = code
+ self.message = message
+
+ @property
+ def retryable(self):
+ return self.code > MAX_COMMON_RET_CODE
+
+ def __str__(self):
+ return "{self.action} - {self.code}: {self.message}".format(self=self)
+
+ def json(self):
+ return {
+ "RetCode": self.code,
+ "Message": self.message or "",
+ "Action": self.action or "",
+ }
+
+
+class RetryTimeoutException(UCloudException):
+ pass
+
+
+class ValidationException(UCloudException):
+ def __init__(self, e=None):
+ if isinstance(e, compat.string_types):
+ self.errors = [e]
+ elif isinstance(e, collections.Iterable):
+ self.errors = e or []
+ else:
+ self.errors = [e]
+
+ @property
+ def retryable(self):
+ return False
+
+ def __str__(self):
+ return str([str(e) for e in self.errors])
diff --git a/ucloud/core/testing/__init__.py b/ucloud/core/testing/__init__.py
deleted file mode 100644
index 4c48b5a..0000000
--- a/ucloud/core/testing/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-# -*- coding: utf-8 -*-
diff --git a/ucloud/core/testing/env.py b/ucloud/core/testing/env.py
deleted file mode 100644
index 5d3df19..0000000
--- a/ucloud/core/testing/env.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import os
-
-ACC_ENV_KEY = "USDK_ACC"
-ACC_SKIP_REASON = "skip test for non-acc environment"
-
-
-def get_skip_reason():
- return ACC_SKIP_REASON
-
-
-def is_acc():
- """ check test env is acceptance testing or not """
- return os.getenv(ACC_ENV_KEY)
-
-
-def is_ut():
- """ check test env is unit testing or not """
- return not is_acc()
-
-
-def pre_check_env():
- """ pre check environment for testing
-
- NOTE: system environment variables credential is required for test environment
- """
- assert os.getenv("UCLOUD_PUBLIC_KEY"), "invalid public key"
- assert os.getenv("UCLOUD_PRIVATE_KEY"), "invalid private key"
- assert os.getenv("UCLOUD_REGION"), "invalid region"
diff --git a/ucloud/core/transport/__init__.py b/ucloud/core/transport/__init__.py
index 8fd22de..0980f2a 100644
--- a/ucloud/core/transport/__init__.py
+++ b/ucloud/core/transport/__init__.py
@@ -1,6 +1,6 @@
-# -*- coding: utf-8 -*-
-
-from ucloud.core.transport.http import Request, Response, Transport
-from ucloud.core.transport._requests import RequestsTransport
-
-__all__ = ["Request", "Response", "Transport", "RequestsTransport"]
+# -*- coding: utf-8 -*-
+
+from ucloud.core.transport.http import Request, Response, Transport
+from ucloud.core.transport._requests import RequestsTransport
+
+__all__ = ["Request", "Response", "Transport", "RequestsTransport"]
diff --git a/ucloud/core/transport/_requests.py b/ucloud/core/transport/_requests.py
index 29d5bf9..bed881e 100644
--- a/ucloud/core/transport/_requests.py
+++ b/ucloud/core/transport/_requests.py
@@ -1,93 +1,97 @@
-# -*- coding: utf-8 -*-
-
-import requests
-from urllib3.util.retry import Retry
-from requests.adapters import HTTPAdapter
-from ucloud.core.transport import http
-from ucloud.core.transport.http import Request, Response
-from ucloud.core.utils.middleware import Middleware
-
-
-class RequestsTransport(http.Transport):
- """ transport is the implementation of http client, use for send a request and return a http response
-
- :type max_retries: int
- :param max_retries: max retries is the max number of transport request when occur http error
- :type backoff_factor: float
- :param backoff_factor: backoff factor will calculate the backoff delay during retrying,
- the backoff delay = {backoff factor} * (2 ^ ({number of total retries} - 1))
- :type status_forcelist: tuple
- :param status_forcelist: the status code list that could be retried
- """
-
- def __init__(
- self, max_retries=3, backoff_factor=0.3, status_forcelist=(500, 502, 504)
- ):
- self.max_retries = max_retries
- self.backoff_factor = backoff_factor
- self.status_forcelist = status_forcelist
- self._adapter = self._load_adapter(max_retries)
- self._middleware = Middleware()
-
- def send(self, req, **options):
- """ send request and return the response
-
- :param req: the full http request descriptor
- :return: the response of http request
- """
- for handler in self.middleware.request_handlers:
- req = handler(req)
- resp = self._send(req, **options)
- for handler in self.middleware.response_handlers:
- resp = handler(resp)
- return resp
-
- @property
- def middleware(self):
- """ the middleware object, see :mod:
-
- :return: the transport middleware
- """
- return self._middleware
-
- def _send(self, req, **options):
- with requests.Session() as session:
- adapter = self._load_adapter(options.get("max_retries"))
- session.mount("http://", adapter=adapter)
- session.mount("https://", adapter=adapter)
- session_resp = session.request(
- method=req.method.upper(),
- url=req.url,
- json=req.json,
- data=req.data,
- params=req.params,
- headers=req.headers,
- )
- resp = self.convert_response(session_resp)
- resp.request = req
- return resp
-
- def _load_adapter(self, max_retries=None):
- if max_retries is None and self._adapter is not None:
- return self._adapter
- max_retries = max_retries or 0
- adapter = HTTPAdapter()
- adapter.max_retries = Retry(
- total=max_retries,
- read=max_retries,
- connect=max_retries,
- backoff_factor=self.backoff_factor,
- status_forcelist=self.status_forcelist,
- )
- return adapter
-
- @staticmethod
- def convert_response(r):
- return Response(
- url=r.url,
- method=r.request.method,
- status_code=r.status_code,
- reason=r.reason,
- headers=r.headers,
- content=r.content,
- )
+# -*- coding: utf-8 -*-
+
+import requests
+from urllib3.util.retry import Retry
+from requests.adapters import HTTPAdapter
+from ucloud.core.transport import http
+from ucloud.core.transport.http import Request, Response
+from ucloud.core.utils.middleware import Middleware
+
+
+class RequestsTransport(http.Transport):
+ """ transport is the implementation of http client, use for send a request and return a http response
+
+ :type max_retries: int
+ :param max_retries: max retries is the max number of transport request when occur http error
+ :type backoff_factor: float
+ :param backoff_factor: backoff factor will calculate the backoff delay during retrying,
+ the backoff delay = {backoff factor} * (2 ^ ({number of total retries} - 1))
+ :type status_forcelist: tuple
+ :param status_forcelist: the status code list that could be retried
+ """
+
+ def __init__(
+ self,
+ max_retries=3,
+ backoff_factor=0.3,
+ status_forcelist=(500, 502, 504),
+ ):
+ self.max_retries = max_retries
+ self.backoff_factor = backoff_factor
+ self.status_forcelist = status_forcelist
+ self._adapter = self._load_adapter(max_retries)
+ self._middleware = Middleware()
+
+ def send(self, req, **options):
+ """ send request and return the response
+
+ :param req: the full http request descriptor
+ :return: the response of http request
+ """
+ for handler in self.middleware.request_handlers:
+ req = handler(req)
+ resp = self._send(req, **options)
+ for handler in self.middleware.response_handlers:
+ resp = handler(resp)
+ return resp
+
+ @property
+ def middleware(self):
+ """ the middleware object, see :mod:
+
+ :return: the transport middleware
+ """
+ return self._middleware
+
+ def _send(self, req, **options):
+ with requests.Session() as session:
+ adapter = self._load_adapter(options.get("max_retries"))
+ session.mount("http://", adapter=adapter)
+ session.mount("https://", adapter=adapter)
+ session_resp = session.request(
+ method=req.method.upper(),
+ url=req.url,
+ json=req.json,
+ data=req.data,
+ params=req.params,
+ headers=req.headers,
+ )
+ resp = self.convert_response(session_resp)
+ resp.request = req
+ return resp
+
+ def _load_adapter(self, max_retries=None):
+ if max_retries is None and self._adapter is not None:
+ return self._adapter
+ max_retries = max_retries or 0
+ adapter = HTTPAdapter()
+ adapter.max_retries = Retry(
+ total=max_retries,
+ read=max_retries,
+ connect=max_retries,
+ backoff_factor=self.backoff_factor,
+ status_forcelist=self.status_forcelist,
+ )
+ return adapter
+
+ @staticmethod
+ def convert_response(r):
+ return Response(
+ url=r.url,
+ method=r.request.method,
+ status_code=r.status_code,
+ reason=r.reason,
+ headers=r.headers,
+ content=r.content,
+ encoding=r.encoding or r.apparent_encoding,
+ )
diff --git a/ucloud/core/transport/http.py b/ucloud/core/transport/http.py
index a1fccb9..d6d3182 100644
--- a/ucloud/core/transport/http.py
+++ b/ucloud/core/transport/http.py
@@ -1,56 +1,89 @@
-# -*- coding: utf-8 -*-
-
-import logging
-import json as json_mod
-
-logger = logging.getLogger(__name__)
-
-
-class Request(object):
- def __init__(
- self,
- url,
- method="GET",
- params=None,
- data=None,
- json=None,
- headers=None,
- **kwargs
- ):
- self.url = url
- self.method = method
- self.params = params
- self.data = data
- self.json = json
- self.headers = headers
-
-
-class Response(object):
- def __init__(
- self,
- url,
- method,
- request=None,
- status_code=None,
- reason=None,
- headers=None,
- content=None,
- **kwargs
- ):
- self.url = url
- self.method = method
- self.request = request
- self.status_code = status_code
- self.reason = reason
- self.headers = headers
- self.content = content
-
- def json(self):
- return json_mod.loads(self.content)
-
-
-class Transport(object):
- """ the abstract class of transport implementation """
-
- def send(self, req, **options):
- raise NotImplementedError
+# -*- coding: utf-8 -*-
+
+import logging
+import json as json_mod
+from ucloud.core.transport import utils
+from ucloud.core.utils.compat import str
+
+logger = logging.getLogger(__name__)
+
+
+class Request(object):
+ def __init__(
+ self,
+ url,
+ method="GET",
+ params=None,
+ data=None,
+ json=None,
+ headers=None,
+ **kwargs
+ ):
+ self.url = url
+ self.method = method
+ self.params = params
+ self.data = data
+ self.json = json
+ self.headers = headers
+
+ def payload(self):
+ payload = (self.params or {}).copy()
+ payload.update(self.data or {})
+ payload.update(self.json or {})
+ return payload
+
+
+class Response(object):
+ def __init__(
+ self,
+ url,
+ method,
+ request=None,
+ status_code=None,
+ reason=None,
+ headers=None,
+ content=None,
+ encoding=None,
+ **kwargs
+ ):
+ self.url = url
+ self.method = method
+ self.request = request
+ self.status_code = status_code
+ self.reason = reason
+ self.headers = headers
+ self.content = content
+ self.encoding = encoding
+
+ def json(self, **kwargs):
+ """ json will return the bytes of content
+ """
+ if not self.content:
+ return None
+ encoding = utils.guess_json_utf(self.content)
+ if encoding is not None:
+ try:
+ return json_mod.loads(self.content.decode(encoding), **kwargs)
+ except UnicodeDecodeError:
+ pass
+ return json_mod.loads(self.text, **kwargs)
+
+ @property
+ def text(self):
+ """ text will return the unicode string of content,
+ see `requests.Response.text`
+ """
+ if not self.content:
+ return str("")
+ try:
+ content = str(self.content, self.encoding, errors="replace")
+ except (LookupError, TypeError):
+ content = str(self.content, errors="replace")
+ return content
+
+
+class Transport(object):
+ """ the abstract class of transport implementation """
+
+ def send(self, req, **options):
+ raise NotImplementedError
diff --git a/ucloud/core/transport/utils.py b/ucloud/core/transport/utils.py
new file mode 100644
index 0000000..a538bc9
--- /dev/null
+++ b/ucloud/core/transport/utils.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+import codecs
+
+_null = "\x00".encode("ascii")
+_null2 = _null * 2
+_null3 = _null * 3
+
+
+def guess_json_utf(data):
+ """ guess_json_utf will detect the encoding of bytes,
+ see `requests.utils.guess_json_utf`
+
+ :rtype: str
+ """
+ sample = data[:4]
+ if sample in (codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE):
+ return "utf-32"
+ if sample[:3] == codecs.BOM_UTF8:
+ return "utf-8-sig"
+ if sample[:2] in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE):
+ return "utf-16"
+ nullcount = sample.count(_null)
+ if nullcount == 0:
+ return "utf-8"
+ if nullcount == 2:
+ if sample[::2] == _null2:
+ return "utf-16-be"
+ if sample[1::2] == _null2:
+ return "utf-16-le"
+ if nullcount == 3:
+ if sample[:3] == _null3:
+ return "utf-32-be"
+ if sample[1:] == _null3:
+ return "utf-32-le"
+ return None
diff --git a/ucloud/core/typesystem/__init__.py b/ucloud/core/typesystem/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/core/typesystem/__init__.py
+++ b/ucloud/core/typesystem/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/core/typesystem/abstract.py b/ucloud/core/typesystem/abstract.py
index d2eec8d..7d36ada 100644
--- a/ucloud/core/typesystem/abstract.py
+++ b/ucloud/core/typesystem/abstract.py
@@ -1,65 +1,60 @@
-# -*- coding: utf-8 -*-
-
-from ucloud.core import exc
-
-
-class Field(object):
- def __init__(
- self,
- required=False,
- default=None,
- dump_to=None,
- load_from=None,
- strict=None,
- **kwargs
- ):
- self.required = required
- self.default = default
- self.dump_to = dump_to
- self.load_from = load_from
- self.options = kwargs
- self.strict = bool(strict)
-
- def dumps(self, value, **kwargs):
- raise NotImplementedError
-
- def loads(self, value, **kwargs):
- raise NotImplementedError
-
- @staticmethod
- def fail(name, expected, got):
- msg = "invalid field {}, expect {}, got {}".format(name, expected, got)
- raise exc.ValidationException(msg)
-
-
-class Schema(object):
- fields = {}
-
- def __init__(
- self,
- required=False,
- default=dict,
- dump_to=None,
- load_from=None,
- strict=False,
- case_sensitive=False,
- **kwargs
- ):
- self.required = required
- self.default = default
- self.dump_to = dump_to
- self.load_from = load_from
- self.options = kwargs
- self.strict = strict
- self.case_sensitive = case_sensitive
-
- def dumps(self, d):
- raise NotImplementedError
-
- def loads(self, d):
- raise NotImplementedError
-
- @staticmethod
- def fail(name, expected, got):
- msg = "invalid schema {}, expect {}, got {}".format(name, expected, got)
- raise exc.ValidationException(msg)
+# -*- coding: utf-8 -*-
+
+from ucloud.core import exc
+
+
+class Field(object):
+ def __init__(
+ self,
+ required=False,
+ default=None,
+ dump_to=None,
+ load_from=None,
+ strict=None,
+ **kwargs
+ ):
+ self.required = required
+ self.default = default
+ self.dump_to = dump_to
+ self.load_from = load_from
+ self.options = kwargs
+ self.strict = bool(strict)
+
+ def dumps(self, value, **kwargs):
+ raise NotImplementedError
+
+ def loads(self, value, **kwargs):
+ raise NotImplementedError
+
+ @staticmethod
+ def fail(name, expected, got):
+ msg = "invalid field {}, expect {}, got {}".format(name, expected, got)
+ raise exc.ValidationException(msg)
+
+
+class Schema(object):
+ fields = {}
+
+ def __init__(
+ self,
+ required=False,
+ default=dict,
+ dump_to=None,
+ load_from=None,
+ strict=False,
+ case_sensitive=False,
+ **kwargs
+ ):
+ self.required = required
+ self.default = default
+ self.dump_to = dump_to
+ self.load_from = load_from
+ self.options = kwargs
+ self.strict = strict
+ self.case_sensitive = case_sensitive
+
+ def dumps(self, d):
+ raise NotImplementedError
+
+ def loads(self, d):
+ raise NotImplementedError
diff --git a/ucloud/core/typesystem/encoder.py b/ucloud/core/typesystem/encoder.py
new file mode 100644
index 0000000..1962f09
--- /dev/null
+++ b/ucloud/core/typesystem/encoder.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+
+def encode(d):
+ result = {}
+ for k, v in d.items():
+ if isinstance(v, dict):
+ for ek, ev in encode(v).items():
+ result["{}.{}".format(k, ek)] = encode_value(ev)
+ elif isinstance(v, list):
+ for i, item in enumerate(v):
+ if isinstance(item, dict):
+ for ek, ev in encode(item).items():
+ result["{}.{}.{}".format(k, i, ek)] = encode_value(ev)
+ else:
+ result["{}.{}".format(k, i)] = encode_value(item)
+ else:
+ result[k] = encode_value(v)
+ return result
+
+
+def encode_value(v):
+ if isinstance(v, bool):
+ return "true" if v else "false"
+ if isinstance(v, float):
+ return str(int(v)) if v % 1 == 0 else str(v)
+ return str(v)
diff --git a/ucloud/core/typesystem/fields.py b/ucloud/core/typesystem/fields.py
index 71b1fde..9398cf2 100644
--- a/ucloud/core/typesystem/fields.py
+++ b/ucloud/core/typesystem/fields.py
@@ -4,6 +4,7 @@
import collections
from ucloud.core.typesystem import abstract
from ucloud.core.exc import ValidationException
+from ucloud.core.utils.compat import str
class List(abstract.Field):
@@ -21,7 +22,9 @@ def __init__(self, item, default=list, **kwargs):
def dumps(self, value, name=None, **kwargs):
if not isinstance(value, collections.Iterable):
raise ValidationException(
- "invalid field {}, expect list, got {}".format(name, type(value))
+ "invalid field {}, expect list, got {}".format(
+ name, type(value)
+ )
)
errors = []
values = []
@@ -39,7 +42,9 @@ def dumps(self, value, name=None, **kwargs):
def loads(self, value, name=None, **kwargs):
if not isinstance(value, collections.Iterable):
raise ValidationException(
- "invalid field {}, expect list, got {}".format(name, type(value))
+ "invalid field {}, expect list, got {}".format(
+ name, type(value)
+ )
)
errors = []
values = []
@@ -65,10 +70,7 @@ def loads(self, value, name=None, **kwargs):
def _convert(self, value, name=None):
if self.strict and not isinstance(value, str):
self.fail(name, "str", type(value))
- try:
- return unicode(value)
- except ValueError:
- self.fail(name, "str", type(value))
+ return str(value)
class Base64(Str):
@@ -123,7 +125,8 @@ def loads(self, value, name=None, **kwargs):
def _convert(self, value, name=None):
if self.strict and not isinstance(value, bool):
self.fail(name, "bool", type(value))
- try:
- return bool(value)
- except ValueError:
- self.fail(name, "bool", type(value))
+ if value == "true" or value is True:
+ return True
+ if value == "false" or value is False:
+ return False
+ self.fail(name, "bool", type(value))
diff --git a/ucloud/core/typesystem/schema.py b/ucloud/core/typesystem/schema.py
index d3f3c99..1400291 100644
--- a/ucloud/core/typesystem/schema.py
+++ b/ucloud/core/typesystem/schema.py
@@ -1,117 +1,82 @@
-# -*- coding: utf-8 -*-
-
-import logging
-from ucloud.core.typesystem import abstract, fields
-from ucloud.core.exc import ValidationException
-from ucloud.core.utils import compact
-
-logger = logging.getLogger(__name__)
-
-
-class Schema(abstract.Schema):
- fields = {}
-
- def dumps(self, d, name=None, **kwargs):
- result = {}
- errors = []
- for k, field in self.fields.items():
- v = d.get(k)
- if v is None:
- if field.required:
- errors.append(
- ValidationException("the field {k} is required".format(k=k))
- )
- continue
- if field.default is None:
- continue
- if isinstance(field.default, compact.Callable):
- v = field.default()
- else:
- v = field.default
- try:
- serialized = field.dumps(v, name=k)
- except ValidationException as e:
- errors.extend(e.errors)
- continue
- result[field.dump_to or k] = serialized
- if len(errors) > 0:
- raise ValidationException(errors)
- return result
-
- def loads(self, d, name=None, **kwargs):
- result = {}
- errors = []
- if not self.case_sensitive:
- d = {k.lower(): v for k, v in d.items()}
- for k, field in self.fields.items():
- load_key = field.load_from or k
- v = d.get(load_key if self.case_sensitive else load_key.lower())
- if v is None:
- if field.default is None:
- continue
- if isinstance(field.default, compact.Callable):
- v = field.default()
- else:
- v = field.default
- try:
- serialized = field.loads(v, name=k)
- except ValidationException as e:
- errors.extend(e.errors)
- continue
- result[k] = serialized
- if len(errors) > 0:
- raise ValidationException(errors)
- return result
-
-
-class RequestSchema(Schema):
- fields = {}
-
- def dumps(self, d, name=None, **kwargs):
- if not isinstance(d, dict):
- raise ValidationException(
- "invalid field {}, expect dict, got {}".format(name, type(d))
- )
- result = {}
- errors = []
- for k, field in self.fields.items():
- v = d.get(k)
- if v is None:
- if field.required:
- errors.append(
- ValidationException("the field {k} is required".format(k=k))
- )
- continue
- if field.default is None:
- continue
- if isinstance(field.default, compact.Callable):
- v = field.default()
- else:
- v = field.default
- try:
- serialized = field.dumps(v, name=k)
- except ValidationException as e:
- errors.extend(e.errors)
- continue
- k = field.dump_to or k
- if isinstance(field, fields.List):
- for i, item in enumerate(serialized):
- if not isinstance(field.item, RequestSchema):
- result["{k}.{i}".format(k=k, i=i)] = item
- continue
- for item_k, item_v in item.items():
- result[
- "{k}.{i}.{item_k}".format(k=k, i=i, item_k=item_k)
- ] = item_v
- elif isinstance(field, RequestSchema):
- for dk, dv in serialized.items():
- result["{k}.{dk}".format(k=k, dk=dk)] = dv
- else:
- result[k] = serialized
- if len(errors) > 0:
- raise ValidationException(errors)
- return result
-
-
-class ResponseSchema(Schema):
- pass
+# -*- coding: utf-8 -*-
+
+import logging
+from ucloud.core.typesystem import abstract
+from ucloud.core.exc import ValidationException
+from ucloud.core.utils import compat
+
+logger = logging.getLogger(__name__)
+
+
+class Schema(abstract.Schema):
+ fields = {}
+
+ def dumps(self, d, name=None, **kwargs):
+ result = {}
+ errors = []
+ for k, field in self.fields.items():
+ v = d.get(k)
+ if v is None:
+ if field.required:
+ errors.append(
+ ValidationException(
+ "the field {k} is required".format(k=k)
+ )
+ )
+ continue
+ if field.default is None:
+ continue
+ if isinstance(field.default, compat.Callable):
+ v = field.default()
+ else:
+ v = field.default
+ try:
+ serialized = field.dumps(v, name=k)
+ except ValidationException as e:
+ errors.extend(e.errors)
+ continue
+ result[field.dump_to or k] = serialized
+ if len(errors) > 0:
+ raise ValidationException(errors)
+ return result
+
+ def loads(self, d, name=None, **kwargs):
+ result = {}
+ errors = []
+ if not self.case_sensitive:
+ d = {k.lower(): v for k, v in d.items()}
+ for k, field in self.fields.items():
+ load_key = field.load_from or k
+ v = d.get(load_key if self.case_sensitive else load_key.lower())
+ if v is None:
+ if field.default is None:
+ continue
+ if isinstance(field.default, compat.Callable):
+ v = field.default()
+ else:
+ v = field.default
+ try:
+ serialized = field.loads(v, name=k)
+ except ValidationException as e:
+ errors.extend(e.errors)
+ continue
+ result[k] = serialized
+ if len(errors) > 0:
+ raise ValidationException(errors)
+ return result
+
+
+class RequestSchema(Schema):
+ fields = {}
+
+ def dumps(self, d, name=None, **kwargs):
+ if not isinstance(d, dict):
+ raise ValidationException(
+ "invalid field {}, expect dict, got {}".format(name, type(d))
+ )
+ result = super(RequestSchema, self).dumps(d, name=name, **kwargs)
+ return result
+
+
+class ResponseSchema(Schema):
+ pass
diff --git a/ucloud/core/utils/__init__.py b/ucloud/core/utils/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/core/utils/__init__.py
+++ b/ucloud/core/utils/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/core/utils/compact.py b/ucloud/core/utils/compat.py
similarity index 88%
rename from ucloud/core/utils/compact.py
rename to ucloud/core/utils/compat.py
index 31b33e4..33e9dbc 100644
--- a/ucloud/core/utils/compact.py
+++ b/ucloud/core/utils/compat.py
@@ -1,13 +1,15 @@
-# -*- coding: utf-8 -*-
-
-import sys
-
-PY3 = sys.version_info[0] == 3
-if PY3:
- string_types = (str,)
- from collections.abc import Callable
-else:
- import types
-
- string_types = types.StringTypes
- from collections import Callable
+# -*- coding: utf-8 -*-
+
+import sys
+
+PY3 = sys.version_info[0] == 3
+if PY3:
+ str = str
+ string_types = (str,)
+ from collections.abc import Callable
+else:
+ import types
+
+ str = unicode
+ string_types = types.StringTypes
+ from collections import Callable
diff --git a/ucloud/core/utils/log.py b/ucloud/core/utils/log.py
index 1dbd6ef..402758c 100644
--- a/ucloud/core/utils/log.py
+++ b/ucloud/core/utils/log.py
@@ -1,22 +1,22 @@
-# -*- coding: utf-8 -*-
-
-import logging
-
-DEFAULT_LOGGER_NAME = "ucloud"
-DEFAULT_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
-DEFAULT_LEVEL = logging.INFO
-
-
-def init_default_logger():
- logger = logging.getLogger(DEFAULT_LOGGER_NAME)
- logger.setLevel(DEFAULT_LEVEL)
- ch = logging.StreamHandler()
- ch.setLevel(DEFAULT_LEVEL)
- formatter = logging.Formatter(DEFAULT_FORMAT)
- ch.setFormatter(formatter)
- logger.removeHandler(ch)
- logger.addHandler(ch)
- return logger
-
-
-default_logger = init_default_logger()
+# -*- coding: utf-8 -*-
+
+import logging
+
+DEFAULT_LOGGER_NAME = "ucloud"
+DEFAULT_FORMAT = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s %(name)s)"
+DEFAULT_LEVEL = logging.INFO
+
+
+def init_default_logger():
+ logger = logging.getLogger(DEFAULT_LOGGER_NAME)
+ logger.setLevel(DEFAULT_LEVEL)
+ ch = logging.StreamHandler()
+ ch.setLevel(DEFAULT_LEVEL)
+ formatter = logging.Formatter(DEFAULT_FORMAT)
+ ch.setFormatter(formatter)
+ logger.removeHandler(ch)
+ logger.addHandler(ch)
+ return logger
+
+
+default_logger = init_default_logger()
diff --git a/ucloud/core/utils/middleware.py b/ucloud/core/utils/middleware.py
index 73e574f..9cfa8e1 100644
--- a/ucloud/core/utils/middleware.py
+++ b/ucloud/core/utils/middleware.py
@@ -1,53 +1,53 @@
-# -*- coding: utf-8 -*-
-
-
-class Middleware(object):
- """ middleware is the object to store request/response handlers
-
- >>> middleware = Middleware()
-
- Add a request handler to prepare the request
-
- >>> @middleware.request
- ... def prepare(req):
- ... req['Region'] = 'cn-bj2'
- ... return req
-
- Add a response handler to log the response detail
-
- >>> @middleware.response
- ... def logged(resp):
- ... print(resp)
- ... return resp
-
- >>> len(middleware.request_handlers), len(middleware.response_handlers)
- (1, 1)
- """
-
- def __init__(self):
- self.request_handlers = []
- self.response_handlers = []
-
- def request(self, handler, index=-1):
- """ request is the request handler register to add request handler.
-
- :param handler: request handler function, receive request object
- and return a new request
- :param int index: the position of request in the handler list,
- default is append it to end
- :return:
- """
- self.request_handlers.insert(index, handler)
- return handler
-
- def response(self, handler, index=-1):
- """ response is the response handler register to add response handler.
-
- :param handler: response handler function, receive response object
- and return a new response
- :param int index: the position of response in the handler list,
- default is append it to end
- :return:
- """
- self.response_handlers.insert(index, handler)
- return handler
+# -*- coding: utf-8 -*-
+
+
+class Middleware(object):
+ """ middleware is the object to store request/response handlers
+
+ >>> middleware = Middleware()
+
+ Add a request handler to prepare the request
+
+ >>> @middleware.request
+ ... def prepare(req):
+ ... req['Region'] = 'cn-bj2'
+ ... return req
+
+ Add a response handler to log the response detail
+
+ >>> @middleware.response
+ ... def logged(resp):
+ ... print(resp)
+ ... return resp
+
+ >>> len(middleware.request_handlers), len(middleware.response_handlers)
+ (1, 1)
+ """
+
+ def __init__(self):
+ self.request_handlers = []
+ self.response_handlers = []
+
+ def request(self, handler, index=-1):
+ """ request is the request handler register to add request handler.
+
+ :param handler: request handler function, receive request object
+ and return a new request
+ :param int index: the position of request in the handler list,
+ default is append it to end
+ :return:
+ """
+ self.request_handlers.insert(index, handler)
+ return handler
+
+ def response(self, handler, index=-1):
+ """ response is the response handler register to add response handler.
+
+ :param handler: response handler function, receive response object
+ and return a new response
+ :param int index: the position of response in the handler list,
+ default is append it to end
+ :return:
+ """
+ self.response_handlers.insert(index, handler)
+ return handler
diff --git a/ucloud/helpers/__init__.py b/ucloud/helpers/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/helpers/__init__.py
+++ b/ucloud/helpers/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/helpers/utils.py b/ucloud/helpers/utils.py
index 34ef18c..337e5e6 100644
--- a/ucloud/helpers/utils.py
+++ b/ucloud/helpers/utils.py
@@ -1,86 +1,86 @@
-# -*- coding: utf-8 -*-
-
-import random
-import base64
-
-_lowercase = "abcdefghijklmnopqrstuvwxyz"
-_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-_numbers = "0123456789"
-_specials = "_"
-
-
-def gen_password(
- n,
- lower_letters=_lowercase,
- upper_letters=_uppercase,
- number_letters=_numbers,
- special_letters=_specials,
- min_lower=1,
- min_upper=1,
- min_number=1,
- min_specials=1,
-):
- """ generate password for any resource
-
- >>> len(gen_password(20))
- 20
-
- :param int n: password total length
- :param str lower_letters: all lowercase letters
- :param str upper_letters: all uppercase letters
- :param str number_letters: all number letters
- :param str special_letters: all special letters
- :param int min_lower: minimal number of lowercase letters
- :param int min_upper: minimal number of uppercase letters
- :param int min_number: minimal number of number letters
- :param int min_specials: minimal number of special letters
- :return:
- """
- all_letters = "".join(
- [lower_letters, upper_letters, number_letters, special_letters]
- )
- minimal_total = min_lower + min_upper + min_number + min_specials
- if n < minimal_total:
- raise ValueError(
- "the length of password must be larger than total minimal letters number"
- )
- minimal_letters = "".join(
- [
- gen_string(lower_letters, min_lower),
- gen_string(upper_letters, min_upper),
- gen_string(number_letters, min_number),
- gen_string(special_letters, min_specials),
- ]
- )
- additional_letters = random.sample(all_letters, n - minimal_total)
- results = list(minimal_letters) + additional_letters
- random.shuffle(results)
- return "".join(results)
-
-
-def gen_string(letters, length):
- return "".join([random.choice(letters) for i in range(length)])
-
-
-def first(l):
- if len(l) == 0:
- return None
- return l[0]
-
-
-def b64encode(s):
- """ base64 encode
-
- :param str s: input string
- :return: base64 string
- """
- return base64.b64encode(s.encode()).decode()
-
-
-def b64decode(s):
- """ base64 decode
-
- :param str s: base64 string
- :return: output string
- """
- return base64.b64decode(s.encode()).decode()
+# -*- coding: utf-8 -*-
+
+import random
+import base64
+
+_lowercase = "abcdefghijklmnopqrstuvwxyz"
+_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+_numbers = "0123456789"
+_specials = "_"
+
+
+def gen_password(
+ n,
+ lower_letters=_lowercase,
+ upper_letters=_uppercase,
+ number_letters=_numbers,
+ special_letters=_specials,
+ min_lower=1,
+ min_upper=1,
+ min_number=1,
+ min_specials=1,
+):
+ """ generate password for any resource
+
+ >>> len(gen_password(20))
+ 20
+
+ :param int n: password total length
+ :param str lower_letters: all lowercase letters
+ :param str upper_letters: all uppercase letters
+ :param str number_letters: all number letters
+ :param str special_letters: all special letters
+ :param int min_lower: minimal number of lowercase letters
+ :param int min_upper: minimal number of uppercase letters
+ :param int min_number: minimal number of number letters
+ :param int min_specials: minimal number of special letters
+ :return:
+ """
+ all_letters = "".join(
+ [lower_letters, upper_letters, number_letters, special_letters]
+ )
+ minimal_total = min_lower + min_upper + min_number + min_specials
+ if n < minimal_total:
+ raise ValueError(
+ "the length of password must be larger than total minimal letters number"
+ )
+ minimal_letters = "".join(
+ [
+ gen_string(lower_letters, min_lower),
+ gen_string(upper_letters, min_upper),
+ gen_string(number_letters, min_number),
+ gen_string(special_letters, min_specials),
+ ]
+ )
+ additional_letters = random.sample(all_letters, n - minimal_total)
+ results = list(minimal_letters) + additional_letters
+ random.shuffle(results)
+ return "".join(results)
+
+
+def gen_string(letters, length):
+ return "".join([random.choice(letters) for i in range(length)])
+
+
+def first(l):
+ if len(l) == 0:
+ return None
+ return l[0]
+
+
+def b64encode(s):
+ """ base64 encode
+
+ :param str s: input string
+ :return: base64 string
+ """
+ return base64.b64encode(s.encode()).decode()
+
+
+def b64decode(s):
+ """ base64 decode
+
+ :param str s: base64 string
+ :return: output string
+ """
+ return base64.b64decode(s.encode()).decode()
diff --git a/ucloud/helpers/wait.py b/ucloud/helpers/wait.py
index 9ce0148..a10d3b5 100644
--- a/ucloud/helpers/wait.py
+++ b/ucloud/helpers/wait.py
@@ -1,100 +1,100 @@
-# -*- coding: utf-8 -*-
-
-import time
-import logging
-from ucloud.core import exc
-
-MAX_BACKOFF_INTERVAL = 10
-logger = logging.getLogger(__name__)
-
-
-class WaitTimeoutException(exc.UCloudException):
- pass
-
-
-class StateConf(object):
- """ StateConf is the utilities class to wait the state return by refresh function achieve the specific state,
- the generally usage is wait the cloud resource, such as uhost, udb ... is
- ready after created.
- """
-
- def __init__(
- self,
- pending,
- target,
- refresh,
- timeout,
- startup_delay=0,
- min_backoff_interval=0.1,
- max_backoff_interval=MAX_BACKOFF_INTERVAL,
- ):
- self.pending = pending
- self.target = target
- self.refresh = refresh
- self.timeout = timeout
- self.startup_delay = startup_delay
- self.min_backoff_interval = min_backoff_interval
- self.max_backoff_interval = max_backoff_interval
-
- def wait(self):
- start_time = time.time()
- interval = self.min_backoff_interval
- time.sleep(self.startup_delay)
- while time.time() - start_time < self.timeout:
- state = self.refresh()
- if state in self.pending:
- time.sleep(interval)
- interval *= 2
- if interval > self.max_backoff_interval:
- interval = self.max_backoff_interval
- logger.info(
- "waiting state for {self.refresh}, got state {state}".format(
- self=self, state=state
- )
- )
- continue
- if state in self.target:
- return
- raise WaitTimeoutException(
- "wait timeout {self.timeout}s for {self.refresh}".format(self=self)
- )
-
-
-def wait_for_state(
- pending,
- target,
- refresh,
- timeout,
- startup_delay=0,
- min_backoff_interval=0.1,
- max_backoff_interval=MAX_BACKOFF_INTERVAL,
-):
- """ wait_for_state is a utilities function to wait the state return by refresh function achieve the specific state,
- the generally usage is wait the cloud resource, such as uhost, udb ... is
- ready after created.
-
- >>> wait_for_state(
- ... pending=["pending"],
- ... target=["running"],
- ... refresh=lambda: "running",
- ... timeout=0.5,
- ... )
-
- :param pending: pending is the list of pending state, the state is returned by refresh function
- :param target: target is the list of target state, it is usually the terminate state, eg. running and fail
- :param refresh: the customized refresh function, expect no arguments and return a state
- :param timeout: timeout is the total time to wait state is achieved
- :param startup_delay: the time to wait before first refresh function is called
- :param min_backoff_interval: the backoff time for first refresh interval
- :param max_backoff_interval: the max backoff time for refresh interval
- """
- conf = StateConf(
- pending=pending,
- target=target,
- refresh=refresh,
- timeout=timeout,
- startup_delay=startup_delay,
- min_backoff_interval=min_backoff_interval,
- max_backoff_interval=max_backoff_interval,
- )
- return conf.wait()
+# -*- coding: utf-8 -*-
+
+import time
+import logging
+from ucloud.core import exc
+
+MAX_BACKOFF_INTERVAL = 10
+logger = logging.getLogger(__name__)
+
+
+class WaitTimeoutException(exc.UCloudException):
+ pass
+
+
+class StateConf(object):
+ """ StateConf is the utilities class to wait the state return by refresh function achieve the specific state,
+ the generally usage is wait the cloud resource, such as uhost, udb ... is
+ ready after created.
+ """
+
+ def __init__(
+ self,
+ pending,
+ target,
+ refresh,
+ timeout,
+ startup_delay=0,
+ min_backoff_interval=0.1,
+ max_backoff_interval=MAX_BACKOFF_INTERVAL,
+ ):
+ self.pending = pending
+ self.target = target
+ self.refresh = refresh
+ self.timeout = timeout
+ self.startup_delay = startup_delay
+ self.min_backoff_interval = min_backoff_interval
+ self.max_backoff_interval = max_backoff_interval
+
+ def wait(self):
+ start_time = time.time()
+ interval = self.min_backoff_interval
+ time.sleep(self.startup_delay)
+ while time.time() - start_time < self.timeout:
+ state = self.refresh()
+ if state in self.pending:
+ time.sleep(interval)
+ interval *= 2
+ if interval > self.max_backoff_interval:
+ interval = self.max_backoff_interval
+ logger.info(
+ "waiting state for {self.refresh}, got state {state}".format(
+ self=self, state=state
+ )
+ )
+ continue
+ if state in self.target:
+ return
+ raise WaitTimeoutException(
+ "wait timeout {self.timeout}s for {self.refresh}".format(self=self)
+ )
+
+
+def wait_for_state(
+ pending,
+ target,
+ refresh,
+ timeout,
+ startup_delay=0,
+ min_backoff_interval=0.1,
+ max_backoff_interval=MAX_BACKOFF_INTERVAL,
+):
+ """ wait_for_state is a utilities function to wait the state return by refresh function achieve the specific state,
+ the generally usage is wait the cloud resource, such as uhost, udb ... is
+ ready after created.
+
+ >>> wait_for_state(
+ ... pending=["pending"],
+ ... target=["running"],
+ ... refresh=lambda: "running",
+ ... timeout=0.5,
+ ... )
+
+ :param pending: pending is the list of pending state, the state is returned by refresh function
+ :param target: target is the list of target state, it is usually the terminate state, eg. running and fail
+ :param refresh: the customized refresh function, expect no arguments and return a state
+ :param timeout: timeout is the total time to wait state is achieved
+ :param startup_delay: the time to wait before first refresh function is called
+ :param min_backoff_interval: the backoff time for first refresh interval
+ :param max_backoff_interval: the max backoff time for refresh interval
+ """
+ conf = StateConf(
+ pending=pending,
+ target=target,
+ refresh=refresh,
+ timeout=timeout,
+ startup_delay=startup_delay,
+ min_backoff_interval=min_backoff_interval,
+ max_backoff_interval=max_backoff_interval,
+ )
+ return conf.wait()
diff --git a/ucloud/services/__init__.py b/ucloud/services/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/services/__init__.py
+++ b/ucloud/services/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/services/pathx/__init__.py b/ucloud/services/pathx/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/services/pathx/__init__.py
+++ b/ucloud/services/pathx/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/services/pathx/client.py b/ucloud/services/pathx/client.py
index 010c09e..f279007 100644
--- a/ucloud/services/pathx/client.py
+++ b/ucloud/services/pathx/client.py
@@ -1,159 +1,159 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.client import Client
-from ucloud.services.pathx.schemas import apis
-
-
-class PathXClient(Client):
- def __init__(self, config, transport=None, middleware=None, logger=None):
- super(PathXClient, self).__init__(config, transport, middleware, logger)
-
- def create_global_ssh_instance(self, req=None, **kwargs):
- """ CreateGlobalSSHInstance - 创建GlobalSSH实例
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
- - **Area** (str) - (Required) 填写支持SSH访问IP的地区名称,如“洛杉矶”,“新加坡”,“香港”,“东京”,“华盛顿”,“法兰克福”。Area和AreaCode两者必填一个
- - **AreaCode** (str) - (Required) AreaCode, 区域航空港国际通用代码。Area和AreaCode两者必填一个
- - **Port** (int) - (Required) SSH端口,1-65535且不能使用80,443端口
- - **TargetIP** (str) - (Required) 被SSH访问的IP
- - **ChargeType** (str) - 支付方式,如按月、按年、按时
- - **CouponId** (str) - 使用代金券可冲抵部分费用
- - **Quantity** (int) - 购买数量
- - **Remark** (str) - 备注信息
-
- **Response**
-
- - **AcceleratingDomain** (str) - 加速域名,访问该域名可就近接入
- - **InstanceId** (str) - 实例ID,资源唯一标识
- - **Message** (str) - 提示信息
-
- """
- d = {"ProjectId": self.config.project_id}
- req and d.update(req)
- d = apis.CreateGlobalSSHInstanceRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("CreateGlobalSSHInstance", d, **kwargs)
- return apis.CreateGlobalSSHInstanceResponseSchema().loads(resp)
-
- def delete_global_ssh_instance(self, req=None, **kwargs):
- """ DeleteGlobalSSHInstance - 删除GlobalSSH实例
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
- - **InstanceId** (str) - (Required) 实例Id,资源的唯一标识
-
- **Response**
-
- - **Message** (str) - 提示信息
-
- """
- d = {"ProjectId": self.config.project_id}
- req and d.update(req)
- d = apis.DeleteGlobalSSHInstanceRequestSchema().dumps(d)
- resp = self.invoke("DeleteGlobalSSHInstance", d, **kwargs)
- return apis.DeleteGlobalSSHInstanceResponseSchema().loads(resp)
-
- def describe_global_ssh_area(self, req=None, **kwargs):
- """ DescribeGlobalSSHArea - 获取GlobalSSH覆盖的地区列表 用于控制显示哪些机房地域可以使用SSH特性
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 机房地域代号,如hk、 us-ca、 us-ws等。不填默认为空,返回所有支持地区。
-
- **Response**
-
- - **AreaSet** (list) - 见 **GlobalSSHArea** 模型定义
- - **Message** (str) - 提示信息
-
- **Response Model**
-
- **GlobalSSHArea**
-
- - **Area** (str) - GlobalSSH覆盖的地区,如香港、东京、洛杉矶等
- - **AreaCode** (str) - 地区代号,以地区AirPort Code
- - **RegionSet** (list) - ucloud机房代号构成的数组,如["hk","us-ca"]
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeGlobalSSHAreaRequestSchema().dumps(d)
- resp = self.invoke("DescribeGlobalSSHArea", d, **kwargs)
- return apis.DescribeGlobalSSHAreaResponseSchema().loads(resp)
-
- def describe_global_ssh_instance(self, req=None, **kwargs):
- """ DescribeGlobalSSHInstance - 获取GlobalSSH实例列表(传实例ID获取单个实例信息,不传获取项目下全部实例)
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
- - **InstanceId** (str) - 实例ID,资源唯一标识
-
- **Response**
-
- - **InstanceSet** (list) - 见 **GlobalSSHInfo** 模型定义
-
- **Response Model**
-
- **GlobalSSHInfo**
-
- - **AcceleratingDomain** (str) - 加速域名
- - **Area** (str) - 被SSH访问的IP所在地区
- - **ChargeType** (str) - 支付周期,如Month,Year等
- - **CreateTime** (int) - 资源创建时间戳
- - **ExpireTime** (int) - 资源过期时间戳
- - **InstanceId** (str) - 实例ID,资源唯一标识
- - **Port** (int) - SSH登陆端口
- - **Remark** (str) - 备注信息
- - **TargetIP** (str) - 被SSH访问的EIP
-
- """
- d = {"ProjectId": self.config.project_id}
- req and d.update(req)
- d = apis.DescribeGlobalSSHInstanceRequestSchema().dumps(d)
- resp = self.invoke("DescribeGlobalSSHInstance", d, **kwargs)
- return apis.DescribeGlobalSSHInstanceResponseSchema().loads(resp)
-
- def modify_global_ssh_port(self, req=None, **kwargs):
- """ ModifyGlobalSSHPort - 修改GlobalSSH端口
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
- - **InstanceId** (str) - (Required) 实例ID,资源唯一标识
- - **Port** (int) - (Required) 调整后的SSH登陆端口
-
- **Response**
-
- - **Message** (str) - 提示信息
-
- """
- d = {"ProjectId": self.config.project_id}
- req and d.update(req)
- d = apis.ModifyGlobalSSHPortRequestSchema().dumps(d)
- resp = self.invoke("ModifyGlobalSSHPort", d, **kwargs)
- return apis.ModifyGlobalSSHPortResponseSchema().loads(resp)
-
- def modify_global_ssh_remark(self, req=None, **kwargs):
- """ ModifyGlobalSSHRemark - 修改GlobalSSH备注
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
- - **InstanceId** (str) - (Required) 实例ID,资源唯一标识
- - **Remark** (str) - 备注信息,不填默认为空字符串
-
- **Response**
-
- - **Message** (str) - 接口返回消息
-
- """
- d = {"ProjectId": self.config.project_id}
- req and d.update(req)
- d = apis.ModifyGlobalSSHRemarkRequestSchema().dumps(d)
- resp = self.invoke("ModifyGlobalSSHRemark", d, **kwargs)
- return apis.ModifyGlobalSSHRemarkResponseSchema().loads(resp)
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.client import Client
+from ucloud.services.pathx.schemas import apis
+
+
+class PathXClient(Client):
+ def __init__(self, config, transport=None, middleware=None, logger=None):
+ super(PathXClient, self).__init__(config, transport, middleware, logger)
+
+ def create_global_ssh_instance(self, req=None, **kwargs):
+ """ CreateGlobalSSHInstance - 创建GlobalSSH实例
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
+ - **Area** (str) - (Required) 填写支持SSH访问IP的地区名称,如“洛杉矶”,“新加坡”,“香港”,“东京”,“华盛顿”,“法兰克福”。Area和AreaCode两者必填一个
+ - **AreaCode** (str) - (Required) AreaCode, 区域航空港国际通用代码。Area和AreaCode两者必填一个
+ - **Port** (int) - (Required) SSH端口,1-65535且不能使用80,443端口
+ - **TargetIP** (str) - (Required) 被SSH访问的IP
+ - **ChargeType** (str) - 支付方式,如按月、按年、按时
+ - **CouponId** (str) - 使用代金券可冲抵部分费用
+ - **Quantity** (int) - 购买数量
+ - **Remark** (str) - 备注信息
+
+ **Response**
+
+ - **AcceleratingDomain** (str) - 加速域名,访问该域名可就近接入
+ - **InstanceId** (str) - 实例ID,资源唯一标识
+ - **Message** (str) - 提示信息
+
+ """
+ d = {"ProjectId": self.config.project_id}
+ req and d.update(req)
+ d = apis.CreateGlobalSSHInstanceRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("CreateGlobalSSHInstance", d, **kwargs)
+ return apis.CreateGlobalSSHInstanceResponseSchema().loads(resp)
+
+ def delete_global_ssh_instance(self, req=None, **kwargs):
+ """ DeleteGlobalSSHInstance - 删除GlobalSSH实例
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
+ - **InstanceId** (str) - (Required) 实例Id,资源的唯一标识
+
+ **Response**
+
+ - **Message** (str) - 提示信息
+
+ """
+ d = {"ProjectId": self.config.project_id}
+ req and d.update(req)
+ d = apis.DeleteGlobalSSHInstanceRequestSchema().dumps(d)
+ resp = self.invoke("DeleteGlobalSSHInstance", d, **kwargs)
+ return apis.DeleteGlobalSSHInstanceResponseSchema().loads(resp)
+
+ def describe_global_ssh_area(self, req=None, **kwargs):
+ """ DescribeGlobalSSHArea - 获取GlobalSSH覆盖的地区列表 用于控制显示哪些机房地域可以使用SSH特性
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 机房地域代号,如hk、 us-ca、 us-ws等。不填默认为空,返回所有支持地区。
+
+ **Response**
+
+ - **AreaSet** (list) - 见 **GlobalSSHArea** 模型定义
+ - **Message** (str) - 提示信息
+
+ **Response Model**
+
+ **GlobalSSHArea**
+
+ - **Area** (str) - GlobalSSH覆盖的地区,如香港、东京、洛杉矶等
+ - **AreaCode** (str) - 地区代号,以地区AirPort Code
+ - **RegionSet** (list) - ucloud机房代号构成的数组,如["hk","us-ca"]
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeGlobalSSHAreaRequestSchema().dumps(d)
+ resp = self.invoke("DescribeGlobalSSHArea", d, **kwargs)
+ return apis.DescribeGlobalSSHAreaResponseSchema().loads(resp)
+
+ def describe_global_ssh_instance(self, req=None, **kwargs):
+ """ DescribeGlobalSSHInstance - 获取GlobalSSH实例列表(传实例ID获取单个实例信息,不传获取项目下全部实例)
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
+ - **InstanceId** (str) - 实例ID,资源唯一标识
+
+ **Response**
+
+ - **InstanceSet** (list) - 见 **GlobalSSHInfo** 模型定义
+
+ **Response Model**
+
+ **GlobalSSHInfo**
+
+ - **AcceleratingDomain** (str) - 加速域名
+ - **Area** (str) - 被SSH访问的IP所在地区
+ - **ChargeType** (str) - 支付周期,如Month,Year等
+ - **CreateTime** (int) - 资源创建时间戳
+ - **ExpireTime** (int) - 资源过期时间戳
+ - **InstanceId** (str) - 实例ID,资源唯一标识
+ - **Port** (int) - SSH登陆端口
+ - **Remark** (str) - 备注信息
+ - **TargetIP** (str) - 被SSH访问的EIP
+
+ """
+ d = {"ProjectId": self.config.project_id}
+ req and d.update(req)
+ d = apis.DescribeGlobalSSHInstanceRequestSchema().dumps(d)
+ resp = self.invoke("DescribeGlobalSSHInstance", d, **kwargs)
+ return apis.DescribeGlobalSSHInstanceResponseSchema().loads(resp)
+
+ def modify_global_ssh_port(self, req=None, **kwargs):
+ """ ModifyGlobalSSHPort - 修改GlobalSSH端口
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
+ - **InstanceId** (str) - (Required) 实例ID,资源唯一标识
+ - **Port** (int) - (Required) 调整后的SSH登陆端口
+
+ **Response**
+
+ - **Message** (str) - 提示信息
+
+ """
+ d = {"ProjectId": self.config.project_id}
+ req and d.update(req)
+ d = apis.ModifyGlobalSSHPortRequestSchema().dumps(d)
+ resp = self.invoke("ModifyGlobalSSHPort", d, **kwargs)
+ return apis.ModifyGlobalSSHPortResponseSchema().loads(resp)
+
+ def modify_global_ssh_remark(self, req=None, **kwargs):
+ """ ModifyGlobalSSHRemark - 修改GlobalSSH备注
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID,如org-xxxx。请参考 `GetProjectList接口 `_
+ - **InstanceId** (str) - (Required) 实例ID,资源唯一标识
+ - **Remark** (str) - 备注信息,不填默认为空字符串
+
+ **Response**
+
+ - **Message** (str) - 接口返回消息
+
+ """
+ d = {"ProjectId": self.config.project_id}
+ req and d.update(req)
+ d = apis.ModifyGlobalSSHRemarkRequestSchema().dumps(d)
+ resp = self.invoke("ModifyGlobalSSHRemark", d, **kwargs)
+ return apis.ModifyGlobalSSHRemarkResponseSchema().loads(resp)
diff --git a/ucloud/services/pathx/schemas/__init__.py b/ucloud/services/pathx/schemas/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/services/pathx/schemas/__init__.py
+++ b/ucloud/services/pathx/schemas/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/services/pathx/schemas/apis.py b/ucloud/services/pathx/schemas/apis.py
index a6786fe..266e759 100644
--- a/ucloud/services/pathx/schemas/apis.py
+++ b/ucloud/services/pathx/schemas/apis.py
@@ -1,174 +1,176 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.typesystem import schema, fields
-from ucloud.services.pathx.schemas import models
-
-""" PathX API Schema
-"""
-"""
-API: CreateGlobalSSHInstance
-
-创建GlobalSSH实例
-"""
-
-
-class CreateGlobalSSHInstanceRequestSchema(schema.RequestSchema):
- """ CreateGlobalSSHInstance - 创建GlobalSSH实例
- """
-
- fields = {
- "Area": fields.Str(required=True, dump_to="Area"),
- "AreaCode": fields.Str(required=True, dump_to="AreaCode"),
- "ChargeType": fields.Str(required=False, dump_to="ChargeType"),
- "CouponId": fields.Str(required=False, dump_to="CouponId"),
- "Port": fields.Int(required=True, dump_to="Port"),
- "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
- "Quantity": fields.Int(required=False, dump_to="Quantity"),
- "Remark": fields.Str(required=False, dump_to="Remark"),
- "TargetIP": fields.Str(required=True, dump_to="TargetIP"),
- }
-
-
-class CreateGlobalSSHInstanceResponseSchema(schema.ResponseSchema):
- """ CreateGlobalSSHInstance - 创建GlobalSSH实例
- """
-
- fields = {
- "AcceleratingDomain": fields.Str(
- required=False, load_from="AcceleratingDomain"
- ),
- "InstanceId": fields.Str(required=True, load_from="InstanceId"),
- "Message": fields.Str(required=False, load_from="Message"),
- }
-
-
-"""
-API: DeleteGlobalSSHInstance
-
-删除GlobalSSH实例
-"""
-
-
-class DeleteGlobalSSHInstanceRequestSchema(schema.RequestSchema):
- """ DeleteGlobalSSHInstance - 删除GlobalSSH实例
- """
-
- fields = {
- "InstanceId": fields.Str(required=True, dump_to="InstanceId"),
- "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
- }
-
-
-class DeleteGlobalSSHInstanceResponseSchema(schema.ResponseSchema):
- """ DeleteGlobalSSHInstance - 删除GlobalSSH实例
- """
-
- fields = {"Message": fields.Str(required=False, load_from="Message")}
-
-
-"""
-API: DescribeGlobalSSHArea
-
-获取GlobalSSH覆盖的地区列表 用于控制显示哪些机房地域可以使用SSH特性
-"""
-
-
-class DescribeGlobalSSHAreaRequestSchema(schema.RequestSchema):
- """ DescribeGlobalSSHArea - 获取GlobalSSH覆盖的地区列表 用于控制显示哪些机房地域可以使用SSH特性
- """
-
- fields = {
- "ProjectId": fields.Str(required=False, dump_to="ProjectId"),
- "Region": fields.Str(required=False, dump_to="Region"),
- }
-
-
-class DescribeGlobalSSHAreaResponseSchema(schema.ResponseSchema):
- """ DescribeGlobalSSHArea - 获取GlobalSSH覆盖的地区列表 用于控制显示哪些机房地域可以使用SSH特性
- """
-
- fields = {
- "AreaSet": fields.List(
- models.GlobalSSHAreaSchema(), required=False, load_from="AreaSet"
- ),
- "Message": fields.Str(required=False, load_from="Message"),
- }
-
-
-"""
-API: DescribeGlobalSSHInstance
-
-获取GlobalSSH实例列表(传实例ID获取单个实例信息,不传获取项目下全部实例)
-"""
-
-
-class DescribeGlobalSSHInstanceRequestSchema(schema.RequestSchema):
- """ DescribeGlobalSSHInstance - 获取GlobalSSH实例列表(传实例ID获取单个实例信息,不传获取项目下全部实例)
- """
-
- fields = {
- "InstanceId": fields.Str(required=False, dump_to="InstanceId"),
- "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
- }
-
-
-class DescribeGlobalSSHInstanceResponseSchema(schema.ResponseSchema):
- """ DescribeGlobalSSHInstance - 获取GlobalSSH实例列表(传实例ID获取单个实例信息,不传获取项目下全部实例)
- """
-
- fields = {
- "InstanceSet": fields.List(
- models.GlobalSSHInfoSchema(), required=False, load_from="InstanceSet"
- )
- }
-
-
-"""
-API: ModifyGlobalSSHPort
-
-修改GlobalSSH端口
-"""
-
-
-class ModifyGlobalSSHPortRequestSchema(schema.RequestSchema):
- """ ModifyGlobalSSHPort - 修改GlobalSSH端口
- """
-
- fields = {
- "InstanceId": fields.Str(required=True, dump_to="InstanceId"),
- "Port": fields.Int(required=True, dump_to="Port"),
- "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
- }
-
-
-class ModifyGlobalSSHPortResponseSchema(schema.ResponseSchema):
- """ ModifyGlobalSSHPort - 修改GlobalSSH端口
- """
-
- fields = {"Message": fields.Str(required=False, load_from="Message")}
-
-
-"""
-API: ModifyGlobalSSHRemark
-
-修改GlobalSSH备注
-"""
-
-
-class ModifyGlobalSSHRemarkRequestSchema(schema.RequestSchema):
- """ ModifyGlobalSSHRemark - 修改GlobalSSH备注
- """
-
- fields = {
- "InstanceId": fields.Str(required=True, dump_to="InstanceId"),
- "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
- "Remark": fields.Str(required=False, dump_to="Remark"),
- }
-
-
-class ModifyGlobalSSHRemarkResponseSchema(schema.ResponseSchema):
- """ ModifyGlobalSSHRemark - 修改GlobalSSH备注
- """
-
- fields = {"Message": fields.Str(required=False, load_from="Message")}
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.typesystem import schema, fields
+from ucloud.services.pathx.schemas import models
+
+""" PathX API Schema
+"""
+"""
+API: CreateGlobalSSHInstance
+
+创建GlobalSSH实例
+"""
+
+
+class CreateGlobalSSHInstanceRequestSchema(schema.RequestSchema):
+ """ CreateGlobalSSHInstance - 创建GlobalSSH实例
+ """
+
+ fields = {
+ "Area": fields.Str(required=True, dump_to="Area"),
+ "AreaCode": fields.Str(required=True, dump_to="AreaCode"),
+ "ChargeType": fields.Str(required=False, dump_to="ChargeType"),
+ "CouponId": fields.Str(required=False, dump_to="CouponId"),
+ "Port": fields.Int(required=True, dump_to="Port"),
+ "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
+ "Quantity": fields.Int(required=False, dump_to="Quantity"),
+ "Remark": fields.Str(required=False, dump_to="Remark"),
+ "TargetIP": fields.Str(required=True, dump_to="TargetIP"),
+ }
+
+
+class CreateGlobalSSHInstanceResponseSchema(schema.ResponseSchema):
+ """ CreateGlobalSSHInstance - 创建GlobalSSH实例
+ """
+
+ fields = {
+ "AcceleratingDomain": fields.Str(
+ required=False, load_from="AcceleratingDomain"
+ ),
+ "InstanceId": fields.Str(required=True, load_from="InstanceId"),
+ "Message": fields.Str(required=False, load_from="Message"),
+ }
+
+
+"""
+API: DeleteGlobalSSHInstance
+
+删除GlobalSSH实例
+"""
+
+
+class DeleteGlobalSSHInstanceRequestSchema(schema.RequestSchema):
+ """ DeleteGlobalSSHInstance - 删除GlobalSSH实例
+ """
+
+ fields = {
+ "InstanceId": fields.Str(required=True, dump_to="InstanceId"),
+ "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
+ }
+
+
+class DeleteGlobalSSHInstanceResponseSchema(schema.ResponseSchema):
+ """ DeleteGlobalSSHInstance - 删除GlobalSSH实例
+ """
+
+ fields = {"Message": fields.Str(required=False, load_from="Message")}
+
+
+"""
+API: DescribeGlobalSSHArea
+
+获取GlobalSSH覆盖的地区列表 用于控制显示哪些机房地域可以使用SSH特性
+"""
+
+
+class DescribeGlobalSSHAreaRequestSchema(schema.RequestSchema):
+ """ DescribeGlobalSSHArea - 获取GlobalSSH覆盖的地区列表 用于控制显示哪些机房地域可以使用SSH特性
+ """
+
+ fields = {
+ "ProjectId": fields.Str(required=False, dump_to="ProjectId"),
+ "Region": fields.Str(required=False, dump_to="Region"),
+ }
+
+
+class DescribeGlobalSSHAreaResponseSchema(schema.ResponseSchema):
+ """ DescribeGlobalSSHArea - 获取GlobalSSH覆盖的地区列表 用于控制显示哪些机房地域可以使用SSH特性
+ """
+
+ fields = {
+ "AreaSet": fields.List(
+ models.GlobalSSHAreaSchema(), required=False, load_from="AreaSet"
+ ),
+ "Message": fields.Str(required=False, load_from="Message"),
+ }
+
+
+"""
+API: DescribeGlobalSSHInstance
+
+获取GlobalSSH实例列表(传实例ID获取单个实例信息,不传获取项目下全部实例)
+"""
+
+
+class DescribeGlobalSSHInstanceRequestSchema(schema.RequestSchema):
+ """ DescribeGlobalSSHInstance - 获取GlobalSSH实例列表(传实例ID获取单个实例信息,不传获取项目下全部实例)
+ """
+
+ fields = {
+ "InstanceId": fields.Str(required=False, dump_to="InstanceId"),
+ "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
+ }
+
+
+class DescribeGlobalSSHInstanceResponseSchema(schema.ResponseSchema):
+ """ DescribeGlobalSSHInstance - 获取GlobalSSH实例列表(传实例ID获取单个实例信息,不传获取项目下全部实例)
+ """
+
+ fields = {
+ "InstanceSet": fields.List(
+ models.GlobalSSHInfoSchema(),
+ required=False,
+ load_from="InstanceSet",
+ )
+ }
+
+
+"""
+API: ModifyGlobalSSHPort
+
+修改GlobalSSH端口
+"""
+
+
+class ModifyGlobalSSHPortRequestSchema(schema.RequestSchema):
+ """ ModifyGlobalSSHPort - 修改GlobalSSH端口
+ """
+
+ fields = {
+ "InstanceId": fields.Str(required=True, dump_to="InstanceId"),
+ "Port": fields.Int(required=True, dump_to="Port"),
+ "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
+ }
+
+
+class ModifyGlobalSSHPortResponseSchema(schema.ResponseSchema):
+ """ ModifyGlobalSSHPort - 修改GlobalSSH端口
+ """
+
+ fields = {"Message": fields.Str(required=False, load_from="Message")}
+
+
+"""
+API: ModifyGlobalSSHRemark
+
+修改GlobalSSH备注
+"""
+
+
+class ModifyGlobalSSHRemarkRequestSchema(schema.RequestSchema):
+ """ ModifyGlobalSSHRemark - 修改GlobalSSH备注
+ """
+
+ fields = {
+ "InstanceId": fields.Str(required=True, dump_to="InstanceId"),
+ "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
+ "Remark": fields.Str(required=False, dump_to="Remark"),
+ }
+
+
+class ModifyGlobalSSHRemarkResponseSchema(schema.ResponseSchema):
+ """ ModifyGlobalSSHRemark - 修改GlobalSSH备注
+ """
+
+ fields = {"Message": fields.Str(required=False, load_from="Message")}
diff --git a/ucloud/services/pathx/schemas/models.py b/ucloud/services/pathx/schemas/models.py
index 5e724a5..e85ea28 100644
--- a/ucloud/services/pathx/schemas/models.py
+++ b/ucloud/services/pathx/schemas/models.py
@@ -1,32 +1,34 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.typesystem import schema, fields
-
-
-class GlobalSSHAreaSchema(schema.ResponseSchema):
- """ GlobalSSHArea - GlobalSSH覆盖地区,包括关联的UCloud机房信息
- """
-
- fields = {
- "Area": fields.Str(required=True, load_from="Area"),
- "AreaCode": fields.Str(required=True, load_from="AreaCode"),
- "RegionSet": fields.List(fields.Str()),
- }
-
-
-class GlobalSSHInfoSchema(schema.ResponseSchema):
- """ GlobalSSHInfo - GlobalSSH实例信息
- """
-
- fields = {
- "AcceleratingDomain": fields.Str(required=True, load_from="AcceleratingDomain"),
- "Area": fields.Str(required=True, load_from="Area"),
- "ChargeType": fields.Str(required=True, load_from="ChargeType"),
- "CreateTime": fields.Int(required=True, load_from="CreateTime"),
- "ExpireTime": fields.Int(required=True, load_from="ExpireTime"),
- "InstanceId": fields.Str(required=True, load_from="InstanceId"),
- "Port": fields.Int(required=True, load_from="Port"),
- "Remark": fields.Str(required=True, load_from="Remark"),
- "TargetIP": fields.Str(required=True, load_from="TargetIP"),
- }
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.typesystem import schema, fields
+
+
+class GlobalSSHAreaSchema(schema.ResponseSchema):
+ """ GlobalSSHArea - GlobalSSH覆盖地区,包括关联的UCloud机房信息
+ """
+
+ fields = {
+ "Area": fields.Str(required=True, load_from="Area"),
+ "AreaCode": fields.Str(required=True, load_from="AreaCode"),
+ "RegionSet": fields.List(fields.Str()),
+ }
+
+
+class GlobalSSHInfoSchema(schema.ResponseSchema):
+ """ GlobalSSHInfo - GlobalSSH实例信息
+ """
+
+ fields = {
+ "AcceleratingDomain": fields.Str(
+ required=True, load_from="AcceleratingDomain"
+ ),
+ "Area": fields.Str(required=True, load_from="Area"),
+ "ChargeType": fields.Str(required=True, load_from="ChargeType"),
+ "CreateTime": fields.Int(required=True, load_from="CreateTime"),
+ "ExpireTime": fields.Int(required=True, load_from="ExpireTime"),
+ "InstanceId": fields.Str(required=True, load_from="InstanceId"),
+ "Port": fields.Int(required=True, load_from="Port"),
+ "Remark": fields.Str(required=True, load_from="Remark"),
+ "TargetIP": fields.Str(required=True, load_from="TargetIP"),
+ }
diff --git a/ucloud/services/stepflow/__init__.py b/ucloud/services/stepflow/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/services/stepflow/__init__.py
+++ b/ucloud/services/stepflow/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/services/stepflow/client.py b/ucloud/services/stepflow/client.py
index 3685949..dfda061 100644
--- a/ucloud/services/stepflow/client.py
+++ b/ucloud/services/stepflow/client.py
@@ -1,82 +1,84 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.client import Client
-from ucloud.services.stepflow.schemas import apis
-
-
-class StepFlowClient(Client):
- def __init__(self, config, transport=None, middleware=None, logger=None):
- super(StepFlowClient, self).__init__(config, transport, middleware, logger)
-
- def create_sf_workflow_from_template(self, req=None, **kwargs):
- """ CreateSFWorkflowFromTemplate - 导入工作流定义
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Namespace** (str) - (Required) 需要创建的工作流namespace
- - **Workflow** (str) - (Required) 描述工作流定义的base64字符串
- - **WorkflowName** (str) - (Required) 需要创建的工作流名称
-
- **Response**
-
- - **Message** (str) - 返回消息
- - **Version** (int) - 创建的工作流版本号
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.CreateSFWorkflowFromTemplateRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("CreateSFWorkflowFromTemplate", d, **kwargs)
- return apis.CreateSFWorkflowFromTemplateResponseSchema().loads(resp)
-
- def get_sf_workflow_template(self, req=None, **kwargs):
- """ GetSFWorkflowTemplate - 导出工作流定义
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **WorkflowId** (str) - (Required) 被导出工作流的Id
- - **WorkflowVersion** (int) - 被导出工作流的版本号。取值范围:WorkflowVersion >= 1;默认会获取发布版本对应的workflow;超过最大版本会返回错误
-
- **Response**
-
- - **Message** (str) - 返回消息
- - **Version** (int) - 导出工作流的版本号
- - **Workflow** (dict) - 见 **WorkflowTemplate** 模型定义
- - **WorkflowId** (str) - 导出工作流的Id
-
- **Response Model**
-
- **Param**
-
- - **Name** (str) - 参数名称
- - **Type** (str) - 参数类型
- - **Value** (str) - 参数值
-
- **ActivityTemplate**
-
- - **Input** (dict) - Activity的输入
- - **Name** (str) - Activity的名字
- - **Next** (str) - 下一个Activity的名字
- - **Output** (list) - Activity的输出,详见Param
- - **RetryTimes** (str) - Activity的重试次数
- - **Timeout** (str) - Activity的超时时间
- - **Type** (str) - Activity的类型
-
- **WorkflowTemplate**
-
- - **Activites** (list) - 见 **ActivityTemplate** 模型定义
- - **Input** (list) - 见 **Param** 模型定义
- - **Output** (list) - 见 **Param** 模型定义
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.GetSFWorkflowTemplateRequestSchema().dumps(d)
- resp = self.invoke("GetSFWorkflowTemplate", d, **kwargs)
- return apis.GetSFWorkflowTemplateResponseSchema().loads(resp)
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.client import Client
+from ucloud.services.stepflow.schemas import apis
+
+
+class StepFlowClient(Client):
+ def __init__(self, config, transport=None, middleware=None, logger=None):
+ super(StepFlowClient, self).__init__(
+ config, transport, middleware, logger
+ )
+
+ def create_sf_workflow_from_template(self, req=None, **kwargs):
+ """ CreateSFWorkflowFromTemplate - 导入工作流定义
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **Namespace** (str) - (Required) 需要创建的工作流namespace
+ - **Workflow** (str) - (Required) 描述工作流定义的base64字符串
+ - **WorkflowName** (str) - (Required) 需要创建的工作流名称
+
+ **Response**
+
+ - **Message** (str) - 返回消息
+ - **Version** (int) - 创建的工作流版本号
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.CreateSFWorkflowFromTemplateRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("CreateSFWorkflowFromTemplate", d, **kwargs)
+ return apis.CreateSFWorkflowFromTemplateResponseSchema().loads(resp)
+
+ def get_sf_workflow_template(self, req=None, **kwargs):
+ """ GetSFWorkflowTemplate - 导出工作流定义
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **WorkflowId** (str) - (Required) 被导出工作流的Id
+ - **WorkflowVersion** (int) - 被导出工作流的版本号。取值范围:WorkflowVersion >= 1;默认会获取发布版本对应的workflow;超过最大版本会返回错误
+
+ **Response**
+
+ - **Message** (str) - 返回消息
+ - **Version** (int) - 导出工作流的版本号
+ - **Workflow** (dict) - 见 **WorkflowTemplate** 模型定义
+ - **WorkflowId** (str) - 导出工作流的Id
+
+ **Response Model**
+
+ **Param**
+
+ - **Name** (str) - 参数名称
+ - **Type** (str) - 参数类型
+ - **Value** (str) - 参数值
+
+ **ActivityTemplate**
+
+ - **Input** (dict) - Activity的输入
+ - **Name** (str) - Activity的名字
+ - **Next** (str) - 下一个Activity的名字
+ - **Output** (list) - Activity的输出,详见Param
+ - **RetryTimes** (str) - Activity的重试次数
+ - **Timeout** (str) - Activity的超时时间
+ - **Type** (str) - Activity的类型
+
+ **WorkflowTemplate**
+
+ - **Activites** (list) - 见 **ActivityTemplate** 模型定义
+ - **Input** (list) - 见 **Param** 模型定义
+ - **Output** (list) - 见 **Param** 模型定义
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.GetSFWorkflowTemplateRequestSchema().dumps(d)
+ resp = self.invoke("GetSFWorkflowTemplate", d, **kwargs)
+ return apis.GetSFWorkflowTemplateResponseSchema().loads(resp)
diff --git a/ucloud/services/stepflow/schemas/__init__.py b/ucloud/services/stepflow/schemas/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/services/stepflow/schemas/__init__.py
+++ b/ucloud/services/stepflow/schemas/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/services/stepflow/schemas/apis.py b/ucloud/services/stepflow/schemas/apis.py
index 9fa5d40..20037c4 100644
--- a/ucloud/services/stepflow/schemas/apis.py
+++ b/ucloud/services/stepflow/schemas/apis.py
@@ -1,67 +1,69 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.typesystem import schema, fields
-from ucloud.services.stepflow.schemas import models
-
-""" StepFlow API Schema
-"""
-"""
-API: CreateSFWorkflowFromTemplate
-
-导入工作流定义
-"""
-
-
-class CreateSFWorkflowFromTemplateRequestSchema(schema.RequestSchema):
- """ CreateSFWorkflowFromTemplate - 导入工作流定义
- """
-
- fields = {
- "Namespace": fields.Str(required=True, dump_to="Namespace"),
- "ProjectId": fields.Str(required=False, dump_to="ProjectId"),
- "Region": fields.Str(required=True, dump_to="Region"),
- "Workflow": fields.Base64(required=True, dump_to="Workflow"),
- "WorkflowName": fields.Str(required=True, dump_to="WorkflowName"),
- }
-
-
-class CreateSFWorkflowFromTemplateResponseSchema(schema.ResponseSchema):
- """ CreateSFWorkflowFromTemplate - 导入工作流定义
- """
-
- fields = {
- "Message": fields.Str(required=True, load_from="Message"),
- "Version": fields.Int(required=True, load_from="Version"),
- }
-
-
-"""
-API: GetSFWorkflowTemplate
-
-导出工作流定义
-"""
-
-
-class GetSFWorkflowTemplateRequestSchema(schema.RequestSchema):
- """ GetSFWorkflowTemplate - 导出工作流定义
- """
-
- fields = {
- "ProjectId": fields.Str(required=False, dump_to="ProjectId"),
- "Region": fields.Str(required=True, dump_to="Region"),
- "WorkflowId": fields.Str(required=True, dump_to="WorkflowId"),
- "WorkflowVersion": fields.Int(required=False, dump_to="WorkflowVersion"),
- }
-
-
-class GetSFWorkflowTemplateResponseSchema(schema.ResponseSchema):
- """ GetSFWorkflowTemplate - 导出工作流定义
- """
-
- fields = {
- "Message": fields.Str(required=False, load_from="Message"),
- "Version": fields.Int(required=True, load_from="Version"),
- "Workflow": models.WorkflowTemplateSchema(),
- "WorkflowId": fields.Str(required=True, load_from="WorkflowId"),
- }
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.typesystem import schema, fields
+from ucloud.services.stepflow.schemas import models
+
+""" StepFlow API Schema
+"""
+"""
+API: CreateSFWorkflowFromTemplate
+
+导入工作流定义
+"""
+
+
+class CreateSFWorkflowFromTemplateRequestSchema(schema.RequestSchema):
+ """ CreateSFWorkflowFromTemplate - 导入工作流定义
+ """
+
+ fields = {
+ "Namespace": fields.Str(required=True, dump_to="Namespace"),
+ "ProjectId": fields.Str(required=False, dump_to="ProjectId"),
+ "Region": fields.Str(required=True, dump_to="Region"),
+ "Workflow": fields.Base64(required=True, dump_to="Workflow"),
+ "WorkflowName": fields.Str(required=True, dump_to="WorkflowName"),
+ }
+
+
+class CreateSFWorkflowFromTemplateResponseSchema(schema.ResponseSchema):
+ """ CreateSFWorkflowFromTemplate - 导入工作流定义
+ """
+
+ fields = {
+ "Message": fields.Str(required=True, load_from="Message"),
+ "Version": fields.Int(required=True, load_from="Version"),
+ }
+
+
+"""
+API: GetSFWorkflowTemplate
+
+导出工作流定义
+"""
+
+
+class GetSFWorkflowTemplateRequestSchema(schema.RequestSchema):
+ """ GetSFWorkflowTemplate - 导出工作流定义
+ """
+
+ fields = {
+ "ProjectId": fields.Str(required=False, dump_to="ProjectId"),
+ "Region": fields.Str(required=True, dump_to="Region"),
+ "WorkflowId": fields.Str(required=True, dump_to="WorkflowId"),
+ "WorkflowVersion": fields.Int(
+ required=False, dump_to="WorkflowVersion"
+ ),
+ }
+
+
+class GetSFWorkflowTemplateResponseSchema(schema.ResponseSchema):
+ """ GetSFWorkflowTemplate - 导出工作流定义
+ """
+
+ fields = {
+ "Message": fields.Str(required=False, load_from="Message"),
+ "Version": fields.Int(required=True, load_from="Version"),
+ "Workflow": models.WorkflowTemplateSchema(),
+ "WorkflowId": fields.Str(required=True, load_from="WorkflowId"),
+ }
diff --git a/ucloud/services/stepflow/schemas/models.py b/ucloud/services/stepflow/schemas/models.py
index b6d5122..bac8e96 100644
--- a/ucloud/services/stepflow/schemas/models.py
+++ b/ucloud/services/stepflow/schemas/models.py
@@ -1,41 +1,41 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.typesystem import schema, fields
-
-
-class ParamSchema(schema.ResponseSchema):
- """ Param - 工作流参数
- """
-
- fields = {
- "Name": fields.Str(required=False, load_from="Name"),
- "Type": fields.Str(required=False, load_from="Type"),
- "Value": fields.Str(required=False, load_from="Value"),
- }
-
-
-class ActivityTemplateSchema(schema.ResponseSchema):
- """ ActivityTemplate - 工作流的Activity定义
- """
-
- fields = {
- "Input": fields.Str(),
- "Name": fields.Str(required=False, load_from="Name"),
- "Next": fields.Str(required=False, load_from="Next"),
- "Output": fields.List(fields.Str()),
- "RetryTimes": fields.Str(required=False, load_from="RetryTimes"),
- "Timeout": fields.Str(required=False, load_from="Timeout"),
- "Type": fields.Str(required=False, load_from="Type"),
- }
-
-
-class WorkflowTemplateSchema(schema.ResponseSchema):
- """ WorkflowTemplate - Workflow对象定义
- """
-
- fields = {
- "Activites": fields.List(ActivityTemplateSchema()),
- "Input": fields.List(ParamSchema()),
- "Output": fields.List(ParamSchema()),
- }
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.typesystem import schema, fields
+
+
+class ParamSchema(schema.ResponseSchema):
+ """ Param - 工作流参数
+ """
+
+ fields = {
+ "Name": fields.Str(required=False, load_from="Name"),
+ "Type": fields.Str(required=False, load_from="Type"),
+ "Value": fields.Str(required=False, load_from="Value"),
+ }
+
+
+class ActivityTemplateSchema(schema.ResponseSchema):
+ """ ActivityTemplate - 工作流的Activity定义
+ """
+
+ fields = {
+ "Input": fields.Str(),
+ "Name": fields.Str(required=False, load_from="Name"),
+ "Next": fields.Str(required=False, load_from="Next"),
+ "Output": fields.List(fields.Str()),
+ "RetryTimes": fields.Str(required=False, load_from="RetryTimes"),
+ "Timeout": fields.Str(required=False, load_from="Timeout"),
+ "Type": fields.Str(required=False, load_from="Type"),
+ }
+
+
+class WorkflowTemplateSchema(schema.ResponseSchema):
+ """ WorkflowTemplate - Workflow对象定义
+ """
+
+ fields = {
+ "Activites": fields.List(ActivityTemplateSchema()),
+ "Input": fields.List(ParamSchema()),
+ "Output": fields.List(ParamSchema()),
+ }
diff --git a/ucloud/services/uaccount/__init__.py b/ucloud/services/uaccount/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/services/uaccount/__init__.py
+++ b/ucloud/services/uaccount/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/services/uaccount/client.py b/ucloud/services/uaccount/client.py
index b6ab9dc..99b43ff 100644
--- a/ucloud/services/uaccount/client.py
+++ b/ucloud/services/uaccount/client.py
@@ -1,162 +1,164 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.client import Client
-from ucloud.services.uaccount.schemas import apis
-
-
-class UAccountClient(Client):
- def __init__(self, config, transport=None, middleware=None, logger=None):
- super(UAccountClient, self).__init__(config, transport, middleware, logger)
-
- def create_project(self, req=None, **kwargs):
- """ CreateProject - 创建项目
-
- **Request**
-
- - **ProjectName** (str) - (Required) 项目名称
-
- **Response**
-
- - **ProjectId** (str) - 所创建项目的Id
-
- """
- d = {}
- req and d.update(req)
- d = apis.CreateProjectRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("CreateProject", d, **kwargs)
- return apis.CreateProjectResponseSchema().loads(resp)
-
- def get_project_list(self, req=None, **kwargs):
- """ GetProjectList - 获取项目列表
-
- **Request**
-
- - **IsFinance** (str) - 是否是财务账号
-
- **Response**
-
- - **ProjectCount** (int) - 项目总数
- - **ProjectSet** (list) - 见 **ProjectListInfo** 模型定义
-
- **Response Model**
-
- **ProjectListInfo**
-
- - **CreateTime** (int) - 创建时间(Unix时间戳)
- - **IsDefault** (bool) - 是否为默认项目
- - **MemberCount** (int) - 项目下成员数量
- - **ParentId** (str) - 父项目ID
- - **ParentName** (str) - 父项目名称
- - **ProjectId** (str) - 项目ID
- - **ProjectName** (str) - 项目名称
- - **ResourceCount** (int) - 项目下资源数量
-
- """
- d = {}
- req and d.update(req)
- d = apis.GetProjectListRequestSchema().dumps(d)
- resp = self.invoke("GetProjectList", d, **kwargs)
- return apis.GetProjectListResponseSchema().loads(resp)
-
- def get_region(self, req=None, **kwargs):
- """ GetRegion - 获取用户在各数据中心的权限等信息
-
- **Request**
-
-
- **Response**
-
- - **Regions** (list) - 见 **RegionInfo** 模型定义
-
- **Response Model**
-
- **RegionInfo**
-
- - **BitMaps** (str) - 用户在此数据中心的权限位
- - **IsDefault** (bool) - 是否用户当前默认数据中心
- - **Region** (str) - 地域名字,如cn-bj
- - **RegionId** (int) - 数据中心ID
- - **RegionName** (str) - 数据中心名称
- - **Zone** (str) - 可用区名字,如cn-bj-01
-
- """
- d = {}
- req and d.update(req)
- d = apis.GetRegionRequestSchema().dumps(d)
- resp = self.invoke("GetRegion", d, **kwargs)
- return apis.GetRegionResponseSchema().loads(resp)
-
- def get_user_info(self, req=None, **kwargs):
- """ GetUserInfo - 获取用户信息
-
- **Request**
-
-
- **Response**
-
- - **DataSet** (list) - 见 **UserInfo** 模型定义
-
- **Response Model**
-
- **UserInfo**
-
- - **Admin** (int) - 是否超级管理员 0:否 1:是
- - **Administrator** (str) - 管理员
- - **AuthState** (str) - 实名认证状态
- - **City** (str) - 城市
- - **CompanyName** (str) - 公司名称
- - **Finance** (int) - 是否有财务权限 0:否 1:是
- - **IndustryType** (int) - 所属行业
- - **PhonePrefix** (str) - 国际号码前缀
- - **Province** (str) - 省份
- - **UserAddress** (str) - 公司地址
- - **UserEmail** (str) - 用户邮箱
- - **UserId** (int) - 用户Id
- - **UserName** (str) - 称呼
- - **UserPhone** (str) - 用户手机
- - **UserType** (int) - 会员类型
- - **UserVersion** (int) - 是否子帐户(大于100为子帐户)
-
- """
- d = {}
- req and d.update(req)
- d = apis.GetUserInfoRequestSchema().dumps(d)
- resp = self.invoke("GetUserInfo", d, **kwargs)
- return apis.GetUserInfoResponseSchema().loads(resp)
-
- def modify_project(self, req=None, **kwargs):
- """ ModifyProject - 修改项目
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **ProjectName** (str) - (Required) 新的项目名称
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id}
- req and d.update(req)
- d = apis.ModifyProjectRequestSchema().dumps(d)
- resp = self.invoke("ModifyProject", d, **kwargs)
- return apis.ModifyProjectResponseSchema().loads(resp)
-
- def terminate_project(self, req=None, **kwargs):
- """ TerminateProject - 删除项目
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID,不填写为默认项目,子帐号必须填写。
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id}
- req and d.update(req)
- d = apis.TerminateProjectRequestSchema().dumps(d)
- resp = self.invoke("TerminateProject", d, **kwargs)
- return apis.TerminateProjectResponseSchema().loads(resp)
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.client import Client
+from ucloud.services.uaccount.schemas import apis
+
+
+class UAccountClient(Client):
+ def __init__(self, config, transport=None, middleware=None, logger=None):
+ super(UAccountClient, self).__init__(
+ config, transport, middleware, logger
+ )
+
+ def create_project(self, req=None, **kwargs):
+ """ CreateProject - 创建项目
+
+ **Request**
+
+ - **ProjectName** (str) - (Required) 项目名称
+
+ **Response**
+
+ - **ProjectId** (str) - 所创建项目的Id
+
+ """
+ d = {}
+ req and d.update(req)
+ d = apis.CreateProjectRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("CreateProject", d, **kwargs)
+ return apis.CreateProjectResponseSchema().loads(resp)
+
+ def get_project_list(self, req=None, **kwargs):
+ """ GetProjectList - 获取项目列表
+
+ **Request**
+
+ - **IsFinance** (str) - 是否是财务账号
+
+ **Response**
+
+ - **ProjectCount** (int) - 项目总数
+ - **ProjectSet** (list) - 见 **ProjectListInfo** 模型定义
+
+ **Response Model**
+
+ **ProjectListInfo**
+
+ - **CreateTime** (int) - 创建时间(Unix时间戳)
+ - **IsDefault** (bool) - 是否为默认项目
+ - **MemberCount** (int) - 项目下成员数量
+ - **ParentId** (str) - 父项目ID
+ - **ParentName** (str) - 父项目名称
+ - **ProjectId** (str) - 项目ID
+ - **ProjectName** (str) - 项目名称
+ - **ResourceCount** (int) - 项目下资源数量
+
+ """
+ d = {}
+ req and d.update(req)
+ d = apis.GetProjectListRequestSchema().dumps(d)
+ resp = self.invoke("GetProjectList", d, **kwargs)
+ return apis.GetProjectListResponseSchema().loads(resp)
+
+ def get_region(self, req=None, **kwargs):
+ """ GetRegion - 获取用户在各数据中心的权限等信息
+
+ **Request**
+
+
+ **Response**
+
+ - **Regions** (list) - 见 **RegionInfo** 模型定义
+
+ **Response Model**
+
+ **RegionInfo**
+
+ - **BitMaps** (str) - 用户在此数据中心的权限位
+ - **IsDefault** (bool) - 是否用户当前默认数据中心
+ - **Region** (str) - 地域名字,如cn-bj
+ - **RegionId** (int) - 数据中心ID
+ - **RegionName** (str) - 数据中心名称
+ - **Zone** (str) - 可用区名字,如cn-bj-01
+
+ """
+ d = {}
+ req and d.update(req)
+ d = apis.GetRegionRequestSchema().dumps(d)
+ resp = self.invoke("GetRegion", d, **kwargs)
+ return apis.GetRegionResponseSchema().loads(resp)
+
+ def get_user_info(self, req=None, **kwargs):
+ """ GetUserInfo - 获取用户信息
+
+ **Request**
+
+
+ **Response**
+
+ - **DataSet** (list) - 见 **UserInfo** 模型定义
+
+ **Response Model**
+
+ **UserInfo**
+
+ - **Admin** (int) - 是否超级管理员 0:否 1:是
+ - **Administrator** (str) - 管理员
+ - **AuthState** (str) - 实名认证状态
+ - **City** (str) - 城市
+ - **CompanyName** (str) - 公司名称
+ - **Finance** (int) - 是否有财务权限 0:否 1:是
+ - **IndustryType** (int) - 所属行业
+ - **PhonePrefix** (str) - 国际号码前缀
+ - **Province** (str) - 省份
+ - **UserAddress** (str) - 公司地址
+ - **UserEmail** (str) - 用户邮箱
+ - **UserId** (int) - 用户Id
+ - **UserName** (str) - 称呼
+ - **UserPhone** (str) - 用户手机
+ - **UserType** (int) - 会员类型
+ - **UserVersion** (int) - 是否子帐户(大于100为子帐户)
+
+ """
+ d = {}
+ req and d.update(req)
+ d = apis.GetUserInfoRequestSchema().dumps(d)
+ resp = self.invoke("GetUserInfo", d, **kwargs)
+ return apis.GetUserInfoResponseSchema().loads(resp)
+
+ def modify_project(self, req=None, **kwargs):
+ """ ModifyProject - 修改项目
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **ProjectName** (str) - (Required) 新的项目名称
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id}
+ req and d.update(req)
+ d = apis.ModifyProjectRequestSchema().dumps(d)
+ resp = self.invoke("ModifyProject", d, **kwargs)
+ return apis.ModifyProjectResponseSchema().loads(resp)
+
+ def terminate_project(self, req=None, **kwargs):
+ """ TerminateProject - 删除项目
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID,不填写为默认项目,子帐号必须填写。
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id}
+ req and d.update(req)
+ d = apis.TerminateProjectRequestSchema().dumps(d)
+ resp = self.invoke("TerminateProject", d, **kwargs)
+ return apis.TerminateProjectResponseSchema().loads(resp)
diff --git a/ucloud/services/uaccount/schemas/__init__.py b/ucloud/services/uaccount/schemas/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/services/uaccount/schemas/__init__.py
+++ b/ucloud/services/uaccount/schemas/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/services/uaccount/schemas/apis.py b/ucloud/services/uaccount/schemas/apis.py
index b3631ee..ad5aac2 100644
--- a/ucloud/services/uaccount/schemas/apis.py
+++ b/ucloud/services/uaccount/schemas/apis.py
@@ -1,148 +1,150 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.typesystem import schema, fields
-from ucloud.services.uaccount.schemas import models
-
-""" UAccount API Schema
-"""
-"""
-API: CreateProject
-
-创建项目
-"""
-
-
-class CreateProjectRequestSchema(schema.RequestSchema):
- """ CreateProject - 创建项目
- """
-
- fields = {"ProjectName": fields.Str(required=True, dump_to="ProjectName")}
-
-
-class CreateProjectResponseSchema(schema.ResponseSchema):
- """ CreateProject - 创建项目
- """
-
- fields = {"ProjectId": fields.Str(required=True, load_from="ProjectId")}
-
-
-"""
-API: GetProjectList
-
-获取项目列表
-"""
-
-
-class GetProjectListRequestSchema(schema.RequestSchema):
- """ GetProjectList - 获取项目列表
- """
-
- fields = {"IsFinance": fields.Str(required=False, dump_to="IsFinance")}
-
-
-class GetProjectListResponseSchema(schema.ResponseSchema):
- """ GetProjectList - 获取项目列表
- """
-
- fields = {
- "ProjectCount": fields.Int(required=True, load_from="ProjectCount"),
- "ProjectSet": fields.List(
- models.ProjectListInfoSchema(), required=True, load_from="ProjectSet"
- ),
- }
-
-
-"""
-API: GetRegion
-
-获取用户在各数据中心的权限等信息
-"""
-
-
-class GetRegionRequestSchema(schema.RequestSchema):
- """ GetRegion - 获取用户在各数据中心的权限等信息
- """
-
- fields = {}
-
-
-class GetRegionResponseSchema(schema.ResponseSchema):
- """ GetRegion - 获取用户在各数据中心的权限等信息
- """
-
- fields = {
- "Regions": fields.List(
- models.RegionInfoSchema(), required=False, load_from="Regions"
- )
- }
-
-
-"""
-API: GetUserInfo
-
-获取用户信息
-"""
-
-
-class GetUserInfoRequestSchema(schema.RequestSchema):
- """ GetUserInfo - 获取用户信息
- """
-
- fields = {}
-
-
-class GetUserInfoResponseSchema(schema.ResponseSchema):
- """ GetUserInfo - 获取用户信息
- """
-
- fields = {
- "DataSet": fields.List(
- models.UserInfoSchema(), required=True, load_from="DataSet"
- )
- }
-
-
-"""
-API: ModifyProject
-
-修改项目
-"""
-
-
-class ModifyProjectRequestSchema(schema.RequestSchema):
- """ ModifyProject - 修改项目
- """
-
- fields = {
- "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
- "ProjectName": fields.Str(required=True, dump_to="ProjectName"),
- }
-
-
-class ModifyProjectResponseSchema(schema.ResponseSchema):
- """ ModifyProject - 修改项目
- """
-
- fields = {}
-
-
-"""
-API: TerminateProject
-
-删除项目
-"""
-
-
-class TerminateProjectRequestSchema(schema.RequestSchema):
- """ TerminateProject - 删除项目
- """
-
- fields = {"ProjectId": fields.Str(required=False, dump_to="ProjectId")}
-
-
-class TerminateProjectResponseSchema(schema.ResponseSchema):
- """ TerminateProject - 删除项目
- """
-
- fields = {}
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.typesystem import schema, fields
+from ucloud.services.uaccount.schemas import models
+
+""" UAccount API Schema
+"""
+"""
+API: CreateProject
+
+创建项目
+"""
+
+
+class CreateProjectRequestSchema(schema.RequestSchema):
+ """ CreateProject - 创建项目
+ """
+
+ fields = {"ProjectName": fields.Str(required=True, dump_to="ProjectName")}
+
+
+class CreateProjectResponseSchema(schema.ResponseSchema):
+ """ CreateProject - 创建项目
+ """
+
+ fields = {"ProjectId": fields.Str(required=True, load_from="ProjectId")}
+
+
+"""
+API: GetProjectList
+
+获取项目列表
+"""
+
+
+class GetProjectListRequestSchema(schema.RequestSchema):
+ """ GetProjectList - 获取项目列表
+ """
+
+ fields = {"IsFinance": fields.Str(required=False, dump_to="IsFinance")}
+
+
+class GetProjectListResponseSchema(schema.ResponseSchema):
+ """ GetProjectList - 获取项目列表
+ """
+
+ fields = {
+ "ProjectCount": fields.Int(required=True, load_from="ProjectCount"),
+ "ProjectSet": fields.List(
+ models.ProjectListInfoSchema(),
+ required=True,
+ load_from="ProjectSet",
+ ),
+ }
+
+
+"""
+API: GetRegion
+
+获取用户在各数据中心的权限等信息
+"""
+
+
+class GetRegionRequestSchema(schema.RequestSchema):
+ """ GetRegion - 获取用户在各数据中心的权限等信息
+ """
+
+ fields = {}
+
+
+class GetRegionResponseSchema(schema.ResponseSchema):
+ """ GetRegion - 获取用户在各数据中心的权限等信息
+ """
+
+ fields = {
+ "Regions": fields.List(
+ models.RegionInfoSchema(), required=False, load_from="Regions"
+ )
+ }
+
+
+"""
+API: GetUserInfo
+
+获取用户信息
+"""
+
+
+class GetUserInfoRequestSchema(schema.RequestSchema):
+ """ GetUserInfo - 获取用户信息
+ """
+
+ fields = {}
+
+
+class GetUserInfoResponseSchema(schema.ResponseSchema):
+ """ GetUserInfo - 获取用户信息
+ """
+
+ fields = {
+ "DataSet": fields.List(
+ models.UserInfoSchema(), required=True, load_from="DataSet"
+ )
+ }
+
+
+"""
+API: ModifyProject
+
+修改项目
+"""
+
+
+class ModifyProjectRequestSchema(schema.RequestSchema):
+ """ ModifyProject - 修改项目
+ """
+
+ fields = {
+ "ProjectId": fields.Str(required=True, dump_to="ProjectId"),
+ "ProjectName": fields.Str(required=True, dump_to="ProjectName"),
+ }
+
+
+class ModifyProjectResponseSchema(schema.ResponseSchema):
+ """ ModifyProject - 修改项目
+ """
+
+ fields = {}
+
+
+"""
+API: TerminateProject
+
+删除项目
+"""
+
+
+class TerminateProjectRequestSchema(schema.RequestSchema):
+ """ TerminateProject - 删除项目
+ """
+
+ fields = {"ProjectId": fields.Str(required=False, dump_to="ProjectId")}
+
+
+class TerminateProjectResponseSchema(schema.ResponseSchema):
+ """ TerminateProject - 删除项目
+ """
+
+ fields = {}
diff --git a/ucloud/services/uaccount/schemas/models.py b/ucloud/services/uaccount/schemas/models.py
index 8279748..ce08652 100644
--- a/ucloud/services/uaccount/schemas/models.py
+++ b/ucloud/services/uaccount/schemas/models.py
@@ -1,58 +1,58 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.typesystem import schema, fields
-
-
-class ProjectListInfoSchema(schema.ResponseSchema):
- """ ProjectListInfo - 项目信息
- """
-
- fields = {
- "CreateTime": fields.Int(required=True, load_from="CreateTime"),
- "IsDefault": fields.Bool(required=True, load_from="IsDefault"),
- "MemberCount": fields.Int(required=True, load_from="MemberCount"),
- "ParentId": fields.Str(required=True, load_from="ParentId"),
- "ParentName": fields.Str(required=True, load_from="ParentName"),
- "ProjectId": fields.Str(required=True, load_from="ProjectId"),
- "ProjectName": fields.Str(required=True, load_from="ProjectName"),
- "ResourceCount": fields.Int(required=True, load_from="ResourceCount"),
- }
-
-
-class RegionInfoSchema(schema.ResponseSchema):
- """ RegionInfo - 数据中心信息
- """
-
- fields = {
- "BitMaps": fields.Str(required=True, load_from="BitMaps"),
- "IsDefault": fields.Bool(required=True, load_from="IsDefault"),
- "Region": fields.Str(required=True, load_from="Region"),
- "RegionId": fields.Int(required=True, load_from="RegionId"),
- "RegionName": fields.Str(required=True, load_from="RegionName"),
- "Zone": fields.Str(required=True, load_from="Zone"),
- }
-
-
-class UserInfoSchema(schema.ResponseSchema):
- """ UserInfo - 用户信息
- """
-
- fields = {
- "Admin": fields.Int(required=True, load_from="Admin"),
- "Administrator": fields.Str(required=True, load_from="Administrator"),
- "AuthState": fields.Str(required=True, load_from="AuthState"),
- "City": fields.Str(required=True, load_from="City"),
- "CompanyName": fields.Str(required=True, load_from="CompanyName"),
- "Finance": fields.Int(required=True, load_from="Finance"),
- "IndustryType": fields.Int(required=True, load_from="IndustryType"),
- "PhonePrefix": fields.Str(required=True, load_from="PhonePrefix"),
- "Province": fields.Str(required=True, load_from="Province"),
- "UserAddress": fields.Str(required=True, load_from="UserAddress"),
- "UserEmail": fields.Str(required=True, load_from="UserEmail"),
- "UserId": fields.Int(required=True, load_from="UserId"),
- "UserName": fields.Str(required=True, load_from="UserName"),
- "UserPhone": fields.Str(required=True, load_from="UserPhone"),
- "UserType": fields.Int(required=True, load_from="UserType"),
- "UserVersion": fields.Int(required=True, load_from="UserVersion"),
- }
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.typesystem import schema, fields
+
+
+class ProjectListInfoSchema(schema.ResponseSchema):
+ """ ProjectListInfo - 项目信息
+ """
+
+ fields = {
+ "CreateTime": fields.Int(required=True, load_from="CreateTime"),
+ "IsDefault": fields.Bool(required=True, load_from="IsDefault"),
+ "MemberCount": fields.Int(required=True, load_from="MemberCount"),
+ "ParentId": fields.Str(required=True, load_from="ParentId"),
+ "ParentName": fields.Str(required=True, load_from="ParentName"),
+ "ProjectId": fields.Str(required=True, load_from="ProjectId"),
+ "ProjectName": fields.Str(required=True, load_from="ProjectName"),
+ "ResourceCount": fields.Int(required=True, load_from="ResourceCount"),
+ }
+
+
+class RegionInfoSchema(schema.ResponseSchema):
+ """ RegionInfo - 数据中心信息
+ """
+
+ fields = {
+ "BitMaps": fields.Str(required=True, load_from="BitMaps"),
+ "IsDefault": fields.Bool(required=True, load_from="IsDefault"),
+ "Region": fields.Str(required=True, load_from="Region"),
+ "RegionId": fields.Int(required=True, load_from="RegionId"),
+ "RegionName": fields.Str(required=True, load_from="RegionName"),
+ "Zone": fields.Str(required=True, load_from="Zone"),
+ }
+
+
+class UserInfoSchema(schema.ResponseSchema):
+ """ UserInfo - 用户信息
+ """
+
+ fields = {
+ "Admin": fields.Int(required=True, load_from="Admin"),
+ "Administrator": fields.Str(required=True, load_from="Administrator"),
+ "AuthState": fields.Str(required=True, load_from="AuthState"),
+ "City": fields.Str(required=True, load_from="City"),
+ "CompanyName": fields.Str(required=True, load_from="CompanyName"),
+ "Finance": fields.Int(required=True, load_from="Finance"),
+ "IndustryType": fields.Int(required=True, load_from="IndustryType"),
+ "PhonePrefix": fields.Str(required=True, load_from="PhonePrefix"),
+ "Province": fields.Str(required=True, load_from="Province"),
+ "UserAddress": fields.Str(required=True, load_from="UserAddress"),
+ "UserEmail": fields.Str(required=True, load_from="UserEmail"),
+ "UserId": fields.Int(required=True, load_from="UserId"),
+ "UserName": fields.Str(required=True, load_from="UserName"),
+ "UserPhone": fields.Str(required=True, load_from="UserPhone"),
+ "UserType": fields.Int(required=True, load_from="UserType"),
+ "UserVersion": fields.Int(required=True, load_from="UserVersion"),
+ }
diff --git a/ucloud/services/udb/__init__.py b/ucloud/services/udb/__init__.py
index 4c48b5a..40a96af 100644
--- a/ucloud/services/udb/__init__.py
+++ b/ucloud/services/udb/__init__.py
@@ -1 +1 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
diff --git a/ucloud/services/udb/client.py b/ucloud/services/udb/client.py
index 9d23f60..03b1c62 100644
--- a/ucloud/services/udb/client.py
+++ b/ucloud/services/udb/client.py
@@ -1,1306 +1,1315 @@
-# -*- coding: utf-8 -*-
-
-""" Code is generated by ucloud-model, DO NOT EDIT IT. """
-from ucloud.core.client import Client
-from ucloud.services.udb.schemas import apis
-
-
-class UDBClient(Client):
- def __init__(self, config, transport=None, middleware=None, logger=None):
- super(UDBClient, self).__init__(config, transport, middleware, logger)
-
- def backup_udb_instance(self, req=None, **kwargs):
- """ BackupUDBInstance - 备份UDB实例
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupName** (str) - (Required) 备份名称
- - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
- - **BackupMethod** (str) - 使用的备份方式。(快照备份即物理备份。注意只有SSD版本的mysql实例支持设置为snapshot)
- - **Blacklist** (str) - 备份黑名单列表,以 ; 分隔。注意:只有逻辑备份下备份黑名单才生效,快照备份备份黑名单下无效
- - **ForceBackup** (bool) - true表示逻辑备份时是使用 --force 参数,false表示不使用 --force 参数。物理备份此参数无效。
- - **UseBlacklist** (bool) - 是否使用黑名单备份,默认false
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.BackupUDBInstanceRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("BackupUDBInstance", d, **kwargs)
- return apis.BackupUDBInstanceResponseSchema().loads(resp)
-
- def backup_udb_instance_binlog(self, req=None, **kwargs):
- """ BackupUDBInstanceBinlog - 备份UDB指定时间段的binlog列表
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupFile** (str) - (Required) 需要备份文件,可通过DescribeUDBInstanceBinlog获得 如果要传入多个文件名,以空格键分割,用单引号包含.
- - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
- - **BackupName** (str) - DB备份文件名称
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.BackupUDBInstanceBinlogRequestSchema().dumps(d)
- resp = self.invoke("BackupUDBInstanceBinlog", d, **kwargs)
- return apis.BackupUDBInstanceBinlogResponseSchema().loads(resp)
-
- def backup_udb_instance_error_log(self, req=None, **kwargs):
- """ BackupUDBInstanceErrorLog - 备份UDB指定时间段的errorlog
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupName** (str) - (Required) 备份名称
- - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.BackupUDBInstanceErrorLogRequestSchema().dumps(d)
- resp = self.invoke("BackupUDBInstanceErrorLog", d, **kwargs)
- return apis.BackupUDBInstanceErrorLogResponseSchema().loads(resp)
-
- def backup_udb_instance_slow_log(self, req=None, **kwargs):
- """ BackupUDBInstanceSlowLog - 备份UDB指定时间段的slowlog分析结果
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupName** (str) - (Required) 备份文件名称
- - **BeginTime** (int) - (Required) 过滤条件:起始时间(时间戳)
- - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
- - **EndTime** (int) - (Required) 过滤条件:结束时间(时间戳)
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.BackupUDBInstanceSlowLogRequestSchema().dumps(d)
- resp = self.invoke("BackupUDBInstanceSlowLog", d, **kwargs)
- return apis.BackupUDBInstanceSlowLogResponseSchema().loads(resp)
-
- def check_recover_udb_instance(self, req=None, **kwargs):
- """ CheckRecoverUDBInstance - 核查db是否可以使用回档功能
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **SrcDBId** (str) - (Required) 源实例的Id(只支持普通版DB不支持高可用)
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **LastestTime** (int) - 核查成功返回值为可以回档到的最近时刻,核查失败不返回
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.CheckRecoverUDBInstanceRequestSchema().dumps(d)
- resp = self.invoke("CheckRecoverUDBInstance", d, **kwargs)
- return apis.CheckRecoverUDBInstanceResponseSchema().loads(resp)
-
- def check_udb_instance_to_ha_allowance(self, req=None, **kwargs):
- """ CheckUDBInstanceToHAAllowance - 核查db是否可以升级为高可用
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
-
- **Response**
-
- - **Allowance** (str) - Yes ,No ,Yes即可以升级,No为不可以升级
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.CheckUDBInstanceToHAAllowanceRequestSchema().dumps(d)
- resp = self.invoke("CheckUDBInstanceToHAAllowance", d, **kwargs)
- return apis.CheckUDBInstanceToHAAllowanceResponseSchema().loads(resp)
-
- def clear_udb_log(self, req=None, **kwargs):
- """ ClearUDBLog - 清除UDB实例的log
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) DB实例的id,该值可以通过DescribeUDBInstance获取
- - **LogType** (int) - (Required) 日志类型,10-error(暂不支持)、20-slow(暂不支持 )、30-binlog
- - **BeforeTime** (int) - 删除时间点(至少前一天)之前log,采用时间戳(秒),默认当 前时间点前一天
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.ClearUDBLogRequestSchema().dumps(d)
- resp = self.invoke("ClearUDBLog", d, **kwargs)
- return apis.ClearUDBLogResponseSchema().loads(resp)
-
- def create_udb_instance(self, req=None, **kwargs):
- """ CreateUDBInstance - 创建UDB实例(包括创建mysql master节点、mongodb primary/configsvr节点和从备份恢复实例)
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **AdminPassword** (str) - (Required) 管理员密码
- - **DBTypeId** (str) - (Required) DB类型id,mysql/mongodb/postgesql按版本细分 1:mysql-5.1,2:mysql-5.5,3:percona-5.5,4:mysql-5.6,5:percona-5.6,6:mysql-5.7,7:percona-5.7,8:mariadb-10.0,9:mongodb-2.4,10:mongodb-2.6,11:mongodb-3.0,12:mongodb-3.2,13:postgresql-9.4,14:postgresql-9.6,14:postgresql-10.4
- - **DiskSpace** (int) - (Required) 磁盘空间(GB), 暂时支持20G - 3000G
- - **MemoryLimit** (int) - (Required) 内存限制(MB),目前支持以下几档 1000M/2000M/4000M/ 6000M/8000M/12000M/16000M/ 24000M/32000M/48000M/ 64000M/96000M
- - **Name** (str) - (Required) 实例名称,至少6位
- - **ParamGroupId** (int) - (Required) DB实例使用的配置参数组id
- - **Port** (int) - (Required) 端口号,mysql默认3306,mongodb默认27017,postgresql默认5432
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **AdminUser** (str) - 管理员帐户名,默认root
- - **BackupCount** (int) - 备份策略,每周备份数量,默认7次
- - **BackupDuration** (int) - 备份策略,备份时间间隔,单位小时计,默认24小时
- - **BackupId** (int) - 备份id,如果指定,则表明从备份恢复实例
- - **BackupTime** (int) - 备份策略,备份开始时间,单位小时计,默认1点
- - **BackupZone** (str) - 跨可用区高可用备库所在可用区,参见 `可用区列表 `_
- - **CPU** (int) - cpu核数
- - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Month
- - **ClusterRole** (str) - 当DB类型(DBTypeId)为mongodb时,需要指定mongo的角色,可选值为configsrv (配置节点),shardsrv (数据节点)
- - **CouponId** (str) - 使用的代金券id
- - **DisableSemisync** (bool) - 是否开启异步高可用,默认不填,可置为true
- - **HAArch** (str) - 高可用架构:1) haproxy(默认): 当前仅支持mysql。2) sentinel: 基于vip和哨兵节点的架构,当前支持mysql和pg。
- - **InstanceMode** (str) - UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例 "HA": 高可用版UDB实例 默认是"Normal"
- - **InstanceType** (str) - UDB数据库机型
- - **Quantity** (int) - 购买时长,默认值1
- - **SSDType** (str) - SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必选
- - **SubnetId** (str) - 子网ID
- - **Tag** (str) -
- - **UDBCId** (str) - 专区ID信息(如果这个参数存在这说明是在专区中创建DB)
- - **UseSSD** (bool) - 是否使用SSD,默认为false。目前主要可用区、海外机房、新机房只提供SSD资源,非SSD资源不再提供。
- - **VPCId** (str) - VPC的ID
-
- **Response**
-
- - **DBId** (str) - BD实例id
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.CreateUDBInstanceRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("CreateUDBInstance", d, **kwargs)
- return apis.CreateUDBInstanceResponseSchema().loads(resp)
-
- def create_udb_instance_by_recovery(self, req=None, **kwargs):
- """ CreateUDBInstanceByRecovery - 创建db,将新创建的db恢复到指定db某个指定时间点
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Name** (str) - (Required) 实例名称,至少6位
- - **RecoveryTime** (int) - (Required) 恢复到某个时间点的时间戳(UTC时间格式,默认单位秒)
- - **SrcDBId** (str) - (Required) 源实例的Id
- - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Dynamic
- - **CouponId** (str) - 使用的代金券id
- - **Quantity** (int) - 购买时长,默认值1
- - **SubnetId** (str) - 子网ID
- - **UDBCId** (str) - 专区的Id
- - **UseSSD** (bool) - 指定是否是否使用SSD,默认使用主库的配置
- - **VPCId** (str) - VPC的ID
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **DBId** (str) - db实例id
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.CreateUDBInstanceByRecoveryRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("CreateUDBInstanceByRecovery", d, **kwargs)
- return apis.CreateUDBInstanceByRecoveryResponseSchema().loads(resp)
-
- def create_udb_param_group(self, req=None, **kwargs):
- """ CreateUDBParamGroup - 从已有配置文件创建新配置文件
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBTypeId** (str) - (Required) DB类型id,mysql/mongodb/postgesql按版本细分 1:mysql-5.1,2:mysql-5.5,3:percona-5.5,4:mysql-5.6,5:percona-5.6,6:mysql-5.7,7:percona-5.7,8:mariadb-10.0,9:mongodb-2.4,10:mongodb-2.6,11:mongodb-3.0,12:mongodb-3.2,13:postgresql-9.4,14:postgresql-9.6
- - **Description** (str) - (Required) 参数组描述
- - **GroupName** (str) - (Required) 新配置参数组名称
- - **SrcGroupId** (int) - (Required) 源参数组id
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **RegionFlag** (bool) - 是否是地域级别的配置文件,默认是false
-
- **Response**
-
- - **GroupId** (int) - 新配置参数组id
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.CreateUDBParamGroupRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("CreateUDBParamGroup", d, **kwargs)
- return apis.CreateUDBParamGroupResponseSchema().loads(resp)
-
- def create_udb_replication_instance(self, req=None, **kwargs):
- """ CreateUDBReplicationInstance - 创建MongoDB的副本节点(包括仲裁)
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Name** (str) - (Required) 实例名称,至少6位
- - **SrcId** (str) - (Required) primary节点的DBId,该值可以通过DescribeUDBInstance获取
- - **CouponId** (str) - 使用的代金券id
- - **IsArbiter** (bool) - 是否是仲裁节点,默认false,仲裁节点按最小机型创建
- - **Port** (int) - 端口号,默认27017,取值范围3306至65535。
- - **UseSSD** (bool) - 是否使用SSD,默认不使用
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **DBId** (str) - 创建从节点的DBId
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.CreateUDBReplicationInstanceRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("CreateUDBReplicationInstance", d, **kwargs)
- return apis.CreateUDBReplicationInstanceResponseSchema().loads(resp)
-
- def create_udb_route_instance(self, req=None, **kwargs):
- """ CreateUDBRouteInstance - 创建mongos实例
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **ConfigsvrId** (list) - (Required) 配置服务器的dbid,允许一个或者三个。
- - **DBTypeId** (str) - (Required) DB类型id,mongodb按版本细分有1:mongodb-2.4,2:mongodb-2.6,3:mongodb-3.0,4:mongodb-3.2
- - **DiskSpace** (int) - (Required) 磁盘空间(GB), 暂时支持20G - 500G
- - **MemoryLimit** (int) - (Required) 内存限制(MB),目前支持以下几档 600M/1500M/3000M /6000M/15000M/30000M
- - **Name** (str) - (Required) 实例名称,至少6位
- - **ParamGroupId** (int) - (Required) DB实例使用的配置参数组id
- - **Port** (int) - (Required) 端口号,mongodb默认27017
- - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Month
- - **CouponId** (str) - 使用的代金券id
- - **Quantity** (int) - 购买时长,默认值1
- - **UseSSD** (bool) - 是否使用SSD,默认为false
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **DBId** (str) - db实例id
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.CreateUDBRouteInstanceRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("CreateUDBRouteInstance", d, **kwargs)
- return apis.CreateUDBRouteInstanceResponseSchema().loads(resp)
-
- def create_udb_slave(self, req=None, **kwargs):
- """ CreateUDBSlave - 创建UDB实例的slave
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Name** (str) - (Required) 实例名称,至少6位
- - **SrcId** (str) - (Required) master实例的DBId,该值可以通过DescribeUDBInstance获取
- - **CouponId** (str) - 使用的代金券id
- - **DiskSpace** (int) - 磁盘空间(GB), 暂时支持20G - 3000G(API支持,前端暂时只开放内存定制)
- - **InstanceMode** (str) - UDB实例部署模式,可选值如下:Normal: 普通单点实例HA: 高可用部署实例
- - **InstanceType** (str) - UDB实例类型:Normal和SATA_SSD
- - **IsLock** (bool) - 是否锁主库,默认为true
- - **MemoryLimit** (int) - 内存限制(MB),目前支持以下几档 1000M/2000M/4000M/ 6000M/8000M/12000M/16000M/ 24000M/32000M/48000M/ 64000M/96000M
- - **Port** (int) - 端口号,mysql默认3306
- - **SSDType** (str) - SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必选
- - **UseSSD** (bool) - 是否使用SSD,默认为false
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **DBId** (str) - 创建slave的DBId
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.CreateUDBSlaveRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("CreateUDBSlave", d, **kwargs)
- return apis.CreateUDBSlaveResponseSchema().loads(resp)
-
- def delete_udb_backup(self, req=None, **kwargs):
- """ DeleteUDBBackup - 删除UDB实例备份
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupId** (int) - (Required) 备份id,可通过DescribeUDBBackup获得
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **BackupZone** (str) - 跨可用区高可用备库所在可用区,参见[可用区列表]
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DeleteUDBBackupRequestSchema().dumps(d)
- resp = self.invoke("DeleteUDBBackup", d, **kwargs)
- return apis.DeleteUDBBackupResponseSchema().loads(resp)
-
- def delete_udb_instance(self, req=None, **kwargs):
- """ DeleteUDBInstance - 删除UDB实例
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) DB实例的id,该值可以通过DescribeUDBInstance获取
- - **UDBCId** (str) - 专区ID
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DeleteUDBInstanceRequestSchema().dumps(d)
- resp = self.invoke("DeleteUDBInstance", d, **kwargs)
- return apis.DeleteUDBInstanceResponseSchema().loads(resp)
-
- def delete_udb_log_package(self, req=None, **kwargs):
- """ DeleteUDBLogPackage - 删除UDB日志包
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupId** (int) - (Required) 日志包id,可通过DescribeUDBLogPackage获得
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **BackupZone** (str) - 跨可用区高可用备库所在可用区
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DeleteUDBLogPackageRequestSchema().dumps(d)
- resp = self.invoke("DeleteUDBLogPackage", d, **kwargs)
- return apis.DeleteUDBLogPackageResponseSchema().loads(resp)
-
- def delete_udb_param_group(self, req=None, **kwargs):
- """ DeleteUDBParamGroup - 删除配置参数组
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **GroupId** (int) - (Required) 参数组id,可通过DescribeUDBParamGroup获取
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **RegionFlag** (bool) - 是否属于地域级别
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DeleteUDBParamGroupRequestSchema().dumps(d)
- resp = self.invoke("DeleteUDBParamGroup", d, **kwargs)
- return apis.DeleteUDBParamGroupResponseSchema().loads(resp)
-
- def describe_udb_backup(self, req=None, **kwargs):
- """ DescribeUDBBackup - 列表UDB实例备份信息.Zone不填表示多可用区,填代表单可用区
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Limit** (int) - (Required) 分页显示的条目数,列表操作则指定
- - **Offset** (int) - (Required) 分页显示的起始偏移,列表操作则指定
- - **BackupId** (int) - 如果填了BackupId, 那么只拉取这个备份的记录
- - **BackupType** (int) - 备份类型,取值为0或1,0表示自动,1表示手动
- - **BeginTime** (int) - 过滤条件:起始时间(Unix时间戳)
- - **ClassType** (str) - 如果未指定GroupId,则可选是否选取特定DB类型的配置(sql, nosql, postgresql, sqlserver)
- - **DBId** (str) - DB实例Id,如果指定,则只获取该db的备份信息 该值可以通过DescribeUDBInstance获取
- - **EndTime** (int) - 过滤条件:结束时间(Unix时间戳)
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **DataSet** (list) - 见 **UDBBackupSet** 模型定义
- - **TotalCount** (int) - 满足条件备份总数,如果指定dbid,则是该db备份总数
-
- **Response Model**
-
- **UDBBackupSet**
-
- - **BackupEndTime** (int) - 备份完成时间(Unix时间戳)
- - **BackupId** (int) - 备份id
- - **BackupName** (str) - 备份名称
- - **BackupSize** (int) - 备份文件大小(字节)
- - **BackupTime** (int) - 备份时间(Unix时间戳)
- - **BackupType** (int) - 备份类型,取值为0或1,0表示自动,1表示手动
- - **BackupZone** (str) - 跨机房高可用备库所在可用区
- - **DBId** (str) - dbid
- - **DBName** (str) - 对应的db名称
- - **ErrorInfo** (str) - 备份错误信息
- - **State** (str) - 备份状态 Backuping // 备份中 Success // 备份成功 Failed // 备份失败 Expired // 备份过期
- - **Zone** (str) - 备份所在可用区
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBBackupRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBBackup", d, **kwargs)
- return apis.DescribeUDBBackupResponseSchema().loads(resp)
-
- def describe_udb_backup_blacklist(self, req=None, **kwargs):
- """ DescribeUDBBackupBlacklist - 获取UDB实例的备份黑名单
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **Blacklist** (str) - DB的黑名单列表, db.%为指定库 dbname.tablename为指定表
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBBackupBlacklistRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBBackupBlacklist", d, **kwargs)
- return apis.DescribeUDBBackupBlacklistResponseSchema().loads(resp)
-
- def describe_udb_binlog_backup_url(self, req=None, **kwargs):
- """ DescribeUDBBinlogBackupURL - 获取UDB的Binlog备份地址
-
- **Request**
-
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupId** (int) - (Required) DB实例备份ID
- - **DBId** (str) - (Required) DB实例Id
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **BackupPath** (str) - DB实例备份文件的公网地址
- - **InnerBackupPath** (str) - DB实例备份文件的内网地址
-
- """
- d = {"Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBBinlogBackupURLRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBBinlogBackupURL", d, **kwargs)
- return apis.DescribeUDBBinlogBackupURLResponseSchema().loads(resp)
-
- def describe_udb_instance(self, req=None, **kwargs):
- """ DescribeUDBInstance - 获取UDB实例信息,支持两类操作:(1)指定DBId用于获取该db的信息;(2)指定ClassType、Offset、Limit用于列表操作,查询某一个类型db。
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **ClassType** (str) - (Required) DB种类,如果是列表操作,则需要指定,不区分大小写,其取值如下:mysql: SQL;mongo: NOSQL;postgresql: postgresql
- - **Limit** (int) - (Required) 分页显示数量,列表操作则指定
- - **Offset** (int) - (Required) 分页显示起始偏移位置,列表操作则指定
- - **DBId** (str) - DB实例id,如果指定则获取描述,否则为列表操作, 指定Offset/Limit/ClassType DBId可通过DescribeUDBInstance获取
- - **IncludeSlaves** (bool) - 当只获取这个特定DBId的信息时,如果有该选项,那么把这个DBId实例的所有从库信息一起拉取并返回
- - **IsInUDBC** (bool) - 是否查看专区里面DB
- - **UDBCId** (str) - IsInUDBC为True,UDBCId为空,说明查看整个可用区的专区的db,如果UDBId不为空则只查看此专区下面的db
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **DataSet** (list) - 见 **UDBInstanceSet** 模型定义
- - **TotalCount** (int) - 用户db组的数量,对于 mysql: 主从结对数量,没有slave,则只有master mongodb: 副本集数量
-
- **Response Model**
-
- **UDBSlaveInstanceSet**
-
- - **AdminUser** (str) - 管理员帐户名,默认root
- - **BackupBeginTime** (int) - 备份策略,不可修改,开始时间,单位小时计,默认3点
- - **BackupBlacklist** (str) - 备份策略,备份黑名单,mongodb则不适用
- - **BackupCount** (int) - 备份策略,不可修改,备份文件保留的数量,默认7次
- - **BackupDate** (str) - 备份日期标记位。共7位,每一位为一周中一天的备份情况 0表示关闭当天备份,1表示打开当天备份。最右边的一位 为星期天的备份开关,其余从右到左依次为星期一到星期 六的备份配置开关,每周必须至少设置两天备份。 例如:1100000 表示打开星期六和星期五的自动备份功能
- - **BackupDuration** (int) - 备份策略,一天内备份时间间隔,单位小时,默认24小时
- - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Dynamic
- - **ClusterRole** (str) - 当DB类型为mongodb时,返回该实例所在集群中的角色,包括:mongos、configsrv_sccc、configsrv_csrs、shardsrv_datanode、shardsrv_arbiter,其中congfigsrv分为sccc和csrs两种模式,shardsrv分为datanode和arbiter两种模式
- - **CreateTime** (int) - DB实例创建时间,采用UTC计时时间戳
- - **DBId** (str) - DB实例id
- - **DBTypeId** (str) - DB类型id,mysql/mongodb按版本细分各有一个id 目前id的取值范围为[1,7],数值对应的版本如下: 1:mysql-5.5,2:mysql-5.1,3:percona-5.5 4:mongodb-2.4,5:mongodb-2.6,6:mysql-5.6, 7:percona-5.6
- - **DataFileSize** (float) - DB实例数据文件大小,单位GB
- - **DiskSpace** (int) - 磁盘空间(GB), 默认根据配置机型
- - **DiskUsedSize** (float) - DB实例磁盘已使用空间,单位GB
- - **ExpiredTime** (int) - DB实例过期时间,采用UTC计时时间戳
- - **InstanceMode** (str) - UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例;"HA": 高可用版UDB实例
- - **InstanceType** (str) - UDB数据库机型
- - **InstanceTypeId** (int) - UDB数据库机型ID
- - **LogFileSize** (float) - DB实例日志文件大小,单位GB
- - **MemoryLimit** (int) - 内存限制(MB),默认根据配置机型
- - **ModifyTime** (int) - DB实例修改时间,采用UTC计时时间戳
- - **Name** (str) - 实例名称,至少6位
- - **ParamGroupId** (int) - DB实例使用的配置参数组id
- - **Port** (int) - 端口号,mysql默认3306,mongodb默认27017
- - **Role** (str) - DB实例角色,mysql区分master/slave,mongodb多种角色
- - **SSDType** (str) - SSD类型,SATA/PCI-E
- - **SrcDBId** (str) - 对mysql的slave而言是master的DBId,对master则为空, 对mongodb则是副本集id
- - **State** (str) - DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败
- - **SubnetId** (str) - 子网ID
- - **SystemFileSize** (float) - DB实例系统文件大小,单位GB
- - **Tag** (str) - 获取资源其他信息
- - **UseSSD** (bool) - 是否使用SSD
- - **VPCId** (str) - VPC的ID
- - **VirtualIP** (str) - DB实例虚ip
- - **VirtualIPMac** (str) - DB实例虚ip的mac地址
- - **Zone** (str) - 可用区
-
- **UDBInstanceSet**
-
- - **AdminUser** (str) - 管理员帐户名,默认root
- - **BackupBeginTime** (int) - 备份策略,不可修改,开始时间,单位小时计,默认3点
- - **BackupBlacklist** (str) - 备份策略,备份黑名单,mongodb则不适用
- - **BackupCount** (int) - 备份策略,不可修改,备份文件保留的数量,默认7次
- - **BackupDate** (str) - 备份日期标记位。共7位,每一位为一周中一天的备份情况 0表示关闭当天备份,1表示打开当天备份。最右边的一位 为星期天的备份开关,其余从右到左依次为星期一到星期 六的备份配置开关,每周必须至少设置两天备份。 例如:1100000 表示打开星期六和星期五的自动备份功能
- - **BackupDuration** (int) - 备份策略,一天内备份时间间隔,单位小时,默认24小时
- - **BackupZone** (str) - 跨可用区高可用备库所在可用区
- - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Dynamic
- - **CluserRole** (str) - 当DB类型为mongodb时,返回该实例所在集群中的角色,包括:mongos、configsrv_sccc、configsrv_csrs、shardsrv_datanode、shardsrv_arbiter,其中congfigsrv分为sccc和csrs两种模式,shardsrv分为datanode和arbiter两种模式
- - **CreateTime** (int) - DB实例创建时间,采用UTC计时时间戳
- - **DBId** (str) - DB实例id
- - **DBTypeId** (str) - DB类型id,mysql/mongodb按版本细分各有一个id 目前id的取值范围为[1,7],数值对应的版本如下: 1:mysql-5.5,2:mysql-5.1,3:percona-5.5 4:mongodb-2.4,5:mongodb-2.6,6:mysql-5.6, 7:percona-5.6
- - **DataFileSize** (float) - DB实例数据文件大小,单位GB
- - **DataSet** (list) - 见 **UDBSlaveInstanceSet** 模型定义
- - **DiskSpace** (int) - 磁盘空间(GB), 默认根据配置机型
- - **DiskUsedSize** (float) - DB实例磁盘已使用空间,单位GB
- - **ExpiredTime** (int) - DB实例过期时间,采用UTC计时时间戳
- - **InstanceMode** (str) - UDB实例模式类型, 可选值如下: “Normal”: 普通版UDB实例 “HA”: 高可用版UDB实例
- - **InstanceType** (str) - UDB数据库机型
- - **InstanceTypeId** (int) - UDB数据库机型ID
- - **LogFileSize** (float) - DB实例日志文件大小,单位GB
- - **MemoryLimit** (int) - 内存限制(MB),默认根据配置机型
- - **ModifyTime** (int) - DB实例修改时间,采用UTC计时时间戳
- - **Name** (str) - 实例名称,至少6位
- - **ParamGroupId** (int) - DB实例使用的配置参数组id
- - **Port** (int) - 端口号,mysql默认3306,mongodb默认27017
- - **Role** (str) - DB实例角色,mysql区分master/slave,mongodb多种角色
- - **SSDType** (str) - SSD类型,SATA/PCI-E
- - **SrcDBId** (str) - 对mysql的slave而言是master的DBId,对master则为空, 对mongodb则是副本集id
- - **State** (str) - DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败
- - **SubnetId** (str) - 子网ID
- - **SystemFileSize** (float) - DB实例系统文件大小,单位GB
- - **Tag** (str) - 获取资源其他信息
- - **UseSSD** (bool) - 是否使用SSD
- - **VPCId** (str) - VPC的ID
- - **VirtualIP** (str) - DB实例虚ip
- - **VirtualIPMac** (str) - DB实例虚ip的mac地址
- - **Zone** (str) - DB实例所在可用区
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBInstanceRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBInstance", d, **kwargs)
- return apis.DescribeUDBInstanceResponseSchema().loads(resp)
-
- def describe_udb_instance_backup_state(self, req=None, **kwargs):
- """ DescribeUDBInstanceBackupState - 获取UDB实例备份状态
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupId** (int) - (Required) 备份记录ID
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **BackupZone** (str) - 跨可用区高可用备库所在可用区,参见[可用区列表]
-
- **Response**
-
- - **BackupEndTime** (int) -
- - **BackupSize** (int) -
- - **State** (str) - 备份状态 0 Backuping // 备份中 1 Success // 备份成功 2 Failed // 备份失败 3 Expired // 备份过期
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBInstanceBackupStateRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBInstanceBackupState", d, **kwargs)
- return apis.DescribeUDBInstanceBackupStateResponseSchema().loads(resp)
-
- def describe_udb_instance_backup_url(self, req=None, **kwargs):
- """ DescribeUDBInstanceBackupURL - 获取UDB备份下载地址
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupId** (int) - (Required) DB实例备份ID,该值可以通过DescribeUDBBackup获取
- - **DBId** (str) - (Required) DB实例Id,该值可通过DescribeUDBInstance获取
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **BackupPath** (str) - DB实例备份文件公网的地址
- - **InnerBackupPath** (str) - DB实例备份文件内网的地址
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBInstanceBackupURLRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBInstanceBackupURL", d, **kwargs)
- return apis.DescribeUDBInstanceBackupURLResponseSchema().loads(resp)
-
- def describe_udb_instance_binlog(self, req=None, **kwargs):
- """ DescribeUDBInstanceBinlog - 获取UDB指定时间段的binlog列表
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BeginTime** (int) - (Required) 过滤条件:起始时间(时间戳)
- - **DBId** (str) - (Required) DB实例Id
- - **EndTime** (int) - (Required) 过滤条件:结束时间(时间戳)
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **DataSet** (list) - 见 **UDBInstanceBinlogSet** 模型定义
-
- **Response Model**
-
- **UDBInstanceBinlogSet**
-
- - **BeginTime** (int) - Binlog文件生成时间(时间戳)
- - **EndTime** (int) - Binlog文件结束时间(时间戳)
- - **Name** (str) - Binlog文件名
- - **Size** (int) - Binlog文件大小
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBInstanceBinlogRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBInstanceBinlog", d, **kwargs)
- return apis.DescribeUDBInstanceBinlogResponseSchema().loads(resp)
-
- def describe_udb_instance_binlog_backup_state(self, req=None, **kwargs):
- """ DescribeUDBInstanceBinlogBackupState - 获取udb实例备份状态
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupId** (int) - (Required) 备份记录ID
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **BackupZone** (str) - 跨可用区高可用备库所在可用区
-
- **Response**
-
- - **BackupSize** (int) - 备份文件大小(字节)
- - **State** (str) - 备份状态 0 Backuping // 备份中 1 Success // 备份成功 2 Failed // 备份失败 3 Expired // 备份过期
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBInstanceBinlogBackupStateRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBInstanceBinlogBackupState", d, **kwargs)
- return apis.DescribeUDBInstanceBinlogBackupStateResponseSchema().loads(resp)
-
- def describe_udb_instance_price(self, req=None, **kwargs):
- """ DescribeUDBInstancePrice - 获取UDB实例价格信息
-
- **Request**
-
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBTypeId** (str) - (Required) UDB实例的DB版本字符串
- - **DiskSpace** (int) - (Required) 磁盘空间(GB),暂时支持20(GB) - 3000(GB), 输入不带单位
- - **MemoryLimit** (int) - (Required) 内存限制(MB),单位为MB.目前支持:1000-96000
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **ChargeType** (str) - Year,按年付费; Month,按月付费 Dynamic,按需付费(需开启权限) Trial,试用(需开启权限)默认为月付
- - **Count** (int) - 购买DB实例数量,最大数量为10台, 默认为1台
- - **InstanceMode** (str) - 实例的部署类型。可选值为:Normal: 普通单点实例,Slave: 从库实例,HA: 高可用部署实例,默认是Normal
- - **Quantity** (int) - DB购买多少个"计费时间单位",默认值为1。比如:买2个月,Quantity就是2。如果计费单位是“按月”,并且Quantity为0,表示“购买到月底”
- - **SSDType** (str) - SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必填
- - **UseSSD** (bool) - 是否使用SSD,默认为false
-
- **Response**
-
- - **DataSet** (list) - 见 **UDBInstancePriceSet** 模型定义
-
- **Response Model**
-
- **UDBInstancePriceSet**
-
- - **ChargeType** (str) - Year, Month, Dynamic,Trial
- - **Price** (float) - 价格,单位为分,保留小数点后两位
-
- """
- d = {"Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBInstancePriceRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBInstancePrice", d, **kwargs)
- return apis.DescribeUDBInstancePriceResponseSchema().loads(resp)
-
- def describe_udb_instance_state(self, req=None, **kwargs):
- """ DescribeUDBInstanceState - 获取UDB实例状态
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **State** (str) - DB状态标记 Init:初始化中;Fail:安装失败; Starting:启动中; Running : 运行 ;Shutdown:关闭中; Shutoff :已关闭; Delete:已删除; Upgrading:升级中; Promoting: 提升为独库进行中; Recovering: 恢复中; Recover fail:恢复失败。
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBInstanceStateRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBInstanceState", d, **kwargs)
- return apis.DescribeUDBInstanceStateResponseSchema().loads(resp)
-
- def describe_udb_instance_upgrade_price(self, req=None, **kwargs):
- """ DescribeUDBInstanceUpgradePrice - 获取UDB实例升降级价格信息
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id
- - **DiskSpace** (int) - (Required) 磁盘空间(GB), 暂时支持20G - 500G
- - **MemoryLimit** (int) - (Required) 内存限制(MB)
- - **SSDType** (str) - SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必选
- - **UseSSD** (bool) - 是否使用SSD,默认为false
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **Price** (float) - 价格,单位分
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBInstanceUpgradePriceRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBInstanceUpgradePrice", d, **kwargs)
- return apis.DescribeUDBInstanceUpgradePriceResponseSchema().loads(resp)
-
- def describe_udb_log_backup_url(self, req=None, **kwargs):
- """ DescribeUDBLogBackupURL - 获取UDB的slowlog备份地址
-
- **Request**
-
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupId** (int) - (Required) DB实例备份ID
- - **DBId** (str) - (Required) DB实例Id
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **BackupPath** (str) - 备份外网URL
- - **UsernetPath** (str) - 备份用户网URL
-
- """
- d = {"Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBLogBackupURLRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBLogBackupURL", d, **kwargs)
- return apis.DescribeUDBLogBackupURLResponseSchema().loads(resp)
-
- def describe_udb_log_package(self, req=None, **kwargs):
- """ DescribeUDBLogPackage - 列表UDB实例binlog或slowlog或errorlog备份信息
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Limit** (int) - (Required) 分页显示的条目数,列表操作则指定
- - **Offset** (int) - (Required) 分页显示的起始偏移,列表操作则指定
- - **BeginTime** (int) - 过滤条件:起始时间(时间戳)
- - **DBId** (str) - DB实例Id,如果指定,则只获取该db的备份信息
- - **EndTime** (int) - 过滤条件:结束时间(时间戳)
- - **Type** (int) - 需要列出的备份文件类型,每种文件的值如下 2 : BINLOG\\_BACKUP 3 : SLOW\\_QUERY\\_BACKUP 4 : ERRORLOG\\_BACKUP
- - **Types** (list) - Types作为Type的补充,支持多值传入,可以获取多个类型的日志记录,如:Types.0=2&Types.1=3
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **DataSet** (list) - 见 **LogPackageDataSet** 模型定义
- - **TotalCount** (int) - 备份总数,如果指定dbid,则是该db备份总数
-
- **Response Model**
-
- **LogPackageDataSet**
-
- - **BackupId** (int) - 备份id
- - **BackupName** (str) - 备份名称
- - **BackupSize** (int) - 备份文件大小
- - **BackupTime** (int) - 备份时间
- - **BackupType** (int) - 备份类型,包括2-binlog备份,3-slowlog备份
- - **BackupZone** (str) - 跨可用区高可用备库所在可用区
- - **DBId** (str) - dbid
- - **DBName** (str) - 对应的db名称
- - **State** (str) - 备份状态 Backuping // 备份中 Success // 备份成功 Failed // 备份失败 Expired // 备份过期
- - **Zone** (str) - 所在可用区
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBLogPackageRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBLogPackage", d, **kwargs)
- return apis.DescribeUDBLogPackageResponseSchema().loads(resp)
-
- def describe_udb_param_group(self, req=None, **kwargs):
- """ DescribeUDBParamGroup - 获取参数组详细参数信息
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Limit** (int) - (Required) 分页显示的条目数,列表操作则指定
- - **Offset** (int) - (Required) 分页显示的起始偏移,列表操作则指定
- - **ClassType** (str) - 如果未指定GroupId,则可选是否选取特定DB类型的配置(sql, nosql, postgresql, sqlserver)
- - **GroupId** (int) - 参数组id,如果指定则获取描述,否则是列表操作,需要 指定Offset/Limit
- - **IsInUDBC** (bool) - 是否选取专区中配置
- - **RegionFlag** (bool) - 当请求没有填写Zone时,如果指定为true,表示只拉取跨可用区的相关配置文件,否则,拉取所有机房的配置文件(包括每个单可用区和跨可用区)
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **DataSet** (list) - 见 **UDBParamGroupSet** 模型定义
- - **TotalCount** (int) - 参数组总数,列表操作时才会有该参数
-
- **Response Model**
-
- **UDBParamMemberSet**
-
- - **AllowedVal** (str) - 允许的值(根据参数类型,用分隔符表示)
- - **ApplyType** (int) - 参数值应用类型,取值范围为{0,10,20},各值代表 意义为0-unknown、10-static、20-dynamic
- - **FormatType** (int) - 允许值的格式类型,取值范围为{0,10,20},意义分 别为PVFT_UNKOWN=0,PVFT_RANGE=10, PVFT_ENUM=20
- - **Key** (str) - 参数名称
- - **Modifiable** (bool) - 是否可更改,默认为false
- - **Value** (str) - 参数值
- - **ValueType** (int) - 参数值应用类型,取值范围为{0,10,20,30},各值 代表意义为 0-unknown、10-int、20-string、 30-bool
-
- **UDBParamGroupSet**
-
- - **DBTypeId** (str) - DB类型id,mysql/mongodb按版本细分各有一个id 目前id的取值范围为[1,7],数值对应的版本如下 1:mysql-5.5,2:mysql-5.1,3:percona-5.5 4:mongodb-2.4,5:mongodb-2.6,6:mysql-5.6 7:percona-5.6
- - **Description** (str) - 参数组描述
- - **GroupId** (int) - 参数组id
- - **GroupName** (str) - 参数组名称
- - **Modifiable** (bool) - 参数组是否可修改
- - **ParamMember** (list) - 见 **UDBParamMemberSet** 模型定义
- - **RegionFlag** (bool) -
- - **Zone** (str) -
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBParamGroupRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBParamGroup", d, **kwargs)
- return apis.DescribeUDBParamGroupResponseSchema().loads(resp)
-
- def describe_udb_type(self, req=None, **kwargs):
- """ DescribeUDBType - 获取UDB支持的类型信息
-
- **Request**
-
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **DBClusterType** (str) - DB实例类型,如mysql,sqlserver,mongo,postgresql
- - **DiskType** (str) - 返回支持某种磁盘类型的DB类型。如果没传,则表示任何磁盘类型均可。
- - **InstanceMode** (str) - 返回支持某种实例类型的DB类型。如果没传,则表示任何实例类型均可。normal:单点,ha:高可用,sharded_cluster:分片集群
-
- **Response**
-
- - **DataSet** (list) - 见 **UDBTypeSet** 模型定义
-
- **Response Model**
-
- **UDBTypeSet**
-
- - **DBTypeId** (str) - DB类型id,mysql/mongodb按版本细分各有一个id, 目前id的取值范围为[1,7],数值对应的版本如下: 1:mysql-5.5,2:mysql-5.1,3:percona-5.5 4:mongodb-2.4,5:mongodb-2.6,6:mysql-5.6, 7:percona-5.6
-
- """
- d = {"Region": self.config.region}
- req and d.update(req)
- d = apis.DescribeUDBTypeRequestSchema().dumps(d)
- resp = self.invoke("DescribeUDBType", d, **kwargs)
- return apis.DescribeUDBTypeResponseSchema().loads(resp)
-
- def edit_udb_backup_blacklist(self, req=None, **kwargs):
- """ EditUDBBackupBlacklist - 编辑UDB实例的备份黑名单
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Blacklist** (str) - (Required) 黑名单,规范示例,指定库mysql.%;test.%; 指定表city.address;
- - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.EditUDBBackupBlacklistRequestSchema().dumps(d)
- resp = self.invoke("EditUDBBackupBlacklist", d, **kwargs)
- return apis.EditUDBBackupBlacklistResponseSchema().loads(resp)
-
- def fetch_udb_instance_earliest_recover_time(self, req=None, **kwargs):
- """ FetchUDBInstanceEarliestRecoverTime - 获取UDB最早可回档的时间点
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) DB实例Id
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
- - **EarliestTime** (int) - 获取最早可回档时间点
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.FetchUDBInstanceEarliestRecoverTimeRequestSchema().dumps(d)
- resp = self.invoke("FetchUDBInstanceEarliestRecoverTime", d, **kwargs)
- return apis.FetchUDBInstanceEarliestRecoverTimeResponseSchema().loads(resp)
-
- def modify_udb_instance_name(self, req=None, **kwargs):
- """ ModifyUDBInstanceName - 重命名UDB实例
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
- - **Name** (str) - (Required) 实例的新名字, 长度要求为6~63位
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.ModifyUDBInstanceNameRequestSchema().dumps(d)
- resp = self.invoke("ModifyUDBInstanceName", d, **kwargs)
- return apis.ModifyUDBInstanceNameResponseSchema().loads(resp)
-
- def modify_udb_instance_password(self, req=None, **kwargs):
- """ ModifyUDBInstancePassword - 修改DB实例的管理员密码
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的ID,该值可以通过DescribeUDBInstance获取
- - **Password** (str) - (Required) 实例的新密码
- - **AccountName** (str) - sqlserver帐号,仅在sqlserver的情况下填该参数
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.ModifyUDBInstancePasswordRequestSchema().dumps(d)
- resp = self.invoke("ModifyUDBInstancePassword", d, **kwargs)
- return apis.ModifyUDBInstancePasswordResponseSchema().loads(resp)
-
- def promote_udb_instance_to_ha(self, req=None, **kwargs):
- """ PromoteUDBInstanceToHA - 普通db升级为高可用(只针对mysql5.5及以上版本)
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.PromoteUDBInstanceToHARequestSchema().dumps(d)
- resp = self.invoke("PromoteUDBInstanceToHA", d, **kwargs)
- return apis.PromoteUDBInstanceToHAResponseSchema().loads(resp)
-
- def promote_udb_slave(self, req=None, **kwargs):
- """ PromoteUDBSlave - 从库提升为独立库
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
- - **IsForce** (bool) - 是否强制(如果从库落后可能会禁止提升),默认false 如果落后情况下,强制提升丢失数据
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.PromoteUDBSlaveRequestSchema().dumps(d)
- resp = self.invoke("PromoteUDBSlave", d, **kwargs)
- return apis.PromoteUDBSlaveResponseSchema().loads(resp)
-
- def resize_udb_instance(self, req=None, **kwargs):
- """ ResizeUDBInstance - 修改(升级和降级)UDB实例的配置,包括内存和磁盘的配置,对于内存升级无需关闭实例,其他场景需要事先关闭实例。两套参数可以配置升降机:1.配置UseSSD和SSDType 2.配置InstanceType,不需要配置InstanceMode。这两套第二套参数的优先级更高
-
- **Request**
-
- - **ProjectId** (int) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id
- - **DiskSpace** (int) - (Required) 磁盘空间(GB), 暂时支持20G-3000G
- - **MemoryLimit** (int) - (Required) 内存限制(MB),目前支持以下几档 1000M/2000M/4000M/ 6000M/8000M/ 12000M/16000M/ 24000M/32000M/ 48000M/64000M/96000M。
- - **CouponId** (str) - 使用的代金券id
- - **InstanceMode** (str) - UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例 "HA": 高可用版UDB实例 默认是"Normal"
- - **InstanceType** (str) - UDB数据库机型: "Normal": "标准机型" , "SATA_SSD": "SSD机型" , "PCIE_SSD": "SSD高性能机型" , "Normal_Volume": "标准大容量机型", "SATA_SSD_Volume": "SSD大容量机型" , "PCIE_SSD_Volume": "SSD高性能大容量机型"
- - **SSDType** (str) - SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必选
- - **StartAfterUpgrade** (bool) - DB关闭状态下升降级,升降级后是否启动DB,默认为false
- - **UDBCId** (str) - 专区的ID,如果有值表示专区中的DB配置升降级
- - **UseSSD** (bool) - 是否使用SSD,默认为false
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.ResizeUDBInstanceRequestSchema().dumps(d)
- resp = self.invoke("ResizeUDBInstance", d, **kwargs)
- return apis.ResizeUDBInstanceResponseSchema().loads(resp)
-
- def restart_udb_instance(self, req=None, **kwargs):
- """ RestartUDBInstance - 重启UDB实例
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.RestartUDBInstanceRequestSchema().dumps(d)
- resp = self.invoke("RestartUDBInstance", d, **kwargs)
- return apis.RestartUDBInstanceResponseSchema().loads(resp)
-
- def start_udb_instance(self, req=None, **kwargs):
- """ StartUDBInstance - 启动UDB实例
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.StartUDBInstanceRequestSchema().dumps(d)
- resp = self.invoke("StartUDBInstance", d, **kwargs)
- return apis.StartUDBInstanceResponseSchema().loads(resp)
-
- def stop_udb_instance(self, req=None, **kwargs):
- """ StopUDBInstance - 关闭UDB实例
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
- - **ForceToKill** (bool) - 是否使用强制手段关闭DB,默认是false
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.StopUDBInstanceRequestSchema().dumps(d)
- resp = self.invoke("StopUDBInstance", d, **kwargs)
- return apis.StopUDBInstanceResponseSchema().loads(resp)
-
- def switch_udb_instance_to_ha(self, req=None, **kwargs):
- """ SwitchUDBInstanceToHA - 普通UDB切换为高可用,原db状态为WaitForSwitch时,调用该api
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
- - **ChargeType** (str) - Year, Month, Dynamic,Trial,不填则按现在单点计费执行
- - **Quantity** (str) - 购买时长,需要和 ChargeType 搭配使用,否则使用单点计费策略的值
- - **Tag** (str) - 业务组
-
- **Response**
-
- - **DBId** (str) - 切换后高可用db实例的Id
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.SwitchUDBInstanceToHARequestSchema().dumps(d)
- resp = self.invoke("SwitchUDBInstanceToHA", d, **kwargs)
- return apis.SwitchUDBInstanceToHAResponseSchema().loads(resp)
-
- def update_udb_instance_backup_strategy(self, req=None, **kwargs):
- """ UpdateUDBInstanceBackupStrategy - 修改UDB自动备份策略
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **DBId** (str) - (Required) 主节点的Id
- - **BackupDate** (str) - 备份时期标记位。共7位,每一位为一周中一天的备份情况,0表示关闭当天备份,1表示打开当天备份。最右边的一位为星期天的备份开关,其余从右到左依次为星期一到星期六的备份配置开关,每周必须至少设置两天备份。例如:1100000表示打开星期六和星期五的备份功能
- - **BackupMethod** (str) - 选择默认的备份方式,可选 snapshot 表示使用快照/物理备份,填 logic 表示使用逻辑备份。需要同时设置BackupDate字段。(注意现在只有SSD 版本的 MySQL实例支持物理备份)
- - **BackupTime** (int) - 备份的整点时间,范围[0,23]
- - **ForceDump** (bool) - 当导出某些数据遇到问题后,是否强制导出其他剩余数据默认是false需要同时设置BackupDate字段
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.UpdateUDBInstanceBackupStrategyRequestSchema().dumps(d)
- resp = self.invoke("UpdateUDBInstanceBackupStrategy", d, **kwargs)
- return apis.UpdateUDBInstanceBackupStrategyResponseSchema().loads(resp)
-
- def update_udb_instance_slave_backup_switch(self, req=None, **kwargs):
- """ UpdateUDBInstanceSlaveBackupSwitch - 开启或者关闭UDB从库备份
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **BackupSwitch** (int) - (Required) 从库的备份开关,范围[0,1],0表示从库备份功能关闭,1 表示从库备份开关打开。
- - **MasterDBId** (str) - (Required) 主库的Id
- - **SlaveDBId** (str) - 从库的Id,如果从库备份开关设定为打开,则必须赋值。
- - **Zone** (str) - 可用区。参见 `可用区列表 `_
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.UpdateUDBInstanceSlaveBackupSwitchRequestSchema().dumps(d)
- resp = self.invoke("UpdateUDBInstanceSlaveBackupSwitch", d, **kwargs)
- return apis.UpdateUDBInstanceSlaveBackupSwitchResponseSchema().loads(resp)
-
- def update_udb_param_group(self, req=None, **kwargs):
- """ UpdateUDBParamGroup - 更新UDB配置参数项
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **GroupId** (int) - (Required) 配置参数组id,使用DescribeUDBParamGroup获得
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **Description** (str) - 参数组的描述
- - **Key** (str) - 参数名称(与Value配合使用)
- - **Name** (str) - 参数组的名字
- - **RegionFlag** (bool) - 该配置文件是否是地域级别配置文件,默认是false
- - **Value** (str) - 参数值(与Key配合使用)
-
- **Response**
-
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.UpdateUDBParamGroupRequestSchema().dumps(d)
- resp = self.invoke("UpdateUDBParamGroup", d, **kwargs)
- return apis.UpdateUDBParamGroupResponseSchema().loads(resp)
-
- def upload_udb_param_group(self, req=None, **kwargs):
- """ UploadUDBParamGroup - 导入UDB配置
-
- **Request**
-
- - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
- - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
- - **Content** (str) - (Required) 配置内容,导入的配置内容采用base64编码
- - **DBTypeId** (str) - (Required) DB类型id,DB类型id,mysql/mongodb/postgesql按版本细分 1:mysql-5.1,2:mysql-5.5,3:percona-5.5,4:mysql-5.6,5:percona-5.6,6:mysql-5.7,7:percona-5.7,8:mariadb-10.0,9:mongodb-2.4,10:mongodb-2.6,11:mongodb-3.0,12:mongodb-3.2,13:postgresql-9.4,14:postgresql-9.6
- - **Description** (str) - (Required) 参数组描述
- - **GroupName** (str) - (Required) 配置参数组名称
- - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
- - **ParamGroupTypeId** (int) - 配置文件子类型 0-未知, 1-Shardsvr-MMAPv1, 2-Shardsvr-WiredTiger, 3-Configsvr-MMAPv1, 4-Configsvr-WiredTiger, 5-Mongos
- - **RegionFlag** (bool) - 该配置文件是否是地域级别配置文件,默认是false
-
- **Response**
-
- - **GroupId** (int) - 配置参数组id
-
- """
- d = {"ProjectId": self.config.project_id, "Region": self.config.region}
- req and d.update(req)
- d = apis.UploadUDBParamGroupRequestSchema().dumps(d)
- kwargs["max_retries"] = 0
- resp = self.invoke("UploadUDBParamGroup", d, **kwargs)
- return apis.UploadUDBParamGroupResponseSchema().loads(resp)
+# -*- coding: utf-8 -*-
+
+""" Code is generated by ucloud-model, DO NOT EDIT IT. """
+from ucloud.core.client import Client
+from ucloud.services.udb.schemas import apis
+
+
+class UDBClient(Client):
+ def __init__(self, config, transport=None, middleware=None, logger=None):
+ super(UDBClient, self).__init__(config, transport, middleware, logger)
+
+ def backup_udb_instance(self, req=None, **kwargs):
+ """ BackupUDBInstance - 备份UDB实例
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupName** (str) - (Required) 备份名称
+ - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
+ - **BackupMethod** (str) - 使用的备份方式。(快照备份即物理备份。注意只有SSD版本的mysql实例支持设置为snapshot)
+ - **Blacklist** (str) - 备份黑名单列表,以 ; 分隔。注意:只有逻辑备份下备份黑名单才生效,快照备份备份黑名单下无效
+ - **ForceBackup** (bool) - true表示逻辑备份时是使用 --force 参数,false表示不使用 --force 参数。物理备份此参数无效。
+ - **UseBlacklist** (bool) - 是否使用黑名单备份,默认false
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.BackupUDBInstanceRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("BackupUDBInstance", d, **kwargs)
+ return apis.BackupUDBInstanceResponseSchema().loads(resp)
+
+ def backup_udb_instance_binlog(self, req=None, **kwargs):
+ """ BackupUDBInstanceBinlog - 备份UDB指定时间段的binlog列表
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupFile** (str) - (Required) 需要备份文件,可通过DescribeUDBInstanceBinlog获得 如果要传入多个文件名,以空格键分割,用单引号包含.
+ - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
+ - **BackupName** (str) - DB备份文件名称
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.BackupUDBInstanceBinlogRequestSchema().dumps(d)
+ resp = self.invoke("BackupUDBInstanceBinlog", d, **kwargs)
+ return apis.BackupUDBInstanceBinlogResponseSchema().loads(resp)
+
+ def backup_udb_instance_error_log(self, req=None, **kwargs):
+ """ BackupUDBInstanceErrorLog - 备份UDB指定时间段的errorlog
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupName** (str) - (Required) 备份名称
+ - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.BackupUDBInstanceErrorLogRequestSchema().dumps(d)
+ resp = self.invoke("BackupUDBInstanceErrorLog", d, **kwargs)
+ return apis.BackupUDBInstanceErrorLogResponseSchema().loads(resp)
+
+ def backup_udb_instance_slow_log(self, req=None, **kwargs):
+ """ BackupUDBInstanceSlowLog - 备份UDB指定时间段的slowlog分析结果
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupName** (str) - (Required) 备份文件名称
+ - **BeginTime** (int) - (Required) 过滤条件:起始时间(时间戳)
+ - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
+ - **EndTime** (int) - (Required) 过滤条件:结束时间(时间戳)
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.BackupUDBInstanceSlowLogRequestSchema().dumps(d)
+ resp = self.invoke("BackupUDBInstanceSlowLog", d, **kwargs)
+ return apis.BackupUDBInstanceSlowLogResponseSchema().loads(resp)
+
+ def check_recover_udb_instance(self, req=None, **kwargs):
+ """ CheckRecoverUDBInstance - 核查db是否可以使用回档功能
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **SrcDBId** (str) - (Required) 源实例的Id(只支持普通版DB不支持高可用)
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **LastestTime** (int) - 核查成功返回值为可以回档到的最近时刻,核查失败不返回
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.CheckRecoverUDBInstanceRequestSchema().dumps(d)
+ resp = self.invoke("CheckRecoverUDBInstance", d, **kwargs)
+ return apis.CheckRecoverUDBInstanceResponseSchema().loads(resp)
+
+ def check_udb_instance_to_ha_allowance(self, req=None, **kwargs):
+ """ CheckUDBInstanceToHAAllowance - 核查db是否可以升级为高可用
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
+
+ **Response**
+
+ - **Allowance** (str) - Yes ,No ,Yes即可以升级,No为不可以升级
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.CheckUDBInstanceToHAAllowanceRequestSchema().dumps(d)
+ resp = self.invoke("CheckUDBInstanceToHAAllowance", d, **kwargs)
+ return apis.CheckUDBInstanceToHAAllowanceResponseSchema().loads(resp)
+
+ def clear_udb_log(self, req=None, **kwargs):
+ """ ClearUDBLog - 清除UDB实例的log
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **DBId** (str) - (Required) DB实例的id,该值可以通过DescribeUDBInstance获取
+ - **LogType** (int) - (Required) 日志类型,10-error(暂不支持)、20-slow(暂不支持 )、30-binlog
+ - **BeforeTime** (int) - 删除时间点(至少前一天)之前log,采用时间戳(秒),默认当 前时间点前一天
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.ClearUDBLogRequestSchema().dumps(d)
+ resp = self.invoke("ClearUDBLog", d, **kwargs)
+ return apis.ClearUDBLogResponseSchema().loads(resp)
+
+ def create_udb_instance(self, req=None, **kwargs):
+ """ CreateUDBInstance - 创建UDB实例(包括创建mysql master节点、mongodb primary/configsvr节点和从备份恢复实例)
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **AdminPassword** (str) - (Required) 管理员密码
+ - **DBTypeId** (str) - (Required) DB类型id,mysql/mongodb/postgesql按版本细分 1:mysql-5.1,2:mysql-5.5,3:percona-5.5,4:mysql-5.6,5:percona-5.6,6:mysql-5.7,7:percona-5.7,8:mariadb-10.0,9:mongodb-2.4,10:mongodb-2.6,11:mongodb-3.0,12:mongodb-3.2,13:postgresql-9.4,14:postgresql-9.6,14:postgresql-10.4
+ - **DiskSpace** (int) - (Required) 磁盘空间(GB), 暂时支持20G - 3000G
+ - **MemoryLimit** (int) - (Required) 内存限制(MB),目前支持以下几档 1000M/2000M/4000M/ 6000M/8000M/12000M/16000M/ 24000M/32000M/48000M/ 64000M/96000M
+ - **Name** (str) - (Required) 实例名称,至少6位
+ - **ParamGroupId** (int) - (Required) DB实例使用的配置参数组id
+ - **Port** (int) - (Required) 端口号,mysql默认3306,mongodb默认27017,postgresql默认5432
+ - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
+ - **AdminUser** (str) - 管理员帐户名,默认root
+ - **BackupCount** (int) - 备份策略,每周备份数量,默认7次
+ - **BackupDuration** (int) - 备份策略,备份时间间隔,单位小时计,默认24小时
+ - **BackupId** (int) - 备份id,如果指定,则表明从备份恢复实例
+ - **BackupTime** (int) - 备份策略,备份开始时间,单位小时计,默认1点
+ - **BackupZone** (str) - 跨可用区高可用备库所在可用区,参见 `可用区列表 `_
+ - **CPU** (int) - cpu核数
+ - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Month
+ - **ClusterRole** (str) - 当DB类型(DBTypeId)为mongodb时,需要指定mongo的角色,可选值为configsrv (配置节点),shardsrv (数据节点)
+ - **CouponId** (str) - 使用的代金券id
+ - **DisableSemisync** (bool) - 是否开启异步高可用,默认不填,可置为true
+ - **HAArch** (str) - 高可用架构:1) haproxy(默认): 当前仅支持mysql。2) sentinel: 基于vip和哨兵节点的架构,当前支持mysql和pg。
+ - **InstanceMode** (str) - UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例 "HA": 高可用版UDB实例 默认是"Normal"
+ - **InstanceType** (str) - UDB数据库机型
+ - **Quantity** (int) - 购买时长,默认值1
+ - **SSDType** (str) - SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必选
+ - **SubnetId** (str) - 子网ID
+ - **Tag** (str) - 实例所在的业务组名称
+ - **UDBCId** (str) - 专区ID信息(如果这个参数存在这说明是在专区中创建DB)
+ - **UseSSD** (bool) - 是否使用SSD,默认为false。目前主要可用区、海外机房、新机房只提供SSD资源,非SSD资源不再提供。
+ - **VPCId** (str) - VPC的ID
+
+ **Response**
+
+ - **DBId** (str) - BD实例id
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.CreateUDBInstanceRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("CreateUDBInstance", d, **kwargs)
+ return apis.CreateUDBInstanceResponseSchema().loads(resp)
+
+ def create_udb_instance_by_recovery(self, req=None, **kwargs):
+ """ CreateUDBInstanceByRecovery - 创建db,将新创建的db恢复到指定db某个指定时间点
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **Name** (str) - (Required) 实例名称,至少6位
+ - **RecoveryTime** (int) - (Required) 恢复到某个时间点的时间戳(UTC时间格式,默认单位秒)
+ - **SrcDBId** (str) - (Required) 源实例的Id
+ - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Dynamic
+ - **CouponId** (str) - 使用的代金券id
+ - **Quantity** (int) - 购买时长,默认值1
+ - **SubnetId** (str) - 子网ID
+ - **UDBCId** (str) - 专区的Id
+ - **UseSSD** (bool) - 指定是否是否使用SSD,默认使用主库的配置
+ - **VPCId** (str) - VPC的ID
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **DBId** (str) - db实例id
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.CreateUDBInstanceByRecoveryRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("CreateUDBInstanceByRecovery", d, **kwargs)
+ return apis.CreateUDBInstanceByRecoveryResponseSchema().loads(resp)
+
+ def create_udb_param_group(self, req=None, **kwargs):
+ """ CreateUDBParamGroup - 从已有配置文件创建新配置文件
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **DBTypeId** (str) - (Required) DB类型id,mysql/mongodb/postgesql按版本细分 1:mysql-5.1,2:mysql-5.5,3:percona-5.5,4:mysql-5.6,5:percona-5.6,6:mysql-5.7,7:percona-5.7,8:mariadb-10.0,9:mongodb-2.4,10:mongodb-2.6,11:mongodb-3.0,12:mongodb-3.2,13:postgresql-9.4,14:postgresql-9.6
+ - **Description** (str) - (Required) 参数组描述
+ - **GroupName** (str) - (Required) 新配置参数组名称
+ - **SrcGroupId** (int) - (Required) 源参数组id
+ - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
+ - **RegionFlag** (bool) - 是否是地域级别的配置文件,默认是false
+
+ **Response**
+
+ - **GroupId** (int) - 新配置参数组id
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.CreateUDBParamGroupRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("CreateUDBParamGroup", d, **kwargs)
+ return apis.CreateUDBParamGroupResponseSchema().loads(resp)
+
+ def create_udb_replication_instance(self, req=None, **kwargs):
+ """ CreateUDBReplicationInstance - 创建MongoDB的副本节点(包括仲裁)
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **Name** (str) - (Required) 实例名称,至少6位
+ - **SrcId** (str) - (Required) primary节点的DBId,该值可以通过DescribeUDBInstance获取
+ - **CouponId** (str) - 使用的代金券id
+ - **IsArbiter** (bool) - 是否是仲裁节点,默认false,仲裁节点按最小机型创建
+ - **Port** (int) - 端口号,默认27017,取值范围3306至65535。
+ - **UseSSD** (bool) - 是否使用SSD,默认不使用
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **DBId** (str) - 创建从节点的DBId
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.CreateUDBReplicationInstanceRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("CreateUDBReplicationInstance", d, **kwargs)
+ return apis.CreateUDBReplicationInstanceResponseSchema().loads(resp)
+
+ def create_udb_route_instance(self, req=None, **kwargs):
+ """ CreateUDBRouteInstance - 创建mongos实例
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **ConfigsvrId** (list) - (Required) 配置服务器的dbid,允许一个或者三个。
+ - **DBTypeId** (str) - (Required) DB类型id,mongodb按版本细分有1:mongodb-2.4,2:mongodb-2.6,3:mongodb-3.0,4:mongodb-3.2
+ - **DiskSpace** (int) - (Required) 磁盘空间(GB), 暂时支持20G - 500G
+ - **MemoryLimit** (int) - (Required) 内存限制(MB),目前支持以下几档 600M/1500M/3000M /6000M/15000M/30000M
+ - **Name** (str) - (Required) 实例名称,至少6位
+ - **ParamGroupId** (int) - (Required) DB实例使用的配置参数组id
+ - **Port** (int) - (Required) 端口号,mongodb默认27017
+ - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Month
+ - **CouponId** (str) - 使用的代金券id
+ - **Quantity** (int) - 购买时长,默认值1
+ - **UseSSD** (bool) - 是否使用SSD,默认为false
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **DBId** (str) - db实例id
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.CreateUDBRouteInstanceRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("CreateUDBRouteInstance", d, **kwargs)
+ return apis.CreateUDBRouteInstanceResponseSchema().loads(resp)
+
+ def create_udb_slave(self, req=None, **kwargs):
+ """ CreateUDBSlave - 创建UDB实例的slave
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **Name** (str) - (Required) 实例名称,至少6位
+ - **SrcId** (str) - (Required) master实例的DBId,该值可以通过DescribeUDBInstance获取
+ - **CouponId** (str) - 使用的代金券id
+ - **DiskSpace** (int) - 磁盘空间(GB), 暂时支持20G - 3000G(API支持,前端暂时只开放内存定制)
+ - **InstanceMode** (str) - UDB实例部署模式,可选值如下:Normal: 普通单点实例HA: 高可用部署实例
+ - **InstanceType** (str) - UDB实例类型:Normal和SATA_SSD
+ - **IsLock** (bool) - 是否锁主库,默认为true
+ - **MemoryLimit** (int) - 内存限制(MB),目前支持以下几档 1000M/2000M/4000M/ 6000M/8000M/12000M/16000M/ 24000M/32000M/48000M/ 64000M/96000M
+ - **Port** (int) - 端口号,mysql默认3306
+ - **SSDType** (str) - SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必选
+ - **UseSSD** (bool) - 是否使用SSD,默认为false
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **DBId** (str) - 创建slave的DBId
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.CreateUDBSlaveRequestSchema().dumps(d)
+ kwargs["max_retries"] = 0
+ resp = self.invoke("CreateUDBSlave", d, **kwargs)
+ return apis.CreateUDBSlaveResponseSchema().loads(resp)
+
+ def delete_udb_backup(self, req=None, **kwargs):
+ """ DeleteUDBBackup - 删除UDB实例备份
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupId** (int) - (Required) 备份id,可通过DescribeUDBBackup获得
+ - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
+ - **BackupZone** (str) - 跨可用区高可用备库所在可用区,参见[可用区列表]
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DeleteUDBBackupRequestSchema().dumps(d)
+ resp = self.invoke("DeleteUDBBackup", d, **kwargs)
+ return apis.DeleteUDBBackupResponseSchema().loads(resp)
+
+ def delete_udb_instance(self, req=None, **kwargs):
+ """ DeleteUDBInstance - 删除UDB实例
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **DBId** (str) - (Required) DB实例的id,该值可以通过DescribeUDBInstance获取
+ - **UDBCId** (str) - 专区ID
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DeleteUDBInstanceRequestSchema().dumps(d)
+ resp = self.invoke("DeleteUDBInstance", d, **kwargs)
+ return apis.DeleteUDBInstanceResponseSchema().loads(resp)
+
+ def delete_udb_log_package(self, req=None, **kwargs):
+ """ DeleteUDBLogPackage - 删除UDB日志包
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupId** (int) - (Required) 日志包id,可通过DescribeUDBLogPackage获得
+ - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
+ - **BackupZone** (str) - 跨可用区高可用备库所在可用区
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DeleteUDBLogPackageRequestSchema().dumps(d)
+ resp = self.invoke("DeleteUDBLogPackage", d, **kwargs)
+ return apis.DeleteUDBLogPackageResponseSchema().loads(resp)
+
+ def delete_udb_param_group(self, req=None, **kwargs):
+ """ DeleteUDBParamGroup - 删除配置参数组
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **GroupId** (int) - (Required) 参数组id,可通过DescribeUDBParamGroup获取
+ - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
+ - **RegionFlag** (bool) - 是否属于地域级别
+
+ **Response**
+
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DeleteUDBParamGroupRequestSchema().dumps(d)
+ resp = self.invoke("DeleteUDBParamGroup", d, **kwargs)
+ return apis.DeleteUDBParamGroupResponseSchema().loads(resp)
+
+ def describe_udb_backup(self, req=None, **kwargs):
+ """ DescribeUDBBackup - 列表UDB实例备份信息.Zone不填表示多可用区,填代表单可用区
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **Limit** (int) - (Required) 分页显示的条目数,列表操作则指定
+ - **Offset** (int) - (Required) 分页显示的起始偏移,列表操作则指定
+ - **BackupId** (int) - 如果填了BackupId, 那么只拉取这个备份的记录
+ - **BackupType** (int) - 备份类型,取值为0或1,0表示自动,1表示手动
+ - **BeginTime** (int) - 过滤条件:起始时间(Unix时间戳)
+ - **ClassType** (str) - 如果未指定GroupId,则可选是否选取特定DB类型的配置(sql, nosql, postgresql, sqlserver)
+ - **DBId** (str) - DB实例Id,如果指定,则只获取该db的备份信息 该值可以通过DescribeUDBInstance获取
+ - **EndTime** (int) - 过滤条件:结束时间(Unix时间戳)
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **DataSet** (list) - 见 **UDBBackupSet** 模型定义
+ - **TotalCount** (int) - 满足条件备份总数,如果指定dbid,则是该db备份总数
+
+ **Response Model**
+
+ **UDBBackupSet**
+
+ - **BackupEndTime** (int) - 备份完成时间(Unix时间戳)
+ - **BackupId** (int) - 备份id
+ - **BackupName** (str) - 备份名称
+ - **BackupSize** (int) - 备份文件大小(字节)
+ - **BackupTime** (int) - 备份时间(Unix时间戳)
+ - **BackupType** (int) - 备份类型,取值为0或1,0表示自动,1表示手动
+ - **BackupZone** (str) - 跨机房高可用备库所在可用区
+ - **DBId** (str) - dbid
+ - **DBName** (str) - 对应的db名称
+ - **ErrorInfo** (str) - 备份错误信息
+ - **State** (str) - 备份状态 Backuping // 备份中 Success // 备份成功 Failed // 备份失败 Expired // 备份过期
+ - **Zone** (str) - 备份所在可用区
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBBackupRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBBackup", d, **kwargs)
+ return apis.DescribeUDBBackupResponseSchema().loads(resp)
+
+ def describe_udb_backup_blacklist(self, req=None, **kwargs):
+ """ DescribeUDBBackupBlacklist - 获取UDB实例的备份黑名单
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **DBId** (str) - (Required) DB实例Id,该值可以通过DescribeUDBInstance获取
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **Blacklist** (str) - DB的黑名单列表, db.%为指定库 dbname.tablename为指定表
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBBackupBlacklistRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBBackupBlacklist", d, **kwargs)
+ return apis.DescribeUDBBackupBlacklistResponseSchema().loads(resp)
+
+ def describe_udb_binlog_backup_url(self, req=None, **kwargs):
+ """ DescribeUDBBinlogBackupURL - 获取UDB的Binlog备份地址
+
+ **Request**
+
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupId** (int) - (Required) DB实例binlog备份ID,可以从DescribeUDBLogPackage结果当中获得
+ - **DBId** (str) - (Required) DB实例Id
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **BackupPath** (str) - DB实例备份文件的公网地址
+ - **InnerBackupPath** (str) - DB实例备份文件的内网地址
+
+ """
+ d = {"Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBBinlogBackupURLRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBBinlogBackupURL", d, **kwargs)
+ return apis.DescribeUDBBinlogBackupURLResponseSchema().loads(resp)
+
+ def describe_udb_instance(self, req=None, **kwargs):
+ """ DescribeUDBInstance - 获取UDB实例信息,支持两类操作:(1)指定DBId用于获取该db的信息;(2)指定ClassType、Offset、Limit用于列表操作,查询某一个类型db。
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **ClassType** (str) - DB种类,如果是列表操作,则需要指定,不区分大小写,其取值如下:mysql: SQL;mongo: NOSQL;postgresql: postgresql
+ - **DBId** (str) - DB实例id,如果指定则获取单个db实例的描述,否则为列表操作。 指定DBId时无需填写ClassType、Offset、Limit
+ - **IncludeSlaves** (bool) - 当只获取这个特定DBId的信息时,如果有该选项,那么把这个DBId实例的所有从库信息一起拉取并返回
+ - **IsInUDBC** (bool) - 是否查看专区里面DB
+ - **Limit** (int) - 分页显示数量,列表操作时必填
+ - **Offset** (int) - 分页显示起始偏移位置,列表操作时必填
+ - **UDBCId** (str) - IsInUDBC为True,UDBCId为空,说明查看整个可用区的专区的db,如果UDBId不为空则只查看此专区下面的db
+ - **Zone** (str) - 可用区,不填时默认全部可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **DataSet** (list) - 见 **UDBInstanceSet** 模型定义
+ - **TotalCount** (int) - 用户db组的数量,对于 mysql: 主从结对数量,没有slave,则只有master mongodb: 副本集数量
+
+ **Response Model**
+
+ **UDBSlaveInstanceSet**
+
+ - **AdminUser** (str) - 管理员帐户名,默认root
+ - **BackupBeginTime** (int) - 备份策略,不可修改,开始时间,单位小时计,默认3点
+ - **BackupBlacklist** (str) - 备份策略,备份黑名单,mongodb则不适用
+ - **BackupCount** (int) - 备份策略,不可修改,备份文件保留的数量,默认7次
+ - **BackupDate** (str) - 备份日期标记位。共7位,每一位为一周中一天的备份情况 0表示关闭当天备份,1表示打开当天备份。最右边的一位 为星期天的备份开关,其余从右到左依次为星期一到星期 六的备份配置开关,每周必须至少设置两天备份。 例如:1100000 表示打开星期六和星期五的自动备份功能
+ - **BackupDuration** (int) - 备份策略,一天内备份时间间隔,单位小时,默认24小时
+ - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Dynamic
+ - **ClusterRole** (str) - 当DB类型为mongodb时,返回该实例所在集群中的角色,包括:mongos、configsrv_sccc、configsrv_csrs、shardsrv_datanode、shardsrv_arbiter,其中congfigsrv分为sccc和csrs两种模式,shardsrv分为datanode和arbiter两种模式
+ - **CreateTime** (int) - DB实例创建时间,采用UTC计时时间戳
+ - **DBId** (str) - DB实例id
+ - **DBTypeId** (str) - DB类型id,mysql/mongodb按版本细分各有一个id 目前id的取值范围为[1,7],数值对应的版本如下: 1:mysql-5.5,2:mysql-5.1,3:percona-5.5 4:mongodb-2.4,5:mongodb-2.6,6:mysql-5.6, 7:percona-5.6
+ - **DataFileSize** (float) - DB实例数据文件大小,单位GB
+ - **DiskSpace** (int) - 磁盘空间(GB), 默认根据配置机型
+ - **DiskUsedSize** (float) - DB实例磁盘已使用空间,单位GB
+ - **ExpiredTime** (int) - DB实例过期时间,采用UTC计时时间戳
+ - **InstanceMode** (str) - UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例;"HA": 高可用版UDB实例
+ - **InstanceType** (str) - UDB数据库机型
+ - **InstanceTypeId** (int) - UDB数据库机型ID
+ - **LogFileSize** (float) - DB实例日志文件大小,单位GB
+ - **MemoryLimit** (int) - 内存限制(MB),默认根据配置机型
+ - **ModifyTime** (int) - DB实例修改时间,采用UTC计时时间戳
+ - **Name** (str) - 实例名称,至少6位
+ - **ParamGroupId** (int) - DB实例使用的配置参数组id
+ - **Port** (int) - 端口号,mysql默认3306,mongodb默认27017
+ - **Role** (str) - DB实例角色,mysql区分master/slave,mongodb多种角色
+ - **SSDType** (str) - SSD类型,SATA/PCI-E
+ - **SrcDBId** (str) - 对mysql的slave而言是master的DBId,对master则为空, 对mongodb则是副本集id
+ - **State** (str) - DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败
+ - **SubnetId** (str) - 子网ID
+ - **SystemFileSize** (float) - DB实例系统文件大小,单位GB
+ - **Tag** (str) - 获取资源其他信息
+ - **UseSSD** (bool) - 是否使用SSD
+ - **VPCId** (str) - VPC的ID
+ - **VirtualIP** (str) - DB实例虚ip
+ - **VirtualIPMac** (str) - DB实例虚ip的mac地址
+ - **Zone** (str) - 可用区
+
+ **UDBInstanceSet**
+
+ - **AdminUser** (str) - 管理员帐户名,默认root
+ - **BackupBeginTime** (int) - 备份策略,不可修改,开始时间,单位小时计,默认3点
+ - **BackupBlacklist** (str) - 备份策略,备份黑名单,mongodb则不适用
+ - **BackupCount** (int) - 备份策略,不可修改,备份文件保留的数量,默认7次
+ - **BackupDate** (str) - 备份日期标记位。共7位,每一位为一周中一天的备份情况 0表示关闭当天备份,1表示打开当天备份。最右边的一位 为星期天的备份开关,其余从右到左依次为星期一到星期 六的备份配置开关,每周必须至少设置两天备份。 例如:1100000 表示打开星期六和星期五的自动备份功能
+ - **BackupDuration** (int) - 备份策略,一天内备份时间间隔,单位小时,默认24小时
+ - **BackupZone** (str) - 跨可用区高可用备库所在可用区
+ - **ChargeType** (str) - Year, Month, Dynamic,Trial,默认: Dynamic
+ - **CluserRole** (str) - 当DB类型为mongodb时,返回该实例所在集群中的角色,包括:mongos、configsrv_sccc、configsrv_csrs、shardsrv_datanode、shardsrv_arbiter,其中congfigsrv分为sccc和csrs两种模式,shardsrv分为datanode和arbiter两种模式
+ - **CreateTime** (int) - DB实例创建时间,采用UTC计时时间戳
+ - **DBId** (str) - DB实例id
+ - **DBTypeId** (str) - DB类型id,mysql/mongodb按版本细分各有一个id 目前id的取值范围为[1,7],数值对应的版本如下: 1:mysql-5.5,2:mysql-5.1,3:percona-5.5 4:mongodb-2.4,5:mongodb-2.6,6:mysql-5.6, 7:percona-5.6
+ - **DataFileSize** (float) - DB实例数据文件大小,单位GB
+ - **DataSet** (list) - 见 **UDBSlaveInstanceSet** 模型定义
+ - **DiskSpace** (int) - 磁盘空间(GB), 默认根据配置机型
+ - **DiskUsedSize** (float) - DB实例磁盘已使用空间,单位GB
+ - **ExpiredTime** (int) - DB实例过期时间,采用UTC计时时间戳
+ - **InstanceMode** (str) - UDB实例模式类型, 可选值如下: “Normal”: 普通版UDB实例 “HA”: 高可用版UDB实例
+ - **InstanceType** (str) - UDB数据库机型
+ - **InstanceTypeId** (int) - UDB数据库机型ID
+ - **LogFileSize** (float) - DB实例日志文件大小,单位GB
+ - **MemoryLimit** (int) - 内存限制(MB),默认根据配置机型
+ - **ModifyTime** (int) - DB实例修改时间,采用UTC计时时间戳
+ - **Name** (str) - 实例名称,至少6位
+ - **ParamGroupId** (int) - DB实例使用的配置参数组id
+ - **Port** (int) - 端口号,mysql默认3306,mongodb默认27017
+ - **Role** (str) - DB实例角色,mysql区分master/slave,mongodb多种角色
+ - **SSDType** (str) - SSD类型,SATA/PCI-E
+ - **SrcDBId** (str) - 对mysql的slave而言是master的DBId,对master则为空, 对mongodb则是副本集id
+ - **State** (str) - DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败
+ - **SubnetId** (str) - 子网ID
+ - **SystemFileSize** (float) - DB实例系统文件大小,单位GB
+ - **Tag** (str) - 获取资源其他信息
+ - **UseSSD** (bool) - 是否使用SSD
+ - **VPCId** (str) - VPC的ID
+ - **VirtualIP** (str) - DB实例虚ip
+ - **VirtualIPMac** (str) - DB实例虚ip的mac地址
+ - **Zone** (str) - DB实例所在可用区
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBInstanceRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBInstance", d, **kwargs)
+ return apis.DescribeUDBInstanceResponseSchema().loads(resp)
+
+ def describe_udb_instance_backup_state(self, req=None, **kwargs):
+ """ DescribeUDBInstanceBackupState - 获取UDB实例备份状态
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupId** (int) - (Required) 备份记录ID
+ - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
+ - **BackupZone** (str) - 跨可用区高可用备库所在可用区,参见[可用区列表]
+
+ **Response**
+
+ - **BackupEndTime** (int) -
+ - **BackupSize** (int) -
+ - **State** (str) - 备份状态 0 Backuping // 备份中 1 Success // 备份成功 2 Failed // 备份失败 3 Expired // 备份过期
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBInstanceBackupStateRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBInstanceBackupState", d, **kwargs)
+ return apis.DescribeUDBInstanceBackupStateResponseSchema().loads(resp)
+
+ def describe_udb_instance_backup_url(self, req=None, **kwargs):
+ """ DescribeUDBInstanceBackupURL - 获取UDB备份下载地址
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupId** (int) - (Required) DB实例备份ID,该值可以通过DescribeUDBBackup获取
+ - **DBId** (str) - (Required) DB实例Id,该值可通过DescribeUDBInstance获取
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **BackupPath** (str) - DB实例备份文件公网的地址
+ - **InnerBackupPath** (str) - DB实例备份文件内网的地址
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBInstanceBackupURLRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBInstanceBackupURL", d, **kwargs)
+ return apis.DescribeUDBInstanceBackupURLResponseSchema().loads(resp)
+
+ def describe_udb_instance_binlog(self, req=None, **kwargs):
+ """ DescribeUDBInstanceBinlog - 获取UDB指定时间段的binlog列表
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BeginTime** (int) - (Required) 过滤条件:起始时间(时间戳)
+ - **DBId** (str) - (Required) DB实例Id
+ - **EndTime** (int) - (Required) 过滤条件:结束时间(时间戳)
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **DataSet** (list) - 见 **UDBInstanceBinlogSet** 模型定义
+
+ **Response Model**
+
+ **UDBInstanceBinlogSet**
+
+ - **BeginTime** (int) - Binlog文件生成时间(时间戳)
+ - **EndTime** (int) - Binlog文件结束时间(时间戳)
+ - **Name** (str) - Binlog文件名
+ - **Size** (int) - Binlog文件大小
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBInstanceBinlogRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBInstanceBinlog", d, **kwargs)
+ return apis.DescribeUDBInstanceBinlogResponseSchema().loads(resp)
+
+ def describe_udb_instance_binlog_backup_state(self, req=None, **kwargs):
+ """ DescribeUDBInstanceBinlogBackupState - 获取udb实例备份状态
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupId** (int) - (Required) 备份记录ID
+ - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
+ - **BackupZone** (str) - 跨可用区高可用备库所在可用区
+
+ **Response**
+
+ - **BackupSize** (int) - 备份文件大小(字节)
+ - **State** (str) - 备份状态 0 Backuping // 备份中 1 Success // 备份成功 2 Failed // 备份失败 3 Expired // 备份过期
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBInstanceBinlogBackupStateRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBInstanceBinlogBackupState", d, **kwargs)
+ return apis.DescribeUDBInstanceBinlogBackupStateResponseSchema().loads(
+ resp
+ )
+
+ def describe_udb_instance_price(self, req=None, **kwargs):
+ """ DescribeUDBInstancePrice - 获取UDB实例价格信息
+
+ **Request**
+
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **DBTypeId** (str) - (Required) UDB实例的DB版本字符串
+ - **DiskSpace** (int) - (Required) 磁盘空间(GB),暂时支持20(GB) - 3000(GB), 输入不带单位
+ - **MemoryLimit** (int) - (Required) 内存限制(MB),单位为MB.目前支持:1000-96000
+ - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_
+ - **ChargeType** (str) - Year,按年付费; Month,按月付费 Dynamic,按需付费(需开启权限) Trial,试用(需开启权限)默认为月付
+ - **Count** (int) - 购买DB实例数量,最大数量为10台, 默认为1台
+ - **InstanceMode** (str) - 实例的部署类型。可选值为:Normal: 普通单点实例,Slave: 从库实例,HA: 高可用部署实例,默认是Normal
+ - **Quantity** (int) - DB购买多少个"计费时间单位",默认值为1。比如:买2个月,Quantity就是2。如果计费单位是“按月”,并且Quantity为0,表示“购买到月底”
+ - **SSDType** (str) - SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必填
+ - **UseSSD** (str) - 是否使用SSD,只能填true或false,默认为false
+
+ **Response**
+
+ - **DataSet** (list) - 见 **UDBInstancePriceSet** 模型定义
+
+ **Response Model**
+
+ **UDBInstancePriceSet**
+
+ - **ChargeType** (str) - Year, Month, Dynamic,Trial
+ - **Price** (int) - 价格,单位为分
+
+ """
+ d = {"Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBInstancePriceRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBInstancePrice", d, **kwargs)
+ return apis.DescribeUDBInstancePriceResponseSchema().loads(resp)
+
+ def describe_udb_instance_state(self, req=None, **kwargs):
+ """ DescribeUDBInstanceState - 获取UDB实例状态
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **DBId** (str) - (Required) 实例的Id,该值可以通过DescribeUDBInstance获取
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **State** (str) - DB状态标记 Init:初始化中;Fail:安装失败; Starting:启动中; Running : 运行 ;Shutdown:关闭中; Shutoff :已关闭; Delete:已删除; Upgrading:升级中; Promoting: 提升为独库进行中; Recovering: 恢复中; Recover fail:恢复失败。
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBInstanceStateRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBInstanceState", d, **kwargs)
+ return apis.DescribeUDBInstanceStateResponseSchema().loads(resp)
+
+ def describe_udb_instance_upgrade_price(self, req=None, **kwargs):
+ """ DescribeUDBInstanceUpgradePrice - 获取UDB实例升降级价格信息
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **DBId** (str) - (Required) 实例的Id
+ - **DiskSpace** (int) - (Required) 磁盘空间(GB), 暂时支持20G - 500G
+ - **MemoryLimit** (int) - (Required) 内存限制(MB)
+ - **SSDType** (str) - SSD类型,可选值为"SATA"、"PCI-E",如果UseSSD为true ,则必选
+ - **UseSSD** (bool) - 是否使用SSD,默认为false
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **Price** (int) - 价格,单位为分
+
+ """
+ d = {"ProjectId": self.config.project_id, "Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBInstanceUpgradePriceRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBInstanceUpgradePrice", d, **kwargs)
+ return apis.DescribeUDBInstanceUpgradePriceResponseSchema().loads(resp)
+
+ def describe_udb_log_backup_url(self, req=None, **kwargs):
+ """ DescribeUDBLogBackupURL - 获取UDB的slowlog备份地址
+
+ **Request**
+
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **BackupId** (int) - (Required) DB实例备份ID
+ - **DBId** (str) - (Required) DB实例Id
+ - **Zone** (str) - 可用区。参见 `可用区列表 `_
+
+ **Response**
+
+ - **BackupPath** (str) - 备份外网URL
+ - **UsernetPath** (str) - 备份用户网URL
+
+ """
+ d = {"Region": self.config.region}
+ req and d.update(req)
+ d = apis.DescribeUDBLogBackupURLRequestSchema().dumps(d)
+ resp = self.invoke("DescribeUDBLogBackupURL", d, **kwargs)
+ return apis.DescribeUDBLogBackupURLResponseSchema().loads(resp)
+
+ def describe_udb_log_package(self, req=None, **kwargs):
+ """ DescribeUDBLogPackage - 列表UDB实例binlog或slowlog或errorlog备份信息
+
+ **Request**
+
+ - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_
+ - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_
+ - **Limit** (int) - (Required) 分页显示的条目数,列表操作则指定
+ - **Offset** (int) - (Required) 分页显示的起始偏移,列表操作则指定
+ - **BeginTime** (int) - 过滤条件:起始时间(时间戳)
+ - **DBId** (str) - DB实例Id,如果指定,则只获取该db的备份信息
+ - **EndTime** (int) - 过滤条件:结束时间(时间戳)
+ - **Type** (int) - 需要列出的备份文件类型,每种文件的值如下 2 : BINLOG\\_BACKUP 3 : SLOW\\_QUERY\\_BACKUP 4 : ERRORLOG\\_BACKUP
+ - **Types** (list) - Types作为Type的补充,支持多值传入,可以获取多个类型的日志记录,如:Types.0=2&Types.1=3
+ - **Zone** (str) - 可用区。参见 `可用区列表