@@ -115,13 +115,12 @@ def test_create_policy_example(self):
115
115
type = 'access' , subjects = [policy_subjects ], roles = [policy_roles ], resources = [policy_resources ]
116
116
).get_result ()
117
117
118
+ global example_policy_id
119
+ example_policy_id = policy ['id' ]
118
120
print (json .dumps (policy , indent = 2 ))
119
121
120
122
# end-create_policy
121
123
122
- global example_policy_id
123
- example_policy_id = policy ['id' ]
124
-
125
124
except ApiException as e :
126
125
pytest .fail (str (e ))
127
126
@@ -136,14 +135,13 @@ def test_get_policy_example(self):
136
135
137
136
response = iam_policy_management_service .get_policy (policy_id = example_policy_id )
138
137
policy = response .get_result ()
138
+ global example_policy_etag
139
+ example_policy_etag = response .get_headers ().get ("Etag" )
139
140
140
141
print (json .dumps (policy , indent = 2 ))
141
142
142
143
# end-get_policy
143
144
144
- global example_policy_etag
145
- example_policy_etag = response .get_headers ().get ("Etag" )
146
-
147
145
except ApiException as e :
148
146
pytest .fail (str (e ))
149
147
@@ -174,14 +172,13 @@ def test_replace_policy_example(self):
174
172
resources = [policy_resources ],
175
173
)
176
174
policy = response .get_result ()
175
+ global example_updated_policy_etag
176
+ example_updated_policy_etag = response .get_headers ().get ("Etag" )
177
177
178
178
print (json .dumps (policy , indent = 2 ))
179
179
180
180
# end-replace_policy
181
181
182
- global example_updated_policy_etag
183
- example_updated_policy_etag = response .get_headers ().get ("Etag" )
184
-
185
182
except ApiException as e :
186
183
pytest .fail (str (e ))
187
184
@@ -298,13 +295,13 @@ def test_create_v2_policy_example(self):
298
295
pattern = policy_pattern ,
299
296
).get_result ()
300
297
298
+ global example_policy_id
299
+ example_policy_id = policy ['id' ]
300
+
301
301
print (json .dumps (policy , indent = 2 ))
302
302
303
303
# end-create_v2_policy
304
304
305
- global example_policy_id
306
- example_policy_id = policy ['id' ]
307
-
308
305
except ApiException as e :
309
306
pytest .fail (str (e ))
310
307
@@ -320,13 +317,13 @@ def test_get_v2_policy_example(self):
320
317
response = iam_policy_management_service .get_v2_policy (id = example_policy_id )
321
318
policy = response .get_result ()
322
319
320
+ global example_policy_etag
321
+ example_policy_etag = response .get_headers ().get ("Etag" )
322
+
323
323
print (json .dumps (policy , indent = 2 ))
324
324
325
325
# end-get_v2_policy
326
326
327
- global example_policy_etag
328
- example_policy_etag = response .get_headers ().get ("Etag" )
329
-
330
327
except ApiException as e :
331
328
pytest .fail (str (e ))
332
329
@@ -450,13 +447,13 @@ def test_create_role_example(self):
450
447
service_name = example_service_name ,
451
448
).get_result ()
452
449
450
+ global example_custom_role_id
451
+ example_custom_role_id = custom_role ["id" ]
452
+
453
453
print (json .dumps (custom_role , indent = 2 ))
454
454
455
455
# end-create_role
456
456
457
- global example_custom_role_id
458
- example_custom_role_id = custom_role ["id" ]
459
-
460
457
except ApiException as e :
461
458
pytest .fail (str (e ))
462
459
@@ -472,13 +469,13 @@ def test_get_role_example(self):
472
469
response = iam_policy_management_service .get_role (role_id = example_custom_role_id )
473
470
custom_role = response .get_result ()
474
471
472
+ global example_custom_role_etag
473
+ example_custom_role_etag = response .get_headers ().get ("Etag" )
474
+
475
475
print (json .dumps (custom_role , indent = 2 ))
476
476
477
477
# end-get_role
478
478
479
- global example_custom_role_etag
480
- example_custom_role_etag = response .get_headers ().get ("Etag" )
481
-
482
479
except ApiException as e :
483
480
pytest .fail (str (e ))
484
481
@@ -586,15 +583,15 @@ def test_create_policy_template_example(self):
586
583
)
587
584
policy_template = response .get_result ()
588
585
589
- print (json .dumps (policy_template , indent = 2 ))
590
-
591
- # end-create_policy_template
592
-
593
586
global example_template_id
594
587
example_template_id = policy_template ['id' ]
595
588
global example_template_version
596
589
example_template_version = policy_template ['version' ]
597
590
591
+ print (json .dumps (policy_template , indent = 2 ))
592
+
593
+ # end-create_policy_template
594
+
598
595
except ApiException as e :
599
596
pytest .fail (str (e ))
600
597
@@ -613,13 +610,13 @@ def test_get_policy_template_example(self):
613
610
)
614
611
policy_template = response .get_result ()
615
612
613
+ global example_template_etag
614
+ example_template_etag = response .get_headers ().get ("Etag" )
615
+
616
616
print (json .dumps (policy_template , indent = 2 ))
617
617
618
618
# end-get_policy_template
619
619
620
- global example_template_etag
621
- example_template_etag = response .get_headers ().get ("Etag" )
622
-
623
620
except ApiException as e :
624
621
pytest .fail (str (e ))
625
622
@@ -782,13 +779,13 @@ def test_get_policy_template_version_example(self):
782
779
)
783
780
policy_template = response .get_result ()
784
781
782
+ global example_template_etag
783
+ example_template_etag = response .get_headers ().get ("Etag" )
784
+
785
785
print (json .dumps (policy_template , indent = 2 ))
786
786
787
787
# end-get_policy_template_version
788
788
789
- global example_template_etag
790
- example_template_etag = response .get_headers ().get ("Etag" )
791
-
792
789
except ApiException as e :
793
790
pytest .fail (str (e ))
794
791
@@ -818,20 +815,20 @@ def test_list_policy_assignments_example(self):
818
815
"""
819
816
try :
820
817
print ('\n list_policy_assignments() result:' )
821
- # begin-list_Policy Assignments
818
+ # begin-list_policy_assignments
822
819
823
820
response = iam_policy_management_service .list_policy_assignments (
824
821
account_id = example_account_id ,
825
822
)
826
823
polcy_template_assignment_collection = response .get_result ()
827
824
828
- print (json .dumps (polcy_template_assignment_collection , indent = 2 ))
829
-
830
- # end-list_Policy Assignments
831
-
832
825
global example_assignment_id
833
826
example_assignment_id = polcy_template_assignment_collection ['assignments' ][0 ]['id' ]
834
827
828
+ print (json .dumps (polcy_template_assignment_collection , indent = 2 ))
829
+
830
+ # end-list_policy_assignments
831
+
835
832
except ApiException as e :
836
833
pytest .fail (str (e ))
837
834
@@ -849,11 +846,12 @@ def test_get_policy_assignment_example(self):
849
846
)
850
847
policy_assignment_record = response .get_result ()
851
848
849
+ global example_assignment_policy_id
850
+ example_assignment_policy_id = policy_assignment_record ['resources' ][0 ]['policy' ]['resource_created' ]['id' ]
851
+
852
852
print (json .dumps (policy_assignment_record , indent = 2 ))
853
853
854
854
# end-get_policy_assignment
855
- global example_assignment_policy_id
856
- example_assignment_policy_id = policy_assignment_record ['resources' ][0 ]['policy' ]['resource_created' ]['id' ]
857
855
858
856
except ApiException as e :
859
857
pytest .fail (str (e ))
0 commit comments