[DWS] Add support for cluster tag managment#392
Conversation
…k-is-not-defined' into 366-tags-functionality-in-dws-sdk-is-not-defined # Conflicts: # otcextensions/sdk/dws/v1/_proxy.py # otcextensions/sdk/dws/v1/tag.py # otcextensions/tests/functional/sdk/dws/v1/test_tag.py
…k-is-not-defined' into 366-tags-functionality-in-dws-sdk-is-not-defined # Conflicts: # otcextensions/sdk/dws/v1/_proxy.py
b7e7ec3 to
89cec09
Compare
|
|
||
| openstack.enable_logging(True) | ||
| conn = openstack.connect(cloud='otc') | ||
|
|
There was a problem hiding this comment.
add please here: sdk.register_otc_extensions(conn)
also you will need to add this import: from otcextensions import sdk
this comment is for all examples
There was a problem hiding this comment.
Add the following to all examples:
<>
from otcextensions import sdk
<>
sdk.register_otc_extensions(conn)
<>
| cluster_id = 'cluster-uuid' | ||
| tag = {'key': 'example_key', 'value': 'example_value'} | ||
|
|
||
| result = conn.dws.create_cluster_tag(cluster_id, tag) |
There was a problem hiding this comment.
Updated to **tag
| {'key': 'key2'} | ||
| ] | ||
|
|
||
| conn.dws.cluster_tags_batch_delete(cluster_id, tags_to_delete) |
There was a problem hiding this comment.
Updated to *tags_to_delete
| {'key': 'key2', 'value': 'value2'} | ||
| ] | ||
|
|
||
| result = conn.dws.cluster_tags_batch_create(cluster_id, tags_to_create) |
There was a problem hiding this comment.
Updated to *tags_to_create
| time.sleep(60) | ||
| self.wait_for_cluster(cluster, interval, wait) | ||
|
|
||
| def list_cluster_tags(self, cluster): |
There was a problem hiding this comment.
rename please to cluster_tags
There was a problem hiding this comment.
Renamed, also in test, doc sections
| :param cluster: Cluster ID or an instance of | ||
| `otcextensions.sdk.dws.v1.cluster.Cluster`. | ||
| :param tags: List of dictionaries of tags to delete. | ||
| :return: Response object. |
There was a problem hiding this comment.
or object Tag, not response
There was a problem hiding this comment.
Changed response to 'otcextensions.sdk.dws.v1.tag.Tag'
| uri = utils.urljoin('clusters', cluster_id, 'tags/action') | ||
|
|
||
| body = {'action': action, 'tags': tags} | ||
| return session.post(uri, json=body) |
There was a problem hiding this comment.
it should return not 'clear' response, it must be object of class Tag
There was a problem hiding this comment.
you need to translate response into object
There was a problem hiding this comment.
Changed response into object
|
|
||
| def test_list_cluster_tags(self): | ||
| """Test listing all tags of a cluster.""" | ||
| tags = list(self.client.list_cluster_tags(self.cluster_id)) |
There was a problem hiding this comment.
you need to create instance and check that list returns more or equal 1, this test checks nothing
There was a problem hiding this comment.
Updated the test
fa4f96d
32cb134 to
d975122
Compare
d975122 to
1f83446
Compare
1f83446 to
3d12938
Compare
|
Build succeeded. ✔️ otc-tox-docs SUCCESS in 14m 21s |
Closes #366