Skip to content

Commit 1dbbf61

Browse files
committed
fix(Global Tagging): update service after recent API changes
1 parent 3fe93b6 commit 1dbbf61

File tree

4 files changed

+811
-105
lines changed

4 files changed

+811
-105
lines changed

examples/test_global_tagging_v1_examples.py

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
1615
"""
1716
Examples for GlobalTaggingV1
1817
"""
@@ -48,7 +47,6 @@ class TestGlobalTaggingV1Examples():
4847
"""
4948
Example Test Class for GlobalTaggingV1
5049
"""
51-
5250
@classmethod
5351
def setup_class(cls):
5452
global global_tagging_service
@@ -73,8 +71,27 @@ def setup_class(cls):
7371
print('Setup complete.')
7472

7573
needscredentials = pytest.mark.skipif(
76-
not os.path.exists(config_file), reason="External configuration not available, skipping..."
77-
)
74+
not os.path.exists(config_file),
75+
reason="External configuration not available, skipping...")
76+
77+
@needscredentials
78+
def test_create_tag_example(self):
79+
"""
80+
create_tag request example
81+
"""
82+
try:
83+
# begin-create_tag
84+
85+
create_tag_results = global_tagging_service.create_tag(
86+
tag_names=['env:example-access-tag'],
87+
tag_type='access').get_result()
88+
89+
print(json.dumps(create_tag_results, indent=2))
90+
91+
# end-create_tag
92+
93+
except ApiException as e:
94+
pytest.fail(str(e))
7895

7996
@needscredentials
8097
def test_list_tags_example(self):
@@ -85,7 +102,11 @@ def test_list_tags_example(self):
85102
# begin-list_tags
86103

87104
tag_list = global_tagging_service.list_tags(
88-
attached_only=True).get_result()
105+
tag_type='user',
106+
attached_only=True,
107+
full_data=True,
108+
providers=['ghost'],
109+
order_by_name='asc').get_result()
89110

90111
print(json.dumps(tag_list, indent=2))
91112

@@ -102,14 +123,12 @@ def test_attach_tag_example(self):
102123
try:
103124
# begin-attach_tag
104125

105-
resource_model = {
106-
'resource_id': resource_crn
107-
}
126+
resource_model = {'resource_id': resource_crn}
108127

109128
tag_results = global_tagging_service.attach_tag(
110129
resources=[resource_model],
111-
tag_names=['tag_test_1', 'tag_test_2']
112-
).get_result()
130+
tag_names=['tag_test_1', 'tag_test_2'],
131+
tag_type='user').get_result()
113132

114133
print(json.dumps(tag_results, indent=2))
115134

@@ -126,14 +145,12 @@ def test_detach_tag_example(self):
126145
try:
127146
# begin-detach_tag
128147

129-
resource_model = {
130-
'resource_id': resource_crn
131-
}
148+
resource_model = {'resource_id': resource_crn}
132149

133150
tag_results = global_tagging_service.detach_tag(
134151
resources=[resource_model],
135-
tag_names=['tag_test_1', 'tag_test_2']
136-
).get_result()
152+
tag_names=['tag_test_1', 'tag_test_2'],
153+
tag_type='user').get_result()
137154

138155
print(json.dumps(tag_results, indent=2))
139156

@@ -142,7 +159,7 @@ def test_detach_tag_example(self):
142159
except ApiException as e:
143160
pytest.fail(str(e))
144161

145-
@ needscredentials
162+
@needscredentials
146163
def test_delete_tag_example(self):
147164
"""
148165
delete_tag request example
@@ -151,8 +168,8 @@ def test_delete_tag_example(self):
151168
# begin-delete_tag
152169

153170
delete_tag_results = global_tagging_service.delete_tag(
154-
tag_name='tag_test_1'
155-
).get_result()
171+
tag_name='env:example-access-tag',
172+
tag_type='access').get_result()
156173

157174
print(json.dumps(delete_tag_results, indent=2))
158175

@@ -161,15 +178,16 @@ def test_delete_tag_example(self):
161178
except ApiException as e:
162179
pytest.fail(str(e))
163180

164-
@ needscredentials
181+
@needscredentials
165182
def test_delete_tag_all_example(self):
166183
"""
167184
delete_tag_all request example
168185
"""
169186
try:
170187
# begin-delete_tag_all
171188

172-
delete_tags_result = global_tagging_service.delete_tag_all().get_result()
189+
delete_tags_result = global_tagging_service.delete_tag_all(
190+
tag_type='user').get_result()
173191

174192
print(json.dumps(delete_tags_result, indent=2))
175193

@@ -178,6 +196,7 @@ def test_delete_tag_all_example(self):
178196
except ApiException as e:
179197
pytest.fail(str(e))
180198

199+
181200
# endregion
182201
##############################################################################
183202
# End of Examples for Service: GlobalTaggingV1

0 commit comments

Comments
 (0)