Skip to content

feat(Enterprise Billing Units): add start and limit parameters to billing unit APIs #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 29, 2023
39 changes: 25 additions & 14 deletions examples/test_enterprise_billing_units_v1_examples.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# (C) Copyright IBM Corp. 2020.
# (C) Copyright IBM Corp. 2023.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,10 +16,10 @@
Examples for EnterpriseBillingUnitsV1
"""

from ibm_cloud_sdk_core import ApiException, read_external_sources
import os
import pytest
import json
from ibm_cloud_sdk_core import ApiException, read_external_sources
from ibm_platform_services.enterprise_billing_units_v1 import *

#
Expand All @@ -44,9 +44,6 @@

config = None

enterprise_id = None
billing_unit_id = None


##############################################################################
# Start of Examples for Service: EnterpriseBillingUnitsV1
Expand Down Expand Up @@ -116,11 +113,18 @@ def test_list_billing_units_example(self):
print('\nlist_billing_units() result:')
# begin-list_billing_units

billing_units_list = enterprise_billing_units_service.list_billing_units(
enterprise_id=enterprise_id
).get_result()
all_results = []
pager = BillingUnitsPager(
client=enterprise_billing_units_service,
enterprise_id=enterprise_id,
limit=10,
)
while pager.has_next():
next_page = pager.get_next()
assert next_page is not None
all_results.extend(next_page)

print(json.dumps(billing_units_list, indent=2))
print(json.dumps(all_results, indent=2))

# end-list_billing_units

Expand All @@ -137,11 +141,18 @@ def test_list_billing_options_example(self):
print('\nlist_billing_options() result:')
# begin-list_billing_options

billing_options_list = enterprise_billing_units_service.list_billing_options(
billing_unit_id=billing_unit_id
).get_result()

print(json.dumps(billing_options_list, indent=2))
all_results = []
pager = BillingOptionsPager(
client=enterprise_billing_units_service,
billing_unit_id=billing_unit_id,
limit=10,
)
while pager.has_next():
next_page = pager.get_next()
assert next_page is not None
all_results.extend(next_page)

print(json.dumps(all_results, indent=2))

# end-list_billing_options

Expand Down
1 change: 0 additions & 1 deletion examples/test_enterprise_management_v1_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def test_get_account_group_example(self):
assert account_group_id is not None

try:

print('\nget_account_group() result:')
# begin-get_account_group

Expand Down
9 changes: 0 additions & 9 deletions examples/test_iam_policy_management_v1_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ def test_update_policy_state_example(self):
update_policy_state request example
"""
try:

print('\nupdate_policy_state() result:')
# begin-update_policy_state

Expand All @@ -209,7 +208,6 @@ def test_list_policies_example(self):
list_policies request example
"""
try:

print('\nlist_policies() result:')
# begin-list_policies

Expand All @@ -230,7 +228,6 @@ def test_delete_policy_example(self):
delete_policy request example
"""
try:

print('\ndelete_policy() result:')
# begin-delete_policy

Expand Down Expand Up @@ -338,7 +335,6 @@ def test_replace_v2_policy_example(self):
replace_v2_policy request example
"""
try:

print('\nreplace_v2_policy() result:')
# begin-replace_v2_policy

Expand Down Expand Up @@ -404,7 +400,6 @@ def test_list_v2_policies_example(self):
list_v2_policies request example
"""
try:

print('\nlist_v2_policies() result:')
# begin-list_v2_policies

Expand All @@ -425,7 +420,6 @@ def test_delete_v2_policy_example(self):
delete_v2_policy request example
"""
try:

print('\ndelete_v2_policy() result:')
# begin-delete_v2_policy

Expand Down Expand Up @@ -495,7 +489,6 @@ def test_replace_role_example(self):
replace_role request example
"""
try:

print('\nreplace_role() result:')
# begin-replace_role

