12
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
-
16
15
"""
17
16
Examples for GlobalTaggingV1
18
17
"""
@@ -48,7 +47,6 @@ class TestGlobalTaggingV1Examples():
48
47
"""
49
48
Example Test Class for GlobalTaggingV1
50
49
"""
51
-
52
50
@classmethod
53
51
def setup_class (cls ):
54
52
global global_tagging_service
@@ -73,8 +71,27 @@ def setup_class(cls):
73
71
print ('Setup complete.' )
74
72
75
73
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 ))
78
95
79
96
@needscredentials
80
97
def test_list_tags_example (self ):
@@ -85,7 +102,11 @@ def test_list_tags_example(self):
85
102
# begin-list_tags
86
103
87
104
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 ()
89
110
90
111
print (json .dumps (tag_list , indent = 2 ))
91
112
@@ -102,14 +123,12 @@ def test_attach_tag_example(self):
102
123
try :
103
124
# begin-attach_tag
104
125
105
- resource_model = {
106
- 'resource_id' : resource_crn
107
- }
126
+ resource_model = {'resource_id' : resource_crn }
108
127
109
128
tag_results = global_tagging_service .attach_tag (
110
129
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 ()
113
132
114
133
print (json .dumps (tag_results , indent = 2 ))
115
134
@@ -126,14 +145,12 @@ def test_detach_tag_example(self):
126
145
try :
127
146
# begin-detach_tag
128
147
129
- resource_model = {
130
- 'resource_id' : resource_crn
131
- }
148
+ resource_model = {'resource_id' : resource_crn }
132
149
133
150
tag_results = global_tagging_service .detach_tag (
134
151
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 ()
137
154
138
155
print (json .dumps (tag_results , indent = 2 ))
139
156
@@ -142,7 +159,7 @@ def test_detach_tag_example(self):
142
159
except ApiException as e :
143
160
pytest .fail (str (e ))
144
161
145
- @ needscredentials
162
+ @needscredentials
146
163
def test_delete_tag_example (self ):
147
164
"""
148
165
delete_tag request example
@@ -151,8 +168,8 @@ def test_delete_tag_example(self):
151
168
# begin-delete_tag
152
169
153
170
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 ()
156
173
157
174
print (json .dumps (delete_tag_results , indent = 2 ))
158
175
@@ -161,15 +178,16 @@ def test_delete_tag_example(self):
161
178
except ApiException as e :
162
179
pytest .fail (str (e ))
163
180
164
- @ needscredentials
181
+ @needscredentials
165
182
def test_delete_tag_all_example (self ):
166
183
"""
167
184
delete_tag_all request example
168
185
"""
169
186
try :
170
187
# begin-delete_tag_all
171
188
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 ()
173
191
174
192
print (json .dumps (delete_tags_result , indent = 2 ))
175
193
@@ -178,6 +196,7 @@ def test_delete_tag_all_example(self):
178
196
except ApiException as e :
179
197
pytest .fail (str (e ))
180
198
199
+
181
200
# endregion
182
201
##############################################################################
183
202
# End of Examples for Service: GlobalTaggingV1
0 commit comments