Skip to content

Commit 4cc7b49

Browse files
authored
fix(Enterprise Usage Reports): regen service to get Pager (#172)
* fix(Enterprise Usage Reports): regen service to get Pager This commit contains a re-gen of the service to leverage the new Pagers emitted by the SDK generator. Signed-off-by: Phil Adams <[email protected]>
1 parent 8293c7f commit 4cc7b49

File tree

5 files changed

+340
-86
lines changed

5 files changed

+340
-86
lines changed

.secrets.baseline

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2021-12-02T14:38:21Z",
6+
"generated_at": "2022-10-26T12:35:22Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -82,7 +82,7 @@
8282
"hashed_secret": "a2190c299b60e882d9fb33736d5e6ab6ffe42708",
8383
"is_secret": false,
8484
"is_verified": false,
85-
"line_number": 822,
85+
"line_number": 826,
8686
"type": "Secret Keyword",
8787
"verified_result": null
8888
}
@@ -92,15 +92,15 @@
9292
"hashed_secret": "eafd657ce70e075f0b72cdbe48232ed4fd5a47d1",
9393
"is_secret": false,
9494
"is_verified": false,
95-
"line_number": 617,
95+
"line_number": 624,
9696
"type": "Secret Keyword",
9797
"verified_result": null
9898
},
9999
{
100100
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
101101
"is_secret": false,
102102
"is_verified": false,
103-
"line_number": 3536,
103+
"line_number": 4243,
104104
"type": "Secret Keyword",
105105
"verified_result": null
106106
}
@@ -110,7 +110,7 @@
110110
"hashed_secret": "d506bd5213c46bd49e16c634754ad70113408252",
111111
"is_secret": false,
112112
"is_verified": false,
113-
"line_number": 3326,
113+
"line_number": 3380,
114114
"type": "Secret Keyword",
115115
"verified_result": null
116116
}
@@ -140,7 +140,7 @@
140140
"hashed_secret": "a2190c299b60e882d9fb33736d5e6ab6ffe42708",
141141
"is_secret": false,
142142
"is_verified": false,
143-
"line_number": 1035,
143+
"line_number": 1041,
144144
"type": "Secret Keyword",
145145
"verified_result": null
146146
}
@@ -168,7 +168,7 @@
168168
"hashed_secret": "b8473b86d4c2072ca9b08bd28e373e8253e865c4",
169169
"is_secret": false,
170170
"is_verified": false,
171-
"line_number": 4605,
171+
"line_number": 6309,
172172
"type": "Secret Keyword",
173173
"verified_result": null
174174
}
@@ -204,23 +204,23 @@
204204
"hashed_secret": "f0b0b291c4d22d76db59faaeb94802714dd6d884",
205205
"is_secret": false,
206206
"is_verified": false,
207-
"line_number": 884,
207+
"line_number": 832,
208208
"type": "Hex High Entropy String",
209209
"verified_result": null
210210
},
211211
{
212212
"hashed_secret": "4c41e7a08e8895da0c6066adf33bf389c202b4e2",
213213
"is_secret": false,
214214
"is_verified": false,
215-
"line_number": 1294,
215+
"line_number": 1227,
216216
"type": "Hex High Entropy String",
217217
"verified_result": null
218218
},
219219
{
220220
"hashed_secret": "ca8b3e9d1445b3218e3512da63b05c8f26f181e5",
221221
"is_secret": false,
222222
"is_verified": false,
223-
"line_number": 1303,
223+
"line_number": 1236,
224224
"type": "Hex High Entropy String",
225225
"verified_result": null
226226
}
@@ -240,47 +240,47 @@
240240
"hashed_secret": "5bfabda9d31f1270745654e91a23ca1ff9b26a95",
241241
"is_secret": false,
242242
"is_verified": false,
243-
"line_number": 72,
243+
"line_number": 256,
244244
"type": "Hex High Entropy String",
245245
"verified_result": null
246246
},
247247
{
248248
"hashed_secret": "d06f0318f9eff64a13844ce2fa66cf9fb37a8cad",
249249
"is_secret": false,
250250
"is_verified": false,
251-
"line_number": 73,
251+
"line_number": 257,
252252
"type": "Hex High Entropy String",
253253
"verified_result": null
254254
},
255255
{
256256
"hashed_secret": "820b2eb95f60d828f82a984ce0321feab7868833",
257257
"is_secret": false,
258258
"is_verified": false,
259-
"line_number": 74,
259+
"line_number": 258,
260260
"type": "Hex High Entropy String",
261261
"verified_result": null
262262
},
263263
{
264264
"hashed_secret": "0f947a1a4f7cb716dc9f780bc563477bfb569c0e",
265265
"is_secret": false,
266266
"is_verified": false,
267-
"line_number": 295,
267+
"line_number": 430,
268268
"type": "Hex High Entropy String",
269269
"verified_result": null
270270
},
271271
{
272272
"hashed_secret": "953fd8a5aac905b12bf5d8cff3710d345c209632",
273273
"is_secret": false,
274274
"is_verified": false,
275-
"line_number": 427,
275+
"line_number": 562,
276276
"type": "Hex High Entropy String",
277277
"verified_result": null
278278
},
279279
{
280280
"hashed_secret": "a0138a9944cb15ff025195706f98f95d9a544eb6",
281281
"is_secret": false,
282282
"is_verified": false,
283-
"line_number": 431,
283+
"line_number": 566,
284284
"type": "Hex High Entropy String",
285285
"verified_result": null
286286
}
@@ -290,31 +290,31 @@
290290
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
291291
"is_secret": false,
292292
"is_verified": false,
293-
"line_number": 1227,
293+
"line_number": 1346,
294294
"type": "Secret Keyword",
295295
"verified_result": null
296296
},
297297
{
298298
"hashed_secret": "cf4d2385b84329a52ca542285b93d9c4618420df",
299299
"is_secret": false,
300300
"is_verified": false,
301-
"line_number": 2982,
301+
"line_number": 3256,
302302
"type": "Secret Keyword",
303303
"verified_result": null
304304
},
305305
{
306306
"hashed_secret": "469f62fa9e1c6afe62e8808180668934ee548e8f",
307307
"is_secret": false,
308308
"is_verified": false,
309-
"line_number": 3049,
309+
"line_number": 3571,
310310
"type": "Secret Keyword",
311311
"verified_result": null
312312
},
313313
{
314314
"hashed_secret": "b8473b86d4c2072ca9b08bd28e373e8253e865c4",
315315
"is_secret": false,
316316
"is_verified": false,
317-
"line_number": 3731,
317+
"line_number": 4540,
318318
"type": "Secret Keyword",
319319
"verified_result": null
320320
}
@@ -324,21 +324,21 @@
324324
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
325325
"is_secret": false,
326326
"is_verified": false,
327-
"line_number": 2212,
327+
"line_number": 2277,
328328
"type": "Secret Keyword",
329329
"verified_result": null
330330
},
331331
{
332332
"hashed_secret": "b8473b86d4c2072ca9b08bd28e373e8253e865c4",
333333
"is_secret": false,
334334
"is_verified": false,
335-
"line_number": 3112,
335+
"line_number": 3177,
336336
"type": "Secret Keyword",
337337
"verified_result": null
338338
}
339339
]
340340
},
341-
"version": "0.13.1+ibm.46.dss",
341+
"version": "0.13.1+ibm.55.dss",
342342
"word_list": {
343343
"file": null,
344344
"hash": null

examples/test_enterprise_usage_reports_v1_examples.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2020.
2+
# (C) Copyright IBM Corp. 2020, 2022.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -98,21 +98,23 @@ def test_get_resource_usage_report_example(self):
9898
get_resource_usage_report request example
9999
"""
100100
try:
101-
global enterprise_id, billing_month
102-
103101
print('\nget_resource_usage_report() result:')
104102
# begin-get_resource_usage_report
105103

106-
reports = enterprise_usage_reports_service.get_resource_usage_report(
104+
all_results = []
105+
pager = GetResourceUsageReportPager(
106+
client=enterprise_usage_reports_service,
107107
enterprise_id=enterprise_id,
108108
month=billing_month,
109-
limit=10
110-
).get_result()
109+
)
110+
while pager.has_next():
111+
next_page = pager.get_next()
112+
assert next_page is not None
113+
all_results.extend(next_page)
111114

112-
print(json.dumps(reports, indent=2))
115+
print(json.dumps(all_results, indent=2))
113116

114117
# end-get_resource_usage_report
115-
116118
except ApiException as e:
117119
pytest.fail(str(e))
118120

0 commit comments

Comments
 (0)