Expand All @@ -520,7 +513,6 @@ def test_list_roles_example(self):
list_roles request example
"""
try:

print('\nlist_roles() result:')
# begin-list_roles

Expand All @@ -539,7 +531,6 @@ def test_delete_role_example(self):
delete_role request example
"""
try:

print('\ndelete_role() result:')
# begin-delete_role

Expand Down
1 change: 1 addition & 0 deletions examples/test_ibm_cloud_shell_v1_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

account_id = None


##############################################################################
# Start of Examples for Service: IbmCloudShellV1
##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/test_open_service_broker_v1_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
reasonCode = 'IBMCLOUD_ACCT_SUSPEND'
operation = 'Provision_45'


##############################################################################
# Start of Examples for Service: OpenServiceBrokerV1
##############################################################################
Expand Down Expand Up @@ -228,7 +229,6 @@ def test_list_catalog_example(self):
list_catalog request example
"""
try:

print('\nlist_catalog() result:')
# begin-list_catalog

Expand Down
8 changes: 1 addition & 7 deletions examples/test_resource_manager_v2_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

resource_group_id = None


##############################################################################
# Start of Examples for Service: ResourceManagerV2
##############################################################################
Expand Down Expand Up @@ -102,7 +103,6 @@ def test_create_resource_group_example(self):
assert example_user_account_id is not None

try:

print('\ncreate_resource_group() result:')
# begin-create_resource_group

Expand All @@ -129,7 +129,6 @@ def test_get_resource_group_example(self):
assert resource_group_id is not None

try:

print('\nget_resource_group() result:')
# begin-get_resource_group

Expand All @@ -152,7 +151,6 @@ def test_update_resource_group_example(self):
assert resource_group_id is not None

try:

print('\nupdate_resource_group() result:')
# begin-update_resource_group

Expand All @@ -177,7 +175,6 @@ def test_list_resource_groups_example(self):
assert example_user_account_id is not None

try:

print('\nlist_resource_groups() result:')
# begin-list_resource_groups

Expand All @@ -201,7 +198,6 @@ def test_delete_resource_group_example(self):
assert resource_group_id is not None

try:

print('\ndelete_resource_group() result:')
# begin-delete_resource_group

Expand All @@ -224,7 +220,6 @@ def test_get_quota_definition_example(self):
assert example_quota_id is not None

try:

print('\nget_quota_definition() result:')
# begin-get_quota_definition

Expand All @@ -245,7 +240,6 @@ def test_list_quota_definitions_example(self):
list_quota_definitions request example
"""
try:

print('\nlist_quota_definitions() result:')
# begin-list_quota_definitions

Expand Down
7 changes: 1 addition & 6 deletions examples/test_user_management_v1_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

delete_user_id = None


##############################################################################
# Start of Examples for Service: UserManagementV1
##############################################################################
Expand Down Expand Up @@ -128,7 +129,6 @@ def test_invite_users_example(self):
assert access_group_id is not None

try:

print('\ninvite_users() result:')
# begin-invite_users

Expand Down Expand Up @@ -195,7 +195,6 @@ def test_remove_user_example(self):
assert delete_user_id is not None

try:

print('\nremove_user() result:')
# begin-remove_user

Expand All @@ -220,7 +219,6 @@ def test_get_user_profile_example(self):
assert user_id is not None

try:

print('\nget_user_profile() result:')
# begin-get_user_profile

Expand All @@ -245,7 +243,6 @@ def test_update_user_profile_example(self):
assert user_id is not None

try:

print('\nupdate_user_profile() result:')
# begin-update_user_profile

Expand All @@ -271,7 +268,6 @@ def test_get_user_settings_example(self):
assert user_id is not None

try:

print('\nget_user_settings() result:')
# begin-get_user_settings

Expand All @@ -296,7 +292,6 @@ def test_update_user_settings_example(self):
assert user_id is not None

try:

print('\nupdate_user_settings() result:')
# begin-update_user_settings

Expand Down
Loading