From e6214bd589223ccda9bbc3adb8f95dd61ab2d250 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 17 Oct 2022 16:55:25 +0000 Subject: [PATCH 1/2] feat: Add CloudChannelReportsService to CloudChannel API PiperOrigin-RevId: 481642499 Source-Link: https://github.com/googleapis/googleapis/commit/0c78b0c2ef2a623784a6434316c80ee33a33dac1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d5bf707a1960ad03c96207ffac5a8dec26d6ea5f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDViZjcwN2ExOTYwYWQwM2M5NjIwN2ZmYWM1YThkZWMyNmQ2ZWE1ZiJ9 --- owl-bot-staging/v1/.coveragerc | 17 + owl-bot-staging/v1/.flake8 | 33 + owl-bot-staging/v1/MANIFEST.in | 2 + owl-bot-staging/v1/README.rst | 49 + .../cloud_channel_reports_service.rst | 10 + .../docs/channel_v1/cloud_channel_service.rst | 10 + .../v1/docs/channel_v1/services.rst | 7 + owl-bot-staging/v1/docs/channel_v1/types.rst | 7 + owl-bot-staging/v1/docs/conf.py | 376 + owl-bot-staging/v1/docs/index.rst | 7 + .../v1/google/cloud/channel/__init__.py | 283 + .../v1/google/cloud/channel/py.typed | 2 + .../v1/google/cloud/channel_v1/__init__.py | 284 + .../cloud/channel_v1/gapic_metadata.json | 517 + .../v1/google/cloud/channel_v1/py.typed | 2 + .../cloud/channel_v1/services/__init__.py | 15 + .../cloud_channel_reports_service/__init__.py | 22 + .../async_client.py | 774 + .../cloud_channel_reports_service/client.py | 984 ++ .../cloud_channel_reports_service/pagers.py | 260 + .../transports/__init__.py | 33 + .../transports/base.py | 226 + .../transports/grpc.py | 439 + .../transports/grpc_asyncio.py | 438 + .../cloud_channel_service/__init__.py | 22 + .../cloud_channel_service/async_client.py | 5677 ++++++++ .../services/cloud_channel_service/client.py | 5973 ++++++++ .../services/cloud_channel_service/pagers.py | 1597 ++ .../transports/__init__.py | 33 + .../cloud_channel_service/transports/base.py | 820 ++ .../cloud_channel_service/transports/grpc.py | 2459 ++++ .../transports/grpc_asyncio.py | 2458 ++++ .../google/cloud/channel_v1/types/__init__.py | 296 + .../channel_v1/types/channel_partner_links.py | 123 + .../google/cloud/channel_v1/types/common.py | 236 + .../cloud/channel_v1/types/customers.py | 194 + .../cloud/channel_v1/types/entitlements.py | 418 + .../google/cloud/channel_v1/types/offers.py | 503 + .../cloud/channel_v1/types/operations.py | 58 + .../google/cloud/channel_v1/types/products.py | 147 + .../cloud/channel_v1/types/reports_service.py | 617 + .../cloud/channel_v1/types/repricing.py | 247 + .../google/cloud/channel_v1/types/service.py | 2391 +++ .../channel_v1/types/subscriber_event.py | 134 + owl-bot-staging/v1/mypy.ini | 3 + owl-bot-staging/v1/noxfile.py | 179 + ...orts_service_fetch_report_results_async.py | 53 + ...ports_service_fetch_report_results_sync.py | 53 + ...nnel_reports_service_list_reports_async.py | 53 + ...annel_reports_service_list_reports_sync.py | 53 + ...el_reports_service_run_report_job_async.py | 56 + ...nel_reports_service_run_report_job_sync.py | 56 + ...nnel_service_activate_entitlement_async.py | 56 + ...annel_service_activate_entitlement_sync.py | 56 + ...hannel_service_cancel_entitlement_async.py | 56 + ...channel_service_cancel_entitlement_sync.py | 56 + ...loud_channel_service_change_offer_async.py | 57 + ...cloud_channel_service_change_offer_sync.py | 57 + ...channel_service_change_parameters_async.py | 56 + ..._channel_service_change_parameters_sync.py | 56 + ...l_service_change_renewal_settings_async.py | 56 + ...el_service_change_renewal_settings_sync.py | 56 + ...eck_cloud_identity_accounts_exist_async.py | 53 + ...heck_cloud_identity_accounts_exist_sync.py | 53 + ...rvice_create_channel_partner_link_async.py | 57 + ...ervice_create_channel_partner_link_sync.py | 57 + ..._channel_partner_repricing_config_async.py | 56 + ...e_channel_partner_repricing_config_sync.py | 56 + ...d_channel_service_create_customer_async.py | 57 + ..._create_customer_repricing_config_async.py | 56 + ...e_create_customer_repricing_config_sync.py | 56 + ...ud_channel_service_create_customer_sync.py | 57 + ...hannel_service_create_entitlement_async.py | 60 + ...channel_service_create_entitlement_sync.py | 60 + ..._channel_partner_repricing_config_async.py | 50 + ...e_channel_partner_repricing_config_sync.py | 50 + ...d_channel_service_delete_customer_async.py | 50 + ..._delete_customer_repricing_config_async.py | 50 + ...e_delete_customer_repricing_config_sync.py | 50 + ...ud_channel_service_delete_customer_sync.py | 50 + ..._service_get_channel_partner_link_async.py | 52 + ...l_service_get_channel_partner_link_sync.py | 52 + ..._channel_partner_repricing_config_async.py | 52 + ...t_channel_partner_repricing_config_sync.py | 52 + ...loud_channel_service_get_customer_async.py | 52 + ...ice_get_customer_repricing_config_async.py | 52 + ...vice_get_customer_repricing_config_sync.py | 52 + ...cloud_channel_service_get_customer_sync.py | 52 + ...d_channel_service_get_entitlement_async.py | 52 + ...ud_channel_service_get_entitlement_sync.py | 52 + ...d_channel_service_import_customer_async.py | 54 + ...ud_channel_service_import_customer_sync.py | 54 + ...ervice_list_channel_partner_links_async.py | 53 + ...service_list_channel_partner_links_sync.py | 53 + ...channel_partner_repricing_configs_async.py | 53 + ..._channel_partner_repricing_configs_sync.py | 53 + ...e_list_customer_repricing_configs_async.py | 53 + ...ce_list_customer_repricing_configs_sync.py | 53 + ...ud_channel_service_list_customers_async.py | 53 + ...oud_channel_service_list_customers_sync.py | 53 + ...channel_service_list_entitlements_async.py | 53 + ..._channel_service_list_entitlements_sync.py | 53 + ...cloud_channel_service_list_offers_async.py | 53 + ..._cloud_channel_service_list_offers_sync.py | 53 + ...oud_channel_service_list_products_async.py | 53 + ...loud_channel_service_list_products_sync.py | 53 + ...l_service_list_purchasable_offers_async.py | 57 + ...el_service_list_purchasable_offers_sync.py | 57 + ...nel_service_list_purchasable_skus_async.py | 57 + ...nnel_service_list_purchasable_skus_sync.py | 57 + ...d_cloud_channel_service_list_skus_async.py | 54 + ...ed_cloud_channel_service_list_skus_sync.py | 54 + ..._channel_service_list_subscribers_async.py | 53 + ...d_channel_service_list_subscribers_sync.py | 53 + ..._service_list_transferable_offers_async.py | 55 + ...l_service_list_transferable_offers_sync.py | 55 + ...el_service_list_transferable_skus_async.py | 54 + ...nel_service_list_transferable_skus_sync.py | 54 + ...loud_channel_service_lookup_offer_async.py | 52 + ...cloud_channel_service_lookup_offer_sync.py | 52 + ..._service_provision_cloud_identity_async.py | 56 + ...l_service_provision_cloud_identity_sync.py | 56 + ...annel_service_register_subscriber_async.py | 53 + ...hannel_service_register_subscriber_sync.py | 53 + ...hannel_service_start_paid_service_async.py | 56 + ...channel_service_start_paid_service_sync.py | 56 + ...annel_service_suspend_entitlement_async.py | 56 + ...hannel_service_suspend_entitlement_sync.py | 56 + ...nel_service_transfer_entitlements_async.py | 60 + ...nnel_service_transfer_entitlements_sync.py | 60 + ...e_transfer_entitlements_to_google_async.py | 60 + ...ce_transfer_entitlements_to_google_sync.py | 60 + ...nel_service_unregister_subscriber_async.py | 53 + ...nnel_service_unregister_subscriber_sync.py | 53 + ...rvice_update_channel_partner_link_async.py | 57 + ...ervice_update_channel_partner_link_sync.py | 57 + ..._channel_partner_repricing_config_async.py | 55 + ...e_channel_partner_repricing_config_sync.py | 55 + ...d_channel_service_update_customer_async.py | 56 + ..._update_customer_repricing_config_async.py | 55 + ...e_update_customer_repricing_config_sync.py | 55 + ...ud_channel_service_update_customer_sync.py | 56 + .../snippet_metadata_channel_v1.json | 7468 ++++++++++ .../v1/scripts/fixup_channel_v1_keywords.py | 223 + owl-bot-staging/v1/setup.py | 58 + owl-bot-staging/v1/tests/__init__.py | 16 + owl-bot-staging/v1/tests/unit/__init__.py | 16 + .../v1/tests/unit/gapic/__init__.py | 16 + .../tests/unit/gapic/channel_v1/__init__.py | 16 + .../test_cloud_channel_reports_service.py | 2733 ++++ .../channel_v1/test_cloud_channel_service.py | 12149 ++++++++++++++++ 151 files changed, 57309 insertions(+) create mode 100644 owl-bot-staging/v1/.coveragerc create mode 100644 owl-bot-staging/v1/.flake8 create mode 100644 owl-bot-staging/v1/MANIFEST.in create mode 100644 owl-bot-staging/v1/README.rst create mode 100644 owl-bot-staging/v1/docs/channel_v1/cloud_channel_reports_service.rst create mode 100644 owl-bot-staging/v1/docs/channel_v1/cloud_channel_service.rst create mode 100644 owl-bot-staging/v1/docs/channel_v1/services.rst create mode 100644 owl-bot-staging/v1/docs/channel_v1/types.rst create mode 100644 owl-bot-staging/v1/docs/conf.py create mode 100644 owl-bot-staging/v1/docs/index.rst create mode 100644 owl-bot-staging/v1/google/cloud/channel/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/channel/py.typed create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/py.typed create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/client.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/async_client.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/client.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/pagers.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/channel_partner_links.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/common.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/customers.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/entitlements.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/offers.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/operations.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/products.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/reports_service.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/repricing.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/service.py create mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/subscriber_event.py create mode 100644 owl-bot-staging/v1/mypy.ini create mode 100644 owl-bot-staging/v1/noxfile.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/snippet_metadata_channel_v1.json create mode 100644 owl-bot-staging/v1/scripts/fixup_channel_v1_keywords.py create mode 100644 owl-bot-staging/v1/setup.py create mode 100644 owl-bot-staging/v1/tests/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/channel_v1/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_service.py diff --git a/owl-bot-staging/v1/.coveragerc b/owl-bot-staging/v1/.coveragerc new file mode 100644 index 0000000..44d34f9 --- /dev/null +++ b/owl-bot-staging/v1/.coveragerc @@ -0,0 +1,17 @@ +[run] +branch = True + +[report] +show_missing = True +omit = + google/cloud/channel/__init__.py +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ + # Ignore pkg_resources exceptions. + # This is added at the module level as a safeguard for if someone + # generates the code and tries to run it without pip installing. This + # makes it virtually impossible to test properly. + except pkg_resources.DistributionNotFound diff --git a/owl-bot-staging/v1/.flake8 b/owl-bot-staging/v1/.flake8 new file mode 100644 index 0000000..29227d4 --- /dev/null +++ b/owl-bot-staging/v1/.flake8 @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated by synthtool. DO NOT EDIT! +[flake8] +ignore = E203, E266, E501, W503 +exclude = + # Exclude generated code. + **/proto/** + **/gapic/** + **/services/** + **/types/** + *_pb2.py + + # Standard linting exemptions. + **/.nox/** + __pycache__, + .git, + *.pyc, + conf.py diff --git a/owl-bot-staging/v1/MANIFEST.in b/owl-bot-staging/v1/MANIFEST.in new file mode 100644 index 0000000..299d625 --- /dev/null +++ b/owl-bot-staging/v1/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include google/cloud/channel *.py +recursive-include google/cloud/channel_v1 *.py diff --git a/owl-bot-staging/v1/README.rst b/owl-bot-staging/v1/README.rst new file mode 100644 index 0000000..1b0de78 --- /dev/null +++ b/owl-bot-staging/v1/README.rst @@ -0,0 +1,49 @@ +Python Client for Google Cloud Channel API +================================================= + +Quick Start +----------- + +In order to use this library, you first need to go through the following steps: + +1. `Select or create a Cloud Platform project.`_ +2. `Enable billing for your project.`_ +3. Enable the Google Cloud Channel API. +4. `Setup Authentication.`_ + +.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project +.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html + +Installation +~~~~~~~~~~~~ + +Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to +create isolated Python environments. The basic problem it addresses is one of +dependencies and versions, and indirectly permissions. + +With `virtualenv`_, it's possible to install this library without needing system +install permissions, and without clashing with the installed system +dependencies. + +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ + + +Mac/Linux +^^^^^^^^^ + +.. code-block:: console + + python3 -m venv + source /bin/activate + /bin/pip install /path/to/library + + +Windows +^^^^^^^ + +.. code-block:: console + + python3 -m venv + \Scripts\activate + \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1/docs/channel_v1/cloud_channel_reports_service.rst b/owl-bot-staging/v1/docs/channel_v1/cloud_channel_reports_service.rst new file mode 100644 index 0000000..39e3749 --- /dev/null +++ b/owl-bot-staging/v1/docs/channel_v1/cloud_channel_reports_service.rst @@ -0,0 +1,10 @@ +CloudChannelReportsService +-------------------------------------------- + +.. automodule:: google.cloud.channel_v1.services.cloud_channel_reports_service + :members: + :inherited-members: + +.. automodule:: google.cloud.channel_v1.services.cloud_channel_reports_service.pagers + :members: + :inherited-members: diff --git a/owl-bot-staging/v1/docs/channel_v1/cloud_channel_service.rst b/owl-bot-staging/v1/docs/channel_v1/cloud_channel_service.rst new file mode 100644 index 0000000..917d45e --- /dev/null +++ b/owl-bot-staging/v1/docs/channel_v1/cloud_channel_service.rst @@ -0,0 +1,10 @@ +CloudChannelService +------------------------------------- + +.. automodule:: google.cloud.channel_v1.services.cloud_channel_service + :members: + :inherited-members: + +.. automodule:: google.cloud.channel_v1.services.cloud_channel_service.pagers + :members: + :inherited-members: diff --git a/owl-bot-staging/v1/docs/channel_v1/services.rst b/owl-bot-staging/v1/docs/channel_v1/services.rst new file mode 100644 index 0000000..a310f7a --- /dev/null +++ b/owl-bot-staging/v1/docs/channel_v1/services.rst @@ -0,0 +1,7 @@ +Services for Google Cloud Channel v1 API +======================================== +.. toctree:: + :maxdepth: 2 + + cloud_channel_reports_service + cloud_channel_service diff --git a/owl-bot-staging/v1/docs/channel_v1/types.rst b/owl-bot-staging/v1/docs/channel_v1/types.rst new file mode 100644 index 0000000..1c173ec --- /dev/null +++ b/owl-bot-staging/v1/docs/channel_v1/types.rst @@ -0,0 +1,7 @@ +Types for Google Cloud Channel v1 API +===================================== + +.. automodule:: google.cloud.channel_v1.types + :members: + :undoc-members: + :show-inheritance: diff --git a/owl-bot-staging/v1/docs/conf.py b/owl-bot-staging/v1/docs/conf.py new file mode 100644 index 0000000..c9adba7 --- /dev/null +++ b/owl-bot-staging/v1/docs/conf.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# google-cloud-channel documentation build configuration file +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import shlex + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath("..")) + +__version__ = "0.1.0" + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = "4.0.1" + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", +] + +# autodoc/autosummary flags +autoclass_content = "both" +autodoc_default_flags = ["members"] +autosummary_generate = True + + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# Allow markdown includes (so releases.md can include CHANGLEOG.md) +# http://www.sphinx-doc.org/en/master/markdown.html +source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The root toctree document. +root_doc = "index" + +# General information about the project. +project = u"google-cloud-channel" +copyright = u"2022, Google, LLC" +author = u"Google APIs" # TODO: autogenerate this bit + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The full version, including alpha/beta/rc tags. +release = __version__ +# The short X.Y version. +version = ".".join(release.split(".")[0:2]) + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +# Else, today_fmt is used as the format for a strftime call. +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["_build"] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = "alabaster" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + "description": "Google Cloud Client Libraries for Python", + "github_user": "googleapis", + "github_repo": "google-cloud-python", + "github_banner": True, + "font_family": "'Roboto', Georgia, sans", + "head_font_family": "'Roboto', Georgia, serif", + "code_font_family": "'Roboto Mono', 'Consolas', monospace", +} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = "google-cloud-channel-doc" + +# -- Options for warnings ------------------------------------------------------ + + +suppress_warnings = [ + # Temporarily suppress this to avoid "more than one target found for + # cross-reference" warning, which are intractable for us to avoid while in + # a mono-repo. + # See https://github.com/sphinx-doc/sphinx/blob + # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 + "ref.python" +] + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', + # Latex figure (float) alignment + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( + root_doc, + "google-cloud-channel.tex", + u"google-cloud-channel Documentation", + author, + "manual", + ) +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ( + root_doc, + "google-cloud-channel", + u"Google Cloud Channel Documentation", + [author], + 1, + ) +] + +# If true, show URL addresses after external links. +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + root_doc, + "google-cloud-channel", + u"google-cloud-channel Documentation", + author, + "google-cloud-channel", + "GAPIC library for Google Cloud Channel API", + "APIs", + ) +] + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + "python": ("http://python.readthedocs.org/en/latest/", None), + "gax": ("https://gax-python.readthedocs.org/en/latest/", None), + "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), + "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), + "grpc": ("https://grpc.io/grpc/python/", None), + "requests": ("http://requests.kennethreitz.org/en/stable/", None), + "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), + "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), +} + + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True diff --git a/owl-bot-staging/v1/docs/index.rst b/owl-bot-staging/v1/docs/index.rst new file mode 100644 index 0000000..d497c89 --- /dev/null +++ b/owl-bot-staging/v1/docs/index.rst @@ -0,0 +1,7 @@ +API Reference +------------- +.. toctree:: + :maxdepth: 2 + + channel_v1/services + channel_v1/types diff --git a/owl-bot-staging/v1/google/cloud/channel/__init__.py b/owl-bot-staging/v1/google/cloud/channel/__init__.py new file mode 100644 index 0000000..d386528 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel/__init__.py @@ -0,0 +1,283 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from google.cloud.channel_v1.services.cloud_channel_reports_service.client import CloudChannelReportsServiceClient +from google.cloud.channel_v1.services.cloud_channel_reports_service.async_client import CloudChannelReportsServiceAsyncClient +from google.cloud.channel_v1.services.cloud_channel_service.client import CloudChannelServiceClient +from google.cloud.channel_v1.services.cloud_channel_service.async_client import CloudChannelServiceAsyncClient + +from google.cloud.channel_v1.types.channel_partner_links import ChannelPartnerLink +from google.cloud.channel_v1.types.channel_partner_links import ChannelPartnerLinkState +from google.cloud.channel_v1.types.channel_partner_links import ChannelPartnerLinkView +from google.cloud.channel_v1.types.common import AdminUser +from google.cloud.channel_v1.types.common import CloudIdentityInfo +from google.cloud.channel_v1.types.common import EduData +from google.cloud.channel_v1.types.common import Value +from google.cloud.channel_v1.types.customers import ContactInfo +from google.cloud.channel_v1.types.customers import Customer +from google.cloud.channel_v1.types.entitlements import AssociationInfo +from google.cloud.channel_v1.types.entitlements import CommitmentSettings +from google.cloud.channel_v1.types.entitlements import Entitlement +from google.cloud.channel_v1.types.entitlements import Parameter +from google.cloud.channel_v1.types.entitlements import ProvisionedService +from google.cloud.channel_v1.types.entitlements import RenewalSettings +from google.cloud.channel_v1.types.entitlements import TransferableSku +from google.cloud.channel_v1.types.entitlements import TransferEligibility +from google.cloud.channel_v1.types.entitlements import TrialSettings +from google.cloud.channel_v1.types.offers import Constraints +from google.cloud.channel_v1.types.offers import CustomerConstraints +from google.cloud.channel_v1.types.offers import Offer +from google.cloud.channel_v1.types.offers import ParameterDefinition +from google.cloud.channel_v1.types.offers import Period +from google.cloud.channel_v1.types.offers import Plan +from google.cloud.channel_v1.types.offers import Price +from google.cloud.channel_v1.types.offers import PriceByResource +from google.cloud.channel_v1.types.offers import PricePhase +from google.cloud.channel_v1.types.offers import PriceTier +from google.cloud.channel_v1.types.offers import PaymentPlan +from google.cloud.channel_v1.types.offers import PaymentType +from google.cloud.channel_v1.types.offers import PeriodType +from google.cloud.channel_v1.types.offers import PromotionalOrderType +from google.cloud.channel_v1.types.offers import ResourceType +from google.cloud.channel_v1.types.operations import OperationMetadata +from google.cloud.channel_v1.types.products import MarketingInfo +from google.cloud.channel_v1.types.products import Media +from google.cloud.channel_v1.types.products import Product +from google.cloud.channel_v1.types.products import Sku +from google.cloud.channel_v1.types.products import MediaType +from google.cloud.channel_v1.types.reports_service import Column +from google.cloud.channel_v1.types.reports_service import DateRange +from google.cloud.channel_v1.types.reports_service import FetchReportResultsRequest +from google.cloud.channel_v1.types.reports_service import FetchReportResultsResponse +from google.cloud.channel_v1.types.reports_service import ListReportsRequest +from google.cloud.channel_v1.types.reports_service import ListReportsResponse +from google.cloud.channel_v1.types.reports_service import Report +from google.cloud.channel_v1.types.reports_service import ReportJob +from google.cloud.channel_v1.types.reports_service import ReportResultsMetadata +from google.cloud.channel_v1.types.reports_service import ReportStatus +from google.cloud.channel_v1.types.reports_service import ReportValue +from google.cloud.channel_v1.types.reports_service import Row +from google.cloud.channel_v1.types.reports_service import RunReportJobRequest +from google.cloud.channel_v1.types.reports_service import RunReportJobResponse +from google.cloud.channel_v1.types.repricing import ChannelPartnerRepricingConfig +from google.cloud.channel_v1.types.repricing import CustomerRepricingConfig +from google.cloud.channel_v1.types.repricing import PercentageAdjustment +from google.cloud.channel_v1.types.repricing import RepricingAdjustment +from google.cloud.channel_v1.types.repricing import RepricingConfig +from google.cloud.channel_v1.types.repricing import RebillingBasis +from google.cloud.channel_v1.types.service import ActivateEntitlementRequest +from google.cloud.channel_v1.types.service import CancelEntitlementRequest +from google.cloud.channel_v1.types.service import ChangeOfferRequest +from google.cloud.channel_v1.types.service import ChangeParametersRequest +from google.cloud.channel_v1.types.service import ChangeRenewalSettingsRequest +from google.cloud.channel_v1.types.service import CheckCloudIdentityAccountsExistRequest +from google.cloud.channel_v1.types.service import CheckCloudIdentityAccountsExistResponse +from google.cloud.channel_v1.types.service import CloudIdentityCustomerAccount +from google.cloud.channel_v1.types.service import CreateChannelPartnerLinkRequest +from google.cloud.channel_v1.types.service import CreateChannelPartnerRepricingConfigRequest +from google.cloud.channel_v1.types.service import CreateCustomerRepricingConfigRequest +from google.cloud.channel_v1.types.service import CreateCustomerRequest +from google.cloud.channel_v1.types.service import CreateEntitlementRequest +from google.cloud.channel_v1.types.service import DeleteChannelPartnerRepricingConfigRequest +from google.cloud.channel_v1.types.service import DeleteCustomerRepricingConfigRequest +from google.cloud.channel_v1.types.service import DeleteCustomerRequest +from google.cloud.channel_v1.types.service import GetChannelPartnerLinkRequest +from google.cloud.channel_v1.types.service import GetChannelPartnerRepricingConfigRequest +from google.cloud.channel_v1.types.service import GetCustomerRepricingConfigRequest +from google.cloud.channel_v1.types.service import GetCustomerRequest +from google.cloud.channel_v1.types.service import GetEntitlementRequest +from google.cloud.channel_v1.types.service import ImportCustomerRequest +from google.cloud.channel_v1.types.service import ListChannelPartnerLinksRequest +from google.cloud.channel_v1.types.service import ListChannelPartnerLinksResponse +from google.cloud.channel_v1.types.service import ListChannelPartnerRepricingConfigsRequest +from google.cloud.channel_v1.types.service import ListChannelPartnerRepricingConfigsResponse +from google.cloud.channel_v1.types.service import ListCustomerRepricingConfigsRequest +from google.cloud.channel_v1.types.service import ListCustomerRepricingConfigsResponse +from google.cloud.channel_v1.types.service import ListCustomersRequest +from google.cloud.channel_v1.types.service import ListCustomersResponse +from google.cloud.channel_v1.types.service import ListEntitlementsRequest +from google.cloud.channel_v1.types.service import ListEntitlementsResponse +from google.cloud.channel_v1.types.service import ListOffersRequest +from google.cloud.channel_v1.types.service import ListOffersResponse +from google.cloud.channel_v1.types.service import ListProductsRequest +from google.cloud.channel_v1.types.service import ListProductsResponse +from google.cloud.channel_v1.types.service import ListPurchasableOffersRequest +from google.cloud.channel_v1.types.service import ListPurchasableOffersResponse +from google.cloud.channel_v1.types.service import ListPurchasableSkusRequest +from google.cloud.channel_v1.types.service import ListPurchasableSkusResponse +from google.cloud.channel_v1.types.service import ListSkusRequest +from google.cloud.channel_v1.types.service import ListSkusResponse +from google.cloud.channel_v1.types.service import ListSubscribersRequest +from google.cloud.channel_v1.types.service import ListSubscribersResponse +from google.cloud.channel_v1.types.service import ListTransferableOffersRequest +from google.cloud.channel_v1.types.service import ListTransferableOffersResponse +from google.cloud.channel_v1.types.service import ListTransferableSkusRequest +from google.cloud.channel_v1.types.service import ListTransferableSkusResponse +from google.cloud.channel_v1.types.service import LookupOfferRequest +from google.cloud.channel_v1.types.service import ProvisionCloudIdentityRequest +from google.cloud.channel_v1.types.service import PurchasableOffer +from google.cloud.channel_v1.types.service import PurchasableSku +from google.cloud.channel_v1.types.service import RegisterSubscriberRequest +from google.cloud.channel_v1.types.service import RegisterSubscriberResponse +from google.cloud.channel_v1.types.service import StartPaidServiceRequest +from google.cloud.channel_v1.types.service import SuspendEntitlementRequest +from google.cloud.channel_v1.types.service import TransferableOffer +from google.cloud.channel_v1.types.service import TransferEntitlementsRequest +from google.cloud.channel_v1.types.service import TransferEntitlementsResponse +from google.cloud.channel_v1.types.service import TransferEntitlementsToGoogleRequest +from google.cloud.channel_v1.types.service import UnregisterSubscriberRequest +from google.cloud.channel_v1.types.service import UnregisterSubscriberResponse +from google.cloud.channel_v1.types.service import UpdateChannelPartnerLinkRequest +from google.cloud.channel_v1.types.service import UpdateChannelPartnerRepricingConfigRequest +from google.cloud.channel_v1.types.service import UpdateCustomerRepricingConfigRequest +from google.cloud.channel_v1.types.service import UpdateCustomerRequest +from google.cloud.channel_v1.types.subscriber_event import CustomerEvent +from google.cloud.channel_v1.types.subscriber_event import EntitlementEvent +from google.cloud.channel_v1.types.subscriber_event import SubscriberEvent + +__all__ = ('CloudChannelReportsServiceClient', + 'CloudChannelReportsServiceAsyncClient', + 'CloudChannelServiceClient', + 'CloudChannelServiceAsyncClient', + 'ChannelPartnerLink', + 'ChannelPartnerLinkState', + 'ChannelPartnerLinkView', + 'AdminUser', + 'CloudIdentityInfo', + 'EduData', + 'Value', + 'ContactInfo', + 'Customer', + 'AssociationInfo', + 'CommitmentSettings', + 'Entitlement', + 'Parameter', + 'ProvisionedService', + 'RenewalSettings', + 'TransferableSku', + 'TransferEligibility', + 'TrialSettings', + 'Constraints', + 'CustomerConstraints', + 'Offer', + 'ParameterDefinition', + 'Period', + 'Plan', + 'Price', + 'PriceByResource', + 'PricePhase', + 'PriceTier', + 'PaymentPlan', + 'PaymentType', + 'PeriodType', + 'PromotionalOrderType', + 'ResourceType', + 'OperationMetadata', + 'MarketingInfo', + 'Media', + 'Product', + 'Sku', + 'MediaType', + 'Column', + 'DateRange', + 'FetchReportResultsRequest', + 'FetchReportResultsResponse', + 'ListReportsRequest', + 'ListReportsResponse', + 'Report', + 'ReportJob', + 'ReportResultsMetadata', + 'ReportStatus', + 'ReportValue', + 'Row', + 'RunReportJobRequest', + 'RunReportJobResponse', + 'ChannelPartnerRepricingConfig', + 'CustomerRepricingConfig', + 'PercentageAdjustment', + 'RepricingAdjustment', + 'RepricingConfig', + 'RebillingBasis', + 'ActivateEntitlementRequest', + 'CancelEntitlementRequest', + 'ChangeOfferRequest', + 'ChangeParametersRequest', + 'ChangeRenewalSettingsRequest', + 'CheckCloudIdentityAccountsExistRequest', + 'CheckCloudIdentityAccountsExistResponse', + 'CloudIdentityCustomerAccount', + 'CreateChannelPartnerLinkRequest', + 'CreateChannelPartnerRepricingConfigRequest', + 'CreateCustomerRepricingConfigRequest', + 'CreateCustomerRequest', + 'CreateEntitlementRequest', + 'DeleteChannelPartnerRepricingConfigRequest', + 'DeleteCustomerRepricingConfigRequest', + 'DeleteCustomerRequest', + 'GetChannelPartnerLinkRequest', + 'GetChannelPartnerRepricingConfigRequest', + 'GetCustomerRepricingConfigRequest', + 'GetCustomerRequest', + 'GetEntitlementRequest', + 'ImportCustomerRequest', + 'ListChannelPartnerLinksRequest', + 'ListChannelPartnerLinksResponse', + 'ListChannelPartnerRepricingConfigsRequest', + 'ListChannelPartnerRepricingConfigsResponse', + 'ListCustomerRepricingConfigsRequest', + 'ListCustomerRepricingConfigsResponse', + 'ListCustomersRequest', + 'ListCustomersResponse', + 'ListEntitlementsRequest', + 'ListEntitlementsResponse', + 'ListOffersRequest', + 'ListOffersResponse', + 'ListProductsRequest', + 'ListProductsResponse', + 'ListPurchasableOffersRequest', + 'ListPurchasableOffersResponse', + 'ListPurchasableSkusRequest', + 'ListPurchasableSkusResponse', + 'ListSkusRequest', + 'ListSkusResponse', + 'ListSubscribersRequest', + 'ListSubscribersResponse', + 'ListTransferableOffersRequest', + 'ListTransferableOffersResponse', + 'ListTransferableSkusRequest', + 'ListTransferableSkusResponse', + 'LookupOfferRequest', + 'ProvisionCloudIdentityRequest', + 'PurchasableOffer', + 'PurchasableSku', + 'RegisterSubscriberRequest', + 'RegisterSubscriberResponse', + 'StartPaidServiceRequest', + 'SuspendEntitlementRequest', + 'TransferableOffer', + 'TransferEntitlementsRequest', + 'TransferEntitlementsResponse', + 'TransferEntitlementsToGoogleRequest', + 'UnregisterSubscriberRequest', + 'UnregisterSubscriberResponse', + 'UpdateChannelPartnerLinkRequest', + 'UpdateChannelPartnerRepricingConfigRequest', + 'UpdateCustomerRepricingConfigRequest', + 'UpdateCustomerRequest', + 'CustomerEvent', + 'EntitlementEvent', + 'SubscriberEvent', +) diff --git a/owl-bot-staging/v1/google/cloud/channel/py.typed b/owl-bot-staging/v1/google/cloud/channel/py.typed new file mode 100644 index 0000000..0915275 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-channel package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/__init__.py new file mode 100644 index 0000000..9a670ba --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/__init__.py @@ -0,0 +1,284 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from .services.cloud_channel_reports_service import CloudChannelReportsServiceClient +from .services.cloud_channel_reports_service import CloudChannelReportsServiceAsyncClient +from .services.cloud_channel_service import CloudChannelServiceClient +from .services.cloud_channel_service import CloudChannelServiceAsyncClient + +from .types.channel_partner_links import ChannelPartnerLink +from .types.channel_partner_links import ChannelPartnerLinkState +from .types.channel_partner_links import ChannelPartnerLinkView +from .types.common import AdminUser +from .types.common import CloudIdentityInfo +from .types.common import EduData +from .types.common import Value +from .types.customers import ContactInfo +from .types.customers import Customer +from .types.entitlements import AssociationInfo +from .types.entitlements import CommitmentSettings +from .types.entitlements import Entitlement +from .types.entitlements import Parameter +from .types.entitlements import ProvisionedService +from .types.entitlements import RenewalSettings +from .types.entitlements import TransferableSku +from .types.entitlements import TransferEligibility +from .types.entitlements import TrialSettings +from .types.offers import Constraints +from .types.offers import CustomerConstraints +from .types.offers import Offer +from .types.offers import ParameterDefinition +from .types.offers import Period +from .types.offers import Plan +from .types.offers import Price +from .types.offers import PriceByResource +from .types.offers import PricePhase +from .types.offers import PriceTier +from .types.offers import PaymentPlan +from .types.offers import PaymentType +from .types.offers import PeriodType +from .types.offers import PromotionalOrderType +from .types.offers import ResourceType +from .types.operations import OperationMetadata +from .types.products import MarketingInfo +from .types.products import Media +from .types.products import Product +from .types.products import Sku +from .types.products import MediaType +from .types.reports_service import Column +from .types.reports_service import DateRange +from .types.reports_service import FetchReportResultsRequest +from .types.reports_service import FetchReportResultsResponse +from .types.reports_service import ListReportsRequest +from .types.reports_service import ListReportsResponse +from .types.reports_service import Report +from .types.reports_service import ReportJob +from .types.reports_service import ReportResultsMetadata +from .types.reports_service import ReportStatus +from .types.reports_service import ReportValue +from .types.reports_service import Row +from .types.reports_service import RunReportJobRequest +from .types.reports_service import RunReportJobResponse +from .types.repricing import ChannelPartnerRepricingConfig +from .types.repricing import CustomerRepricingConfig +from .types.repricing import PercentageAdjustment +from .types.repricing import RepricingAdjustment +from .types.repricing import RepricingConfig +from .types.repricing import RebillingBasis +from .types.service import ActivateEntitlementRequest +from .types.service import CancelEntitlementRequest +from .types.service import ChangeOfferRequest +from .types.service import ChangeParametersRequest +from .types.service import ChangeRenewalSettingsRequest +from .types.service import CheckCloudIdentityAccountsExistRequest +from .types.service import CheckCloudIdentityAccountsExistResponse +from .types.service import CloudIdentityCustomerAccount +from .types.service import CreateChannelPartnerLinkRequest +from .types.service import CreateChannelPartnerRepricingConfigRequest +from .types.service import CreateCustomerRepricingConfigRequest +from .types.service import CreateCustomerRequest +from .types.service import CreateEntitlementRequest +from .types.service import DeleteChannelPartnerRepricingConfigRequest +from .types.service import DeleteCustomerRepricingConfigRequest +from .types.service import DeleteCustomerRequest +from .types.service import GetChannelPartnerLinkRequest +from .types.service import GetChannelPartnerRepricingConfigRequest +from .types.service import GetCustomerRepricingConfigRequest +from .types.service import GetCustomerRequest +from .types.service import GetEntitlementRequest +from .types.service import ImportCustomerRequest +from .types.service import ListChannelPartnerLinksRequest +from .types.service import ListChannelPartnerLinksResponse +from .types.service import ListChannelPartnerRepricingConfigsRequest +from .types.service import ListChannelPartnerRepricingConfigsResponse +from .types.service import ListCustomerRepricingConfigsRequest +from .types.service import ListCustomerRepricingConfigsResponse +from .types.service import ListCustomersRequest +from .types.service import ListCustomersResponse +from .types.service import ListEntitlementsRequest +from .types.service import ListEntitlementsResponse +from .types.service import ListOffersRequest +from .types.service import ListOffersResponse +from .types.service import ListProductsRequest +from .types.service import ListProductsResponse +from .types.service import ListPurchasableOffersRequest +from .types.service import ListPurchasableOffersResponse +from .types.service import ListPurchasableSkusRequest +from .types.service import ListPurchasableSkusResponse +from .types.service import ListSkusRequest +from .types.service import ListSkusResponse +from .types.service import ListSubscribersRequest +from .types.service import ListSubscribersResponse +from .types.service import ListTransferableOffersRequest +from .types.service import ListTransferableOffersResponse +from .types.service import ListTransferableSkusRequest +from .types.service import ListTransferableSkusResponse +from .types.service import LookupOfferRequest +from .types.service import ProvisionCloudIdentityRequest +from .types.service import PurchasableOffer +from .types.service import PurchasableSku +from .types.service import RegisterSubscriberRequest +from .types.service import RegisterSubscriberResponse +from .types.service import StartPaidServiceRequest +from .types.service import SuspendEntitlementRequest +from .types.service import TransferableOffer +from .types.service import TransferEntitlementsRequest +from .types.service import TransferEntitlementsResponse +from .types.service import TransferEntitlementsToGoogleRequest +from .types.service import UnregisterSubscriberRequest +from .types.service import UnregisterSubscriberResponse +from .types.service import UpdateChannelPartnerLinkRequest +from .types.service import UpdateChannelPartnerRepricingConfigRequest +from .types.service import UpdateCustomerRepricingConfigRequest +from .types.service import UpdateCustomerRequest +from .types.subscriber_event import CustomerEvent +from .types.subscriber_event import EntitlementEvent +from .types.subscriber_event import SubscriberEvent + +__all__ = ( + 'CloudChannelReportsServiceAsyncClient', + 'CloudChannelServiceAsyncClient', +'ActivateEntitlementRequest', +'AdminUser', +'AssociationInfo', +'CancelEntitlementRequest', +'ChangeOfferRequest', +'ChangeParametersRequest', +'ChangeRenewalSettingsRequest', +'ChannelPartnerLink', +'ChannelPartnerLinkState', +'ChannelPartnerLinkView', +'ChannelPartnerRepricingConfig', +'CheckCloudIdentityAccountsExistRequest', +'CheckCloudIdentityAccountsExistResponse', +'CloudChannelReportsServiceClient', +'CloudChannelServiceClient', +'CloudIdentityCustomerAccount', +'CloudIdentityInfo', +'Column', +'CommitmentSettings', +'Constraints', +'ContactInfo', +'CreateChannelPartnerLinkRequest', +'CreateChannelPartnerRepricingConfigRequest', +'CreateCustomerRepricingConfigRequest', +'CreateCustomerRequest', +'CreateEntitlementRequest', +'Customer', +'CustomerConstraints', +'CustomerEvent', +'CustomerRepricingConfig', +'DateRange', +'DeleteChannelPartnerRepricingConfigRequest', +'DeleteCustomerRepricingConfigRequest', +'DeleteCustomerRequest', +'EduData', +'Entitlement', +'EntitlementEvent', +'FetchReportResultsRequest', +'FetchReportResultsResponse', +'GetChannelPartnerLinkRequest', +'GetChannelPartnerRepricingConfigRequest', +'GetCustomerRepricingConfigRequest', +'GetCustomerRequest', +'GetEntitlementRequest', +'ImportCustomerRequest', +'ListChannelPartnerLinksRequest', +'ListChannelPartnerLinksResponse', +'ListChannelPartnerRepricingConfigsRequest', +'ListChannelPartnerRepricingConfigsResponse', +'ListCustomerRepricingConfigsRequest', +'ListCustomerRepricingConfigsResponse', +'ListCustomersRequest', +'ListCustomersResponse', +'ListEntitlementsRequest', +'ListEntitlementsResponse', +'ListOffersRequest', +'ListOffersResponse', +'ListProductsRequest', +'ListProductsResponse', +'ListPurchasableOffersRequest', +'ListPurchasableOffersResponse', +'ListPurchasableSkusRequest', +'ListPurchasableSkusResponse', +'ListReportsRequest', +'ListReportsResponse', +'ListSkusRequest', +'ListSkusResponse', +'ListSubscribersRequest', +'ListSubscribersResponse', +'ListTransferableOffersRequest', +'ListTransferableOffersResponse', +'ListTransferableSkusRequest', +'ListTransferableSkusResponse', +'LookupOfferRequest', +'MarketingInfo', +'Media', +'MediaType', +'Offer', +'OperationMetadata', +'Parameter', +'ParameterDefinition', +'PaymentPlan', +'PaymentType', +'PercentageAdjustment', +'Period', +'PeriodType', +'Plan', +'Price', +'PriceByResource', +'PricePhase', +'PriceTier', +'Product', +'PromotionalOrderType', +'ProvisionCloudIdentityRequest', +'ProvisionedService', +'PurchasableOffer', +'PurchasableSku', +'RebillingBasis', +'RegisterSubscriberRequest', +'RegisterSubscriberResponse', +'RenewalSettings', +'Report', +'ReportJob', +'ReportResultsMetadata', +'ReportStatus', +'ReportValue', +'RepricingAdjustment', +'RepricingConfig', +'ResourceType', +'Row', +'RunReportJobRequest', +'RunReportJobResponse', +'Sku', +'StartPaidServiceRequest', +'SubscriberEvent', +'SuspendEntitlementRequest', +'TransferEligibility', +'TransferEntitlementsRequest', +'TransferEntitlementsResponse', +'TransferEntitlementsToGoogleRequest', +'TransferableOffer', +'TransferableSku', +'TrialSettings', +'UnregisterSubscriberRequest', +'UnregisterSubscriberResponse', +'UpdateChannelPartnerLinkRequest', +'UpdateChannelPartnerRepricingConfigRequest', +'UpdateCustomerRepricingConfigRequest', +'UpdateCustomerRequest', +'Value', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/gapic_metadata.json b/owl-bot-staging/v1/google/cloud/channel_v1/gapic_metadata.json new file mode 100644 index 0000000..aff1a2d --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/gapic_metadata.json @@ -0,0 +1,517 @@ + { + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "python", + "libraryPackage": "google.cloud.channel_v1", + "protoPackage": "google.cloud.channel.v1", + "schema": "1.0", + "services": { + "CloudChannelReportsService": { + "clients": { + "grpc": { + "libraryClient": "CloudChannelReportsServiceClient", + "rpcs": { + "FetchReportResults": { + "methods": [ + "fetch_report_results" + ] + }, + "ListReports": { + "methods": [ + "list_reports" + ] + }, + "RunReportJob": { + "methods": [ + "run_report_job" + ] + } + } + }, + "grpc-async": { + "libraryClient": "CloudChannelReportsServiceAsyncClient", + "rpcs": { + "FetchReportResults": { + "methods": [ + "fetch_report_results" + ] + }, + "ListReports": { + "methods": [ + "list_reports" + ] + }, + "RunReportJob": { + "methods": [ + "run_report_job" + ] + } + } + } + } + }, + "CloudChannelService": { + "clients": { + "grpc": { + "libraryClient": "CloudChannelServiceClient", + "rpcs": { + "ActivateEntitlement": { + "methods": [ + "activate_entitlement" + ] + }, + "CancelEntitlement": { + "methods": [ + "cancel_entitlement" + ] + }, + "ChangeOffer": { + "methods": [ + "change_offer" + ] + }, + "ChangeParameters": { + "methods": [ + "change_parameters" + ] + }, + "ChangeRenewalSettings": { + "methods": [ + "change_renewal_settings" + ] + }, + "CheckCloudIdentityAccountsExist": { + "methods": [ + "check_cloud_identity_accounts_exist" + ] + }, + "CreateChannelPartnerLink": { + "methods": [ + "create_channel_partner_link" + ] + }, + "CreateChannelPartnerRepricingConfig": { + "methods": [ + "create_channel_partner_repricing_config" + ] + }, + "CreateCustomer": { + "methods": [ + "create_customer" + ] + }, + "CreateCustomerRepricingConfig": { + "methods": [ + "create_customer_repricing_config" + ] + }, + "CreateEntitlement": { + "methods": [ + "create_entitlement" + ] + }, + "DeleteChannelPartnerRepricingConfig": { + "methods": [ + "delete_channel_partner_repricing_config" + ] + }, + "DeleteCustomer": { + "methods": [ + "delete_customer" + ] + }, + "DeleteCustomerRepricingConfig": { + "methods": [ + "delete_customer_repricing_config" + ] + }, + "GetChannelPartnerLink": { + "methods": [ + "get_channel_partner_link" + ] + }, + "GetChannelPartnerRepricingConfig": { + "methods": [ + "get_channel_partner_repricing_config" + ] + }, + "GetCustomer": { + "methods": [ + "get_customer" + ] + }, + "GetCustomerRepricingConfig": { + "methods": [ + "get_customer_repricing_config" + ] + }, + "GetEntitlement": { + "methods": [ + "get_entitlement" + ] + }, + "ImportCustomer": { + "methods": [ + "import_customer" + ] + }, + "ListChannelPartnerLinks": { + "methods": [ + "list_channel_partner_links" + ] + }, + "ListChannelPartnerRepricingConfigs": { + "methods": [ + "list_channel_partner_repricing_configs" + ] + }, + "ListCustomerRepricingConfigs": { + "methods": [ + "list_customer_repricing_configs" + ] + }, + "ListCustomers": { + "methods": [ + "list_customers" + ] + }, + "ListEntitlements": { + "methods": [ + "list_entitlements" + ] + }, + "ListOffers": { + "methods": [ + "list_offers" + ] + }, + "ListProducts": { + "methods": [ + "list_products" + ] + }, + "ListPurchasableOffers": { + "methods": [ + "list_purchasable_offers" + ] + }, + "ListPurchasableSkus": { + "methods": [ + "list_purchasable_skus" + ] + }, + "ListSkus": { + "methods": [ + "list_skus" + ] + }, + "ListSubscribers": { + "methods": [ + "list_subscribers" + ] + }, + "ListTransferableOffers": { + "methods": [ + "list_transferable_offers" + ] + }, + "ListTransferableSkus": { + "methods": [ + "list_transferable_skus" + ] + }, + "LookupOffer": { + "methods": [ + "lookup_offer" + ] + }, + "ProvisionCloudIdentity": { + "methods": [ + "provision_cloud_identity" + ] + }, + "RegisterSubscriber": { + "methods": [ + "register_subscriber" + ] + }, + "StartPaidService": { + "methods": [ + "start_paid_service" + ] + }, + "SuspendEntitlement": { + "methods": [ + "suspend_entitlement" + ] + }, + "TransferEntitlements": { + "methods": [ + "transfer_entitlements" + ] + }, + "TransferEntitlementsToGoogle": { + "methods": [ + "transfer_entitlements_to_google" + ] + }, + "UnregisterSubscriber": { + "methods": [ + "unregister_subscriber" + ] + }, + "UpdateChannelPartnerLink": { + "methods": [ + "update_channel_partner_link" + ] + }, + "UpdateChannelPartnerRepricingConfig": { + "methods": [ + "update_channel_partner_repricing_config" + ] + }, + "UpdateCustomer": { + "methods": [ + "update_customer" + ] + }, + "UpdateCustomerRepricingConfig": { + "methods": [ + "update_customer_repricing_config" + ] + } + } + }, + "grpc-async": { + "libraryClient": "CloudChannelServiceAsyncClient", + "rpcs": { + "ActivateEntitlement": { + "methods": [ + "activate_entitlement" + ] + }, + "CancelEntitlement": { + "methods": [ + "cancel_entitlement" + ] + }, + "ChangeOffer": { + "methods": [ + "change_offer" + ] + }, + "ChangeParameters": { + "methods": [ + "change_parameters" + ] + }, + "ChangeRenewalSettings": { + "methods": [ + "change_renewal_settings" + ] + }, + "CheckCloudIdentityAccountsExist": { + "methods": [ + "check_cloud_identity_accounts_exist" + ] + }, + "CreateChannelPartnerLink": { + "methods": [ + "create_channel_partner_link" + ] + }, + "CreateChannelPartnerRepricingConfig": { + "methods": [ + "create_channel_partner_repricing_config" + ] + }, + "CreateCustomer": { + "methods": [ + "create_customer" + ] + }, + "CreateCustomerRepricingConfig": { + "methods": [ + "create_customer_repricing_config" + ] + }, + "CreateEntitlement": { + "methods": [ + "create_entitlement" + ] + }, + "DeleteChannelPartnerRepricingConfig": { + "methods": [ + "delete_channel_partner_repricing_config" + ] + }, + "DeleteCustomer": { + "methods": [ + "delete_customer" + ] + }, + "DeleteCustomerRepricingConfig": { + "methods": [ + "delete_customer_repricing_config" + ] + }, + "GetChannelPartnerLink": { + "methods": [ + "get_channel_partner_link" + ] + }, + "GetChannelPartnerRepricingConfig": { + "methods": [ + "get_channel_partner_repricing_config" + ] + }, + "GetCustomer": { + "methods": [ + "get_customer" + ] + }, + "GetCustomerRepricingConfig": { + "methods": [ + "get_customer_repricing_config" + ] + }, + "GetEntitlement": { + "methods": [ + "get_entitlement" + ] + }, + "ImportCustomer": { + "methods": [ + "import_customer" + ] + }, + "ListChannelPartnerLinks": { + "methods": [ + "list_channel_partner_links" + ] + }, + "ListChannelPartnerRepricingConfigs": { + "methods": [ + "list_channel_partner_repricing_configs" + ] + }, + "ListCustomerRepricingConfigs": { + "methods": [ + "list_customer_repricing_configs" + ] + }, + "ListCustomers": { + "methods": [ + "list_customers" + ] + }, + "ListEntitlements": { + "methods": [ + "list_entitlements" + ] + }, + "ListOffers": { + "methods": [ + "list_offers" + ] + }, + "ListProducts": { + "methods": [ + "list_products" + ] + }, + "ListPurchasableOffers": { + "methods": [ + "list_purchasable_offers" + ] + }, + "ListPurchasableSkus": { + "methods": [ + "list_purchasable_skus" + ] + }, + "ListSkus": { + "methods": [ + "list_skus" + ] + }, + "ListSubscribers": { + "methods": [ + "list_subscribers" + ] + }, + "ListTransferableOffers": { + "methods": [ + "list_transferable_offers" + ] + }, + "ListTransferableSkus": { + "methods": [ + "list_transferable_skus" + ] + }, + "LookupOffer": { + "methods": [ + "lookup_offer" + ] + }, + "ProvisionCloudIdentity": { + "methods": [ + "provision_cloud_identity" + ] + }, + "RegisterSubscriber": { + "methods": [ + "register_subscriber" + ] + }, + "StartPaidService": { + "methods": [ + "start_paid_service" + ] + }, + "SuspendEntitlement": { + "methods": [ + "suspend_entitlement" + ] + }, + "TransferEntitlements": { + "methods": [ + "transfer_entitlements" + ] + }, + "TransferEntitlementsToGoogle": { + "methods": [ + "transfer_entitlements_to_google" + ] + }, + "UnregisterSubscriber": { + "methods": [ + "unregister_subscriber" + ] + }, + "UpdateChannelPartnerLink": { + "methods": [ + "update_channel_partner_link" + ] + }, + "UpdateChannelPartnerRepricingConfig": { + "methods": [ + "update_channel_partner_repricing_config" + ] + }, + "UpdateCustomer": { + "methods": [ + "update_customer" + ] + }, + "UpdateCustomerRepricingConfig": { + "methods": [ + "update_customer_repricing_config" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/py.typed b/owl-bot-staging/v1/google/cloud/channel_v1/py.typed new file mode 100644 index 0000000..0915275 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-channel package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/__init__.py new file mode 100644 index 0000000..e8e1c38 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py new file mode 100644 index 0000000..73fa291 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .client import CloudChannelReportsServiceClient +from .async_client import CloudChannelReportsServiceAsyncClient + +__all__ = ( + 'CloudChannelReportsServiceClient', + 'CloudChannelReportsServiceAsyncClient', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py new file mode 100644 index 0000000..483e7a5 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py @@ -0,0 +1,774 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import functools +import re +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.channel_v1.services.cloud_channel_reports_service import pagers +from google.cloud.channel_v1.types import operations +from google.cloud.channel_v1.types import reports_service +from google.longrunning import operations_pb2 +from .transports.base import CloudChannelReportsServiceTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import CloudChannelReportsServiceGrpcAsyncIOTransport +from .client import CloudChannelReportsServiceClient + + +class CloudChannelReportsServiceAsyncClient: + """CloudChannelReportsService lets Google Cloud resellers and + distributors retrieve and combine a variety of data in Cloud + Channel for multiple products (Google Cloud Platform (GCP), + Google Voice, and Google Workspace.) + """ + + _client: CloudChannelReportsServiceClient + + DEFAULT_ENDPOINT = CloudChannelReportsServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = CloudChannelReportsServiceClient.DEFAULT_MTLS_ENDPOINT + + report_path = staticmethod(CloudChannelReportsServiceClient.report_path) + parse_report_path = staticmethod(CloudChannelReportsServiceClient.parse_report_path) + report_job_path = staticmethod(CloudChannelReportsServiceClient.report_job_path) + parse_report_job_path = staticmethod(CloudChannelReportsServiceClient.parse_report_job_path) + common_billing_account_path = staticmethod(CloudChannelReportsServiceClient.common_billing_account_path) + parse_common_billing_account_path = staticmethod(CloudChannelReportsServiceClient.parse_common_billing_account_path) + common_folder_path = staticmethod(CloudChannelReportsServiceClient.common_folder_path) + parse_common_folder_path = staticmethod(CloudChannelReportsServiceClient.parse_common_folder_path) + common_organization_path = staticmethod(CloudChannelReportsServiceClient.common_organization_path) + parse_common_organization_path = staticmethod(CloudChannelReportsServiceClient.parse_common_organization_path) + common_project_path = staticmethod(CloudChannelReportsServiceClient.common_project_path) + parse_common_project_path = staticmethod(CloudChannelReportsServiceClient.parse_common_project_path) + common_location_path = staticmethod(CloudChannelReportsServiceClient.common_location_path) + parse_common_location_path = staticmethod(CloudChannelReportsServiceClient.parse_common_location_path) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudChannelReportsServiceAsyncClient: The constructed client. + """ + return CloudChannelReportsServiceClient.from_service_account_info.__func__(CloudChannelReportsServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudChannelReportsServiceAsyncClient: The constructed client. + """ + return CloudChannelReportsServiceClient.from_service_account_file.__func__(CloudChannelReportsServiceAsyncClient, filename, *args, **kwargs) # type: ignore + + from_service_account_json = from_service_account_file + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return CloudChannelReportsServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> CloudChannelReportsServiceTransport: + """Returns the transport used by the client instance. + + Returns: + CloudChannelReportsServiceTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial(type(CloudChannelReportsServiceClient).get_transport_class, type(CloudChannelReportsServiceClient)) + + def __init__(self, *, + credentials: ga_credentials.Credentials = None, + transport: Union[str, CloudChannelReportsServiceTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cloud channel reports service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.CloudChannelReportsServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + self._client = CloudChannelReportsServiceClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + + ) + + async def run_report_job(self, + request: Union[reports_service.RunReportJobRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Begins generation of data for a given report. The report + identifier is a UID (for example, ``613bf59q``). + + Possible error codes: + + - PERMISSION_DENIED: The user doesn't have access to this + report. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The report identifier was not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + contains an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + To get the results of report generation, call + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults] + with the + [RunReportJobResponse.report_job][google.cloud.channel.v1.RunReportJobResponse.report_job]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_run_report_job(): + # Create a client + client = channel_v1.CloudChannelReportsServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.RunReportJobRequest( + name="name_value", + ) + + # Make the request + operation = client.run_report_job(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.RunReportJobRequest, dict]): + The request object. Request message for + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.RunReportJobResponse` + Response message for + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + + """ + # Create or coerce a protobuf request object. + request = reports_service.RunReportJobRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.run_report_job, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + reports_service.RunReportJobResponse, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def fetch_report_results(self, + request: Union[reports_service.FetchReportResultsRequest, dict] = None, + *, + report_job: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.FetchReportResultsAsyncPager: + r"""Retrieves data generated by + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_fetch_report_results(): + # Create a client + client = channel_v1.CloudChannelReportsServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.FetchReportResultsRequest( + report_job="report_job_value", + ) + + # Make the request + page_result = client.fetch_report_results(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.FetchReportResultsRequest, dict]): + The request object. Request message for + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]. + report_job (:class:`str`): + Required. The report job created by + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + Report_job uses the format: + accounts/{account_id}/reportJobs/{report_job_id} + + This corresponds to the ``report_job`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.FetchReportResultsAsyncPager: + Response message for [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]. + Contains a tabular representation of the report + results. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([report_job]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = reports_service.FetchReportResultsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if report_job is not None: + request.report_job = report_job + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.fetch_report_results, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("report_job", request.report_job), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.FetchReportResultsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_reports(self, + request: Union[reports_service.ListReportsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListReportsAsyncPager: + r"""Lists the reports that RunReportJob can run. These + reports include an ID, a description, and the list of + columns that will be in the result. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_reports(): + # Create a client + client = channel_v1.CloudChannelReportsServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListReportsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reports(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListReportsRequest, dict]): + The request object. Request message for + [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports]. + parent (:class:`str`): + Required. The resource name of the partner account to + list available reports for. Parent uses the format: + accounts/{account_id} + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.ListReportsAsyncPager: + Response message for + [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = reports_service.ListReportsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_reports, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListReportsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_operations( + self, + request: operations_pb2.ListOperationsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Lists operations that match the specified filter in the request. + + Args: + request (:class:`~.operations_pb2.ListOperationsRequest`): + The request object. Request message for + `ListOperations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.ListOperationsResponse: + Response message for ``ListOperations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.ListOperationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.list_operations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_operation( + self, + request: operations_pb2.GetOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Gets the latest state of a long-running operation. + + Args: + request (:class:`~.operations_pb2.GetOperationRequest`): + The request object. Request message for + `GetOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.Operation: + An ``Operation`` object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.GetOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.get_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_operation( + self, + request: operations_pb2.DeleteOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a long-running operation. + + This method indicates that the client is no longer interested + in the operation result. It does not cancel the operation. + If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.DeleteOperationRequest`): + The request object. Request message for + `DeleteOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.DeleteOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.delete_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + async def cancel_operation( + self, + request: operations_pb2.CancelOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Starts asynchronous cancellation on a long-running operation. + + The server makes a best effort to cancel the operation, but success + is not guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.CancelOperationRequest`): + The request object. Request message for + `CancelOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.CancelOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.cancel_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-channel", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ( + "CloudChannelReportsServiceAsyncClient", +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/client.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/client.py new file mode 100644 index 0000000..9471313 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/client.py @@ -0,0 +1,984 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.channel_v1.services.cloud_channel_reports_service import pagers +from google.cloud.channel_v1.types import operations +from google.cloud.channel_v1.types import reports_service +from google.longrunning import operations_pb2 +from .transports.base import CloudChannelReportsServiceTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import CloudChannelReportsServiceGrpcTransport +from .transports.grpc_asyncio import CloudChannelReportsServiceGrpcAsyncIOTransport + + +class CloudChannelReportsServiceClientMeta(type): + """Metaclass for the CloudChannelReportsService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + _transport_registry = OrderedDict() # type: Dict[str, Type[CloudChannelReportsServiceTransport]] + _transport_registry["grpc"] = CloudChannelReportsServiceGrpcTransport + _transport_registry["grpc_asyncio"] = CloudChannelReportsServiceGrpcAsyncIOTransport + + def get_transport_class(cls, + label: str = None, + ) -> Type[CloudChannelReportsServiceTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class CloudChannelReportsServiceClient(metaclass=CloudChannelReportsServiceClientMeta): + """CloudChannelReportsService lets Google Cloud resellers and + distributors retrieve and combine a variety of data in Cloud + Channel for multiple products (Google Cloud Platform (GCP), + Google Voice, and Google Workspace.) + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Converts api endpoint to mTLS endpoint. + + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "cloudchannel.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudChannelReportsServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudChannelReportsServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file( + filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> CloudChannelReportsServiceTransport: + """Returns the transport used by the client instance. + + Returns: + CloudChannelReportsServiceTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def report_path(account: str,report: str,) -> str: + """Returns a fully-qualified report string.""" + return "accounts/{account}/reports/{report}".format(account=account, report=report, ) + + @staticmethod + def parse_report_path(path: str) -> Dict[str,str]: + """Parses a report path into its component segments.""" + m = re.match(r"^accounts/(?P.+?)/reports/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def report_job_path(account: str,report_job: str,) -> str: + """Returns a fully-qualified report_job string.""" + return "accounts/{account}/reportJobs/{report_job}".format(account=account, report_job=report_job, ) + + @staticmethod + def parse_report_job_path(path: str) -> Dict[str,str]: + """Parses a report_job path into its component segments.""" + m = re.match(r"^accounts/(?P.+?)/reportJobs/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str, ) -> str: + """Returns a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str,str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str, ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder, ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str,str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str, ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization, ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str,str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str, ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format(project=project, ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str,str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str, ) -> str: + """Returns a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format(project=project, location=location, ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str,str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, CloudChannelReportsServiceTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cloud channel reports service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, CloudChannelReportsServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError("client_options.api_key and credentials are mutually exclusive") + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, CloudChannelReportsServiceTransport): + # transport is a CloudChannelReportsServiceTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError("When providing a transport instance, " + "provide its credentials directly.") + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): + credentials = google.auth._default.get_api_key_credentials(api_key_value) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=client_options.api_audience, + ) + + def run_report_job(self, + request: Union[reports_service.RunReportJobRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Begins generation of data for a given report. The report + identifier is a UID (for example, ``613bf59q``). + + Possible error codes: + + - PERMISSION_DENIED: The user doesn't have access to this + report. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The report identifier was not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + contains an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + To get the results of report generation, call + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults] + with the + [RunReportJobResponse.report_job][google.cloud.channel.v1.RunReportJobResponse.report_job]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_run_report_job(): + # Create a client + client = channel_v1.CloudChannelReportsServiceClient() + + # Initialize request argument(s) + request = channel_v1.RunReportJobRequest( + name="name_value", + ) + + # Make the request + operation = client.run_report_job(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.RunReportJobRequest, dict]): + The request object. Request message for + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.RunReportJobResponse` + Response message for + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a reports_service.RunReportJobRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, reports_service.RunReportJobRequest): + request = reports_service.RunReportJobRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.run_report_job] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + reports_service.RunReportJobResponse, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def fetch_report_results(self, + request: Union[reports_service.FetchReportResultsRequest, dict] = None, + *, + report_job: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.FetchReportResultsPager: + r"""Retrieves data generated by + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_fetch_report_results(): + # Create a client + client = channel_v1.CloudChannelReportsServiceClient() + + # Initialize request argument(s) + request = channel_v1.FetchReportResultsRequest( + report_job="report_job_value", + ) + + # Make the request + page_result = client.fetch_report_results(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.FetchReportResultsRequest, dict]): + The request object. Request message for + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]. + report_job (str): + Required. The report job created by + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + Report_job uses the format: + accounts/{account_id}/reportJobs/{report_job_id} + + This corresponds to the ``report_job`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.FetchReportResultsPager: + Response message for [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]. + Contains a tabular representation of the report + results. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([report_job]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a reports_service.FetchReportResultsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, reports_service.FetchReportResultsRequest): + request = reports_service.FetchReportResultsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if report_job is not None: + request.report_job = report_job + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.fetch_report_results] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("report_job", request.report_job), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.FetchReportResultsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_reports(self, + request: Union[reports_service.ListReportsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListReportsPager: + r"""Lists the reports that RunReportJob can run. These + reports include an ID, a description, and the list of + columns that will be in the result. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_reports(): + # Create a client + client = channel_v1.CloudChannelReportsServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListReportsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reports(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListReportsRequest, dict]): + The request object. Request message for + [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports]. + parent (str): + Required. The resource name of the partner account to + list available reports for. Parent uses the format: + accounts/{account_id} + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.ListReportsPager: + Response message for + [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a reports_service.ListReportsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, reports_service.ListReportsRequest): + request = reports_service.ListReportsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_reports] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListReportsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + def list_operations( + self, + request: operations_pb2.ListOperationsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Lists operations that match the specified filter in the request. + + Args: + request (:class:`~.operations_pb2.ListOperationsRequest`): + The request object. Request message for + `ListOperations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.ListOperationsResponse: + Response message for ``ListOperations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.ListOperationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.list_operations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_operation( + self, + request: operations_pb2.GetOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Gets the latest state of a long-running operation. + + Args: + request (:class:`~.operations_pb2.GetOperationRequest`): + The request object. Request message for + `GetOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.Operation: + An ``Operation`` object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.GetOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_operation( + self, + request: operations_pb2.DeleteOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a long-running operation. + + This method indicates that the client is no longer interested + in the operation result. It does not cancel the operation. + If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.DeleteOperationRequest`): + The request object. Request message for + `DeleteOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.DeleteOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.delete_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + def cancel_operation( + self, + request: operations_pb2.CancelOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Starts asynchronous cancellation on a long-running operation. + + The server makes a best effort to cancel the operation, but success + is not guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.CancelOperationRequest`): + The request object. Request message for + `CancelOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.CancelOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.cancel_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + + + + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-channel", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ( + "CloudChannelReportsServiceClient", +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py new file mode 100644 index 0000000..dc033f4 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py @@ -0,0 +1,260 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator + +from google.cloud.channel_v1.types import reports_service + + +class FetchReportResultsPager: + """A pager for iterating through ``fetch_report_results`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.FetchReportResultsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``rows`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``FetchReportResults`` requests and continue to iterate + through the ``rows`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.FetchReportResultsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., reports_service.FetchReportResultsResponse], + request: reports_service.FetchReportResultsRequest, + response: reports_service.FetchReportResultsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.FetchReportResultsRequest): + The initial request object. + response (google.cloud.channel_v1.types.FetchReportResultsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = reports_service.FetchReportResultsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[reports_service.FetchReportResultsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[reports_service.Row]: + for page in self.pages: + yield from page.rows + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class FetchReportResultsAsyncPager: + """A pager for iterating through ``fetch_report_results`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.FetchReportResultsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``rows`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``FetchReportResults`` requests and continue to iterate + through the ``rows`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.FetchReportResultsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[reports_service.FetchReportResultsResponse]], + request: reports_service.FetchReportResultsRequest, + response: reports_service.FetchReportResultsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.FetchReportResultsRequest): + The initial request object. + response (google.cloud.channel_v1.types.FetchReportResultsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = reports_service.FetchReportResultsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[reports_service.FetchReportResultsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[reports_service.Row]: + async def async_generator(): + async for page in self.pages: + for response in page.rows: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListReportsPager: + """A pager for iterating through ``list_reports`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListReportsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``reports`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListReports`` requests and continue to iterate + through the ``reports`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListReportsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., reports_service.ListReportsResponse], + request: reports_service.ListReportsRequest, + response: reports_service.ListReportsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListReportsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListReportsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = reports_service.ListReportsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[reports_service.ListReportsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[reports_service.Report]: + for page in self.pages: + yield from page.reports + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListReportsAsyncPager: + """A pager for iterating through ``list_reports`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListReportsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``reports`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListReports`` requests and continue to iterate + through the ``reports`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListReportsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[reports_service.ListReportsResponse]], + request: reports_service.ListReportsRequest, + response: reports_service.ListReportsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListReportsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListReportsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = reports_service.ListReportsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[reports_service.ListReportsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[reports_service.Report]: + async def async_generator(): + async for page in self.pages: + for response in page.reports: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py new file mode 100644 index 0000000..b81caab --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import CloudChannelReportsServiceTransport +from .grpc import CloudChannelReportsServiceGrpcTransport +from .grpc_asyncio import CloudChannelReportsServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[CloudChannelReportsServiceTransport]] +_transport_registry['grpc'] = CloudChannelReportsServiceGrpcTransport +_transport_registry['grpc_asyncio'] = CloudChannelReportsServiceGrpcAsyncIOTransport + +__all__ = ( + 'CloudChannelReportsServiceTransport', + 'CloudChannelReportsServiceGrpcTransport', + 'CloudChannelReportsServiceGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py new file mode 100644 index 0000000..e4fa2bb --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py @@ -0,0 +1,226 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import pkg_resources + +import google.auth # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.channel_v1.types import reports_service +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + 'google-cloud-channel', + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class CloudChannelReportsServiceTransport(abc.ABC): + """Abstract transport class for CloudChannelReportsService.""" + + AUTH_SCOPES = ( + 'https://www.googleapis.com/auth/apps.reports.usage.readonly', + ) + + DEFAULT_HOST: str = 'cloudchannel.googleapis.com' + def __init__( + self, *, + host: str = DEFAULT_HOST, + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, + **scopes_kwargs, + quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience(api_audience if api_audience else host) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ':' not in host: + host += ':443' + self._host = host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.run_report_job: gapic_v1.method.wrap_method( + self.run_report_job, + default_timeout=None, + client_info=client_info, + ), + self.fetch_report_results: gapic_v1.method.wrap_method( + self.fetch_report_results, + default_timeout=None, + client_info=client_info, + ), + self.list_reports: gapic_v1.method.wrap_method( + self.list_reports, + default_timeout=None, + client_info=client_info, + ), + } + + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + + @property + def operations_client(self): + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def run_report_job(self) -> Callable[ + [reports_service.RunReportJobRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def fetch_report_results(self) -> Callable[ + [reports_service.FetchReportResultsRequest], + Union[ + reports_service.FetchReportResultsResponse, + Awaitable[reports_service.FetchReportResultsResponse] + ]]: + raise NotImplementedError() + + @property + def list_reports(self) -> Callable[ + [reports_service.ListReportsRequest], + Union[ + reports_service.ListReportsResponse, + Awaitable[reports_service.ListReportsResponse] + ]]: + raise NotImplementedError() + + @property + def list_operations( + self, + ) -> Callable[ + [operations_pb2.ListOperationsRequest], + Union[operations_pb2.ListOperationsResponse, Awaitable[operations_pb2.ListOperationsResponse]], + ]: + raise NotImplementedError() + + @property + def get_operation( + self, + ) -> Callable[ + [operations_pb2.GetOperationRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def cancel_operation( + self, + ) -> Callable[ + [operations_pb2.CancelOperationRequest], + None, + ]: + raise NotImplementedError() + + @property + def delete_operation( + self, + ) -> Callable[ + [operations_pb2.DeleteOperationRequest], + None, + ]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + + +__all__ = ( + 'CloudChannelReportsServiceTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py new file mode 100644 index 0000000..4de3981 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py @@ -0,0 +1,439 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_v1 +import google.auth # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.channel_v1.types import reports_service +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore +from .base import CloudChannelReportsServiceTransport, DEFAULT_CLIENT_INFO + + +class CloudChannelReportsServiceGrpcTransport(CloudChannelReportsServiceTransport): + """gRPC backend transport for CloudChannelReportsService. + + CloudChannelReportsService lets Google Cloud resellers and + distributors retrieve and combine a variety of data in Cloud + Channel for multiple products (Google Cloud Platform (GCP), + Google Voice, and Google Workspace.) + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + _stubs: Dict[str, Callable] + + def __init__(self, *, + host: str = 'cloudchannel.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel(cls, + host: str = 'cloudchannel.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def run_report_job(self) -> Callable[ + [reports_service.RunReportJobRequest], + operations_pb2.Operation]: + r"""Return a callable for the run report job method over gRPC. + + Begins generation of data for a given report. The report + identifier is a UID (for example, ``613bf59q``). + + Possible error codes: + + - PERMISSION_DENIED: The user doesn't have access to this + report. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The report identifier was not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + contains an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + To get the results of report generation, call + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults] + with the + [RunReportJobResponse.report_job][google.cloud.channel.v1.RunReportJobResponse.report_job]. + + Returns: + Callable[[~.RunReportJobRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'run_report_job' not in self._stubs: + self._stubs['run_report_job'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelReportsService/RunReportJob', + request_serializer=reports_service.RunReportJobRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['run_report_job'] + + @property + def fetch_report_results(self) -> Callable[ + [reports_service.FetchReportResultsRequest], + reports_service.FetchReportResultsResponse]: + r"""Return a callable for the fetch report results method over gRPC. + + Retrieves data generated by + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + + Returns: + Callable[[~.FetchReportResultsRequest], + ~.FetchReportResultsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_report_results' not in self._stubs: + self._stubs['fetch_report_results'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelReportsService/FetchReportResults', + request_serializer=reports_service.FetchReportResultsRequest.serialize, + response_deserializer=reports_service.FetchReportResultsResponse.deserialize, + ) + return self._stubs['fetch_report_results'] + + @property + def list_reports(self) -> Callable[ + [reports_service.ListReportsRequest], + reports_service.ListReportsResponse]: + r"""Return a callable for the list reports method over gRPC. + + Lists the reports that RunReportJob can run. These + reports include an ID, a description, and the list of + columns that will be in the result. + + Returns: + Callable[[~.ListReportsRequest], + ~.ListReportsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_reports' not in self._stubs: + self._stubs['list_reports'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelReportsService/ListReports', + request_serializer=reports_service.ListReportsRequest.serialize, + response_deserializer=reports_service.ListReportsResponse.deserialize, + ) + return self._stubs['list_reports'] + + def close(self): + self.grpc_channel.close() + + @property + def delete_operation( + self, + ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: + r"""Return a callable for the delete_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_operation" not in self._stubs: + self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/DeleteOperation", + request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["delete_operation"] + + @property + def cancel_operation( + self, + ) -> Callable[[operations_pb2.CancelOperationRequest], None]: + r"""Return a callable for the cancel_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_operation" not in self._stubs: + self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def get_operation( + self, + ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: + r"""Return a callable for the get_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_operation" not in self._stubs: + self._stubs["get_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/GetOperation", + request_serializer=operations_pb2.GetOperationRequest.SerializeToString, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["get_operation"] + + @property + def list_operations( + self, + ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: + r"""Return a callable for the list_operations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_operations" not in self._stubs: + self._stubs["list_operations"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/ListOperations", + request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, + response_deserializer=operations_pb2.ListOperationsResponse.FromString, + ) + return self._stubs["list_operations"] + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ( + 'CloudChannelReportsServiceGrpcTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py new file mode 100644 index 0000000..1ea5db0 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py @@ -0,0 +1,438 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.channel_v1.types import reports_service +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore +from .base import CloudChannelReportsServiceTransport, DEFAULT_CLIENT_INFO +from .grpc import CloudChannelReportsServiceGrpcTransport + + +class CloudChannelReportsServiceGrpcAsyncIOTransport(CloudChannelReportsServiceTransport): + """gRPC AsyncIO backend transport for CloudChannelReportsService. + + CloudChannelReportsService lets Google Cloud resellers and + distributors retrieve and combine a variety of data in Cloud + Channel for multiple products (Google Cloud Platform (GCP), + Google Voice, and Google Workspace.) + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel(cls, + host: str = 'cloudchannel.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + def __init__(self, *, + host: str = 'cloudchannel.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def run_report_job(self) -> Callable[ + [reports_service.RunReportJobRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the run report job method over gRPC. + + Begins generation of data for a given report. The report + identifier is a UID (for example, ``613bf59q``). + + Possible error codes: + + - PERMISSION_DENIED: The user doesn't have access to this + report. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The report identifier was not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + contains an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + To get the results of report generation, call + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults] + with the + [RunReportJobResponse.report_job][google.cloud.channel.v1.RunReportJobResponse.report_job]. + + Returns: + Callable[[~.RunReportJobRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'run_report_job' not in self._stubs: + self._stubs['run_report_job'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelReportsService/RunReportJob', + request_serializer=reports_service.RunReportJobRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['run_report_job'] + + @property + def fetch_report_results(self) -> Callable[ + [reports_service.FetchReportResultsRequest], + Awaitable[reports_service.FetchReportResultsResponse]]: + r"""Return a callable for the fetch report results method over gRPC. + + Retrieves data generated by + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + + Returns: + Callable[[~.FetchReportResultsRequest], + Awaitable[~.FetchReportResultsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_report_results' not in self._stubs: + self._stubs['fetch_report_results'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelReportsService/FetchReportResults', + request_serializer=reports_service.FetchReportResultsRequest.serialize, + response_deserializer=reports_service.FetchReportResultsResponse.deserialize, + ) + return self._stubs['fetch_report_results'] + + @property + def list_reports(self) -> Callable[ + [reports_service.ListReportsRequest], + Awaitable[reports_service.ListReportsResponse]]: + r"""Return a callable for the list reports method over gRPC. + + Lists the reports that RunReportJob can run. These + reports include an ID, a description, and the list of + columns that will be in the result. + + Returns: + Callable[[~.ListReportsRequest], + Awaitable[~.ListReportsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_reports' not in self._stubs: + self._stubs['list_reports'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelReportsService/ListReports', + request_serializer=reports_service.ListReportsRequest.serialize, + response_deserializer=reports_service.ListReportsResponse.deserialize, + ) + return self._stubs['list_reports'] + + def close(self): + return self.grpc_channel.close() + + @property + def delete_operation( + self, + ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: + r"""Return a callable for the delete_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_operation" not in self._stubs: + self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/DeleteOperation", + request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["delete_operation"] + + @property + def cancel_operation( + self, + ) -> Callable[[operations_pb2.CancelOperationRequest], None]: + r"""Return a callable for the cancel_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_operation" not in self._stubs: + self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def get_operation( + self, + ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: + r"""Return a callable for the get_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_operation" not in self._stubs: + self._stubs["get_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/GetOperation", + request_serializer=operations_pb2.GetOperationRequest.SerializeToString, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["get_operation"] + + @property + def list_operations( + self, + ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: + r"""Return a callable for the list_operations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_operations" not in self._stubs: + self._stubs["list_operations"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/ListOperations", + request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, + response_deserializer=operations_pb2.ListOperationsResponse.FromString, + ) + return self._stubs["list_operations"] + + +__all__ = ( + 'CloudChannelReportsServiceGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/__init__.py new file mode 100644 index 0000000..2266987 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .client import CloudChannelServiceClient +from .async_client import CloudChannelServiceAsyncClient + +__all__ = ( + 'CloudChannelServiceClient', + 'CloudChannelServiceAsyncClient', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/async_client.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/async_client.py new file mode 100644 index 0000000..7182e00 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/async_client.py @@ -0,0 +1,5677 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import functools +import re +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.channel_v1.services.cloud_channel_service import pagers +from google.cloud.channel_v1.types import channel_partner_links +from google.cloud.channel_v1.types import common +from google.cloud.channel_v1.types import customers +from google.cloud.channel_v1.types import entitlements +from google.cloud.channel_v1.types import offers +from google.cloud.channel_v1.types import operations +from google.cloud.channel_v1.types import products +from google.cloud.channel_v1.types import repricing +from google.cloud.channel_v1.types import service +from google.longrunning import operations_pb2 +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import postal_address_pb2 # type: ignore +from .transports.base import CloudChannelServiceTransport, DEFAULT_CLIENT_INFO +from .transports.grpc_asyncio import CloudChannelServiceGrpcAsyncIOTransport +from .client import CloudChannelServiceClient + + +class CloudChannelServiceAsyncClient: + """CloudChannelService lets Google cloud resellers and distributors + manage their customers, channel partners, entitlements, and reports. + + Using this service: + + 1. Resellers and distributors can manage a customer entity. + 2. Distributors can register an authorized reseller in their channel + and provide them with delegated admin access. + 3. Resellers and distributors can manage customer entitlements. + + CloudChannelService exposes the following resources: + + - [Customer][google.cloud.channel.v1.Customer]s: An entity—usually + an enterprise—managed by a reseller or distributor. + + - [Entitlement][google.cloud.channel.v1.Entitlement]s: An entity + that provides a customer with the means to use a service. + Entitlements are created or updated as a result of a successful + fulfillment. + + - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s: + An entity that identifies links between distributors and their + indirect resellers in a channel. + """ + + _client: CloudChannelServiceClient + + DEFAULT_ENDPOINT = CloudChannelServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = CloudChannelServiceClient.DEFAULT_MTLS_ENDPOINT + + channel_partner_link_path = staticmethod(CloudChannelServiceClient.channel_partner_link_path) + parse_channel_partner_link_path = staticmethod(CloudChannelServiceClient.parse_channel_partner_link_path) + channel_partner_repricing_config_path = staticmethod(CloudChannelServiceClient.channel_partner_repricing_config_path) + parse_channel_partner_repricing_config_path = staticmethod(CloudChannelServiceClient.parse_channel_partner_repricing_config_path) + customer_path = staticmethod(CloudChannelServiceClient.customer_path) + parse_customer_path = staticmethod(CloudChannelServiceClient.parse_customer_path) + customer_repricing_config_path = staticmethod(CloudChannelServiceClient.customer_repricing_config_path) + parse_customer_repricing_config_path = staticmethod(CloudChannelServiceClient.parse_customer_repricing_config_path) + entitlement_path = staticmethod(CloudChannelServiceClient.entitlement_path) + parse_entitlement_path = staticmethod(CloudChannelServiceClient.parse_entitlement_path) + offer_path = staticmethod(CloudChannelServiceClient.offer_path) + parse_offer_path = staticmethod(CloudChannelServiceClient.parse_offer_path) + product_path = staticmethod(CloudChannelServiceClient.product_path) + parse_product_path = staticmethod(CloudChannelServiceClient.parse_product_path) + sku_path = staticmethod(CloudChannelServiceClient.sku_path) + parse_sku_path = staticmethod(CloudChannelServiceClient.parse_sku_path) + common_billing_account_path = staticmethod(CloudChannelServiceClient.common_billing_account_path) + parse_common_billing_account_path = staticmethod(CloudChannelServiceClient.parse_common_billing_account_path) + common_folder_path = staticmethod(CloudChannelServiceClient.common_folder_path) + parse_common_folder_path = staticmethod(CloudChannelServiceClient.parse_common_folder_path) + common_organization_path = staticmethod(CloudChannelServiceClient.common_organization_path) + parse_common_organization_path = staticmethod(CloudChannelServiceClient.parse_common_organization_path) + common_project_path = staticmethod(CloudChannelServiceClient.common_project_path) + parse_common_project_path = staticmethod(CloudChannelServiceClient.parse_common_project_path) + common_location_path = staticmethod(CloudChannelServiceClient.common_location_path) + parse_common_location_path = staticmethod(CloudChannelServiceClient.parse_common_location_path) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudChannelServiceAsyncClient: The constructed client. + """ + return CloudChannelServiceClient.from_service_account_info.__func__(CloudChannelServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudChannelServiceAsyncClient: The constructed client. + """ + return CloudChannelServiceClient.from_service_account_file.__func__(CloudChannelServiceAsyncClient, filename, *args, **kwargs) # type: ignore + + from_service_account_json = from_service_account_file + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return CloudChannelServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> CloudChannelServiceTransport: + """Returns the transport used by the client instance. + + Returns: + CloudChannelServiceTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial(type(CloudChannelServiceClient).get_transport_class, type(CloudChannelServiceClient)) + + def __init__(self, *, + credentials: ga_credentials.Credentials = None, + transport: Union[str, CloudChannelServiceTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cloud channel service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.CloudChannelServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + self._client = CloudChannelServiceClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + + ) + + async def list_customers(self, + request: Union[service.ListCustomersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCustomersAsyncPager: + r"""List [Customer][google.cloud.channel.v1.Customer]s. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: List of + [Customer][google.cloud.channel.v1.Customer]s, or an empty list + if there are no customers. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_customers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListCustomersRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_customers(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListCustomersRequest, dict]): + The request object. Request message for + [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomersAsyncPager: + Response message for + [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListCustomersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_customers, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCustomersAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_customer(self, + request: Union[service.GetCustomerRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> customers.Customer: + r"""Returns the requested + [Customer][google.cloud.channel.v1.Customer] resource. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer resource doesn't exist. Usually the + result of an invalid name parameter. + + Return value: The [Customer][google.cloud.channel.v1.Customer] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_get_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetCustomerRequest( + name="name_value", + ) + + # Make the request + response = await client.get_customer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.GetCustomer][google.cloud.channel.v1.CloudChannelService.GetCustomer]. + name (:class:`str`): + Required. The resource name of the customer to retrieve. + Name uses the format: + accounts/{account_id}/customers/{customer_id} + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Customer: + Entity representing a customer of a + reseller or distributor. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.GetCustomerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_customer, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def check_cloud_identity_accounts_exist(self, + request: Union[service.CheckCloudIdentityAccountsExistRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.CheckCloudIdentityAccountsExistResponse: + r"""Confirms the existence of Cloud Identity accounts based on the + domain and if the Cloud Identity accounts are owned by the + reseller. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - INVALID_VALUE: Invalid domain value in the request. + + Return value: A list of + [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] + resources for the domain (may be empty) + + Note: in the v1alpha1 version of the API, a NOT_FOUND error + returns if no + [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] + resources match the domain. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_check_cloud_identity_accounts_exist(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.CheckCloudIdentityAccountsExistRequest( + parent="parent_value", + domain="domain_value", + ) + + # Make the request + response = await client.check_cloud_identity_accounts_exist(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistRequest, dict]): + The request object. Request message for + [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistResponse: + Response message for + [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. + + """ + # Create or coerce a protobuf request object. + request = service.CheckCloudIdentityAccountsExistRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.check_cloud_identity_accounts_exist, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_customer(self, + request: Union[service.CreateCustomerRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> customers.Customer: + r"""Creates a new [Customer][google.cloud.channel.v1.Customer] + resource under the reseller or distributor account. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - Domain field value doesn't match the primary email domain. + + Return value: The newly created + [Customer][google.cloud.channel.v1.Customer] resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_create_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + customer = channel_v1.Customer() + customer.org_display_name = "org_display_name_value" + customer.domain = "domain_value" + + request = channel_v1.CreateCustomerRequest( + parent="parent_value", + customer=customer, + ) + + # Make the request + response = await client.create_customer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateCustomer][google.cloud.channel.v1.CloudChannelService.CreateCustomer] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Customer: + Entity representing a customer of a + reseller or distributor. + + """ + # Create or coerce a protobuf request object. + request = service.CreateCustomerRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_customer, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_customer(self, + request: Union[service.UpdateCustomerRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> customers.Customer: + r"""Updates an existing [Customer][google.cloud.channel.v1.Customer] + resource for the reseller or distributor. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] + resource found for the name in the request. + + Return value: The updated + [Customer][google.cloud.channel.v1.Customer] resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_update_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + customer = channel_v1.Customer() + customer.org_display_name = "org_display_name_value" + customer.domain = "domain_value" + + request = channel_v1.UpdateCustomerRequest( + customer=customer, + ) + + # Make the request + response = await client.update_customer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UpdateCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.UpdateCustomer][google.cloud.channel.v1.CloudChannelService.UpdateCustomer]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Customer: + Entity representing a customer of a + reseller or distributor. + + """ + # Create or coerce a protobuf request object. + request = service.UpdateCustomerRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_customer, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer.name", request.customer.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_customer(self, + request: Union[service.DeleteCustomerRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the given [Customer][google.cloud.channel.v1.Customer] + permanently. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The customer has existing entitlements. + - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] + resource found for the name in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_delete_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.DeleteCustomerRequest( + name="name_value", + ) + + # Make the request + await client.delete_customer(request=request) + + Args: + request (Union[google.cloud.channel_v1.types.DeleteCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.DeleteCustomer][google.cloud.channel.v1.CloudChannelService.DeleteCustomer]. + name (:class:`str`): + Required. The resource name of the + customer to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.DeleteCustomerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_customer, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def import_customer(self, + request: Union[service.ImportCustomerRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> customers.Customer: + r"""Imports a [Customer][google.cloud.channel.v1.Customer] from the + Cloud Identity associated with the provided Cloud Identity ID or + domain before a TransferEntitlements call. If a linked Customer + already exists and overwrite_if_exists is true, it will update + that Customer's data. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - NOT_FOUND: Cloud Identity doesn't exist or was deleted. + - INVALID_ARGUMENT: Required parameters are missing, or the + auth_token is expired or invalid. + - ALREADY_EXISTS: A customer already exists and has conflicting + critical fields. Requires an overwrite. + + Return value: The [Customer][google.cloud.channel.v1.Customer]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_import_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ImportCustomerRequest( + domain="domain_value", + parent="parent_value", + overwrite_if_exists=True, + ) + + # Make the request + response = await client.import_customer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ImportCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Customer: + Entity representing a customer of a + reseller or distributor. + + """ + # Create or coerce a protobuf request object. + request = service.ImportCustomerRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.import_customer, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def provision_cloud_identity(self, + request: Union[service.ProvisionCloudIdentityRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates a Cloud Identity for the given customer using the + customer's information, or the information provided here. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer was not found. + - ALREADY_EXISTS: The customer's primary email already exists. + Retry after changing the customer's primary contact email. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + contains an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_provision_cloud_identity(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ProvisionCloudIdentityRequest( + customer="customer_value", + ) + + # Make the request + operation = client.provision_cloud_identity(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ProvisionCloudIdentityRequest, dict]): + The request object. Request message for + [CloudChannelService.ProvisionCloudIdentity][google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Customer` Entity + representing a customer of a reseller or distributor. + + """ + # Create or coerce a protobuf request object. + request = service.ProvisionCloudIdentityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.provision_cloud_identity, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer", request.customer), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + customers.Customer, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def list_entitlements(self, + request: Union[service.ListEntitlementsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEntitlementsAsyncPager: + r"""Lists [Entitlement][google.cloud.channel.v1.Entitlement]s + belonging to a customer. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: A list of the customer's + [Entitlement][google.cloud.channel.v1.Entitlement]s. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_entitlements(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListEntitlementsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_entitlements(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListEntitlementsRequest, dict]): + The request object. Request message for + [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListEntitlementsAsyncPager: + Response message for + [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListEntitlementsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_entitlements, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListEntitlementsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_transferable_skus(self, + request: Union[service.ListTransferableSkusRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTransferableSkusAsyncPager: + r"""List [TransferableSku][google.cloud.channel.v1.TransferableSku]s + of a customer based on the Cloud Identity ID or Customer Name in + the request. + + Use this method to list the entitlements information of an + unowned customer. You should provide the customer's Cloud + Identity ID or Customer Name. + + Possible error codes: + + - PERMISSION_DENIED: + + - The customer doesn't belong to the reseller and has no + auth token. + - The supplied auth token is invalid. + - The reseller account making the request is different from + the reseller account in the query. + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: A list of the customer's + [TransferableSku][google.cloud.channel.v1.TransferableSku]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_transferable_skus(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListTransferableSkusRequest( + cloud_identity_id="cloud_identity_id_value", + parent="parent_value", + ) + + # Make the request + page_result = client.list_transferable_skus(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListTransferableSkusRequest, dict]): + The request object. Request message for + [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableSkusAsyncPager: + Response message for + [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListTransferableSkusRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_transferable_skus, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListTransferableSkusAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_transferable_offers(self, + request: Union[service.ListTransferableOffersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTransferableOffersAsyncPager: + r"""List + [TransferableOffer][google.cloud.channel.v1.TransferableOffer]s + of a customer based on Cloud Identity ID or Customer Name in the + request. + + Use this method when a reseller gets the entitlement information + of an unowned customer. The reseller should provide the + customer's Cloud Identity ID or Customer Name. + + Possible error codes: + + - PERMISSION_DENIED: + + - The customer doesn't belong to the reseller and has no + auth token. + - The customer provided incorrect reseller information when + generating auth token. + - The reseller account making the request is different from + the reseller account in the query. + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: List of + [TransferableOffer][google.cloud.channel.v1.TransferableOffer] + for the given customer and SKU. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_transferable_offers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListTransferableOffersRequest( + cloud_identity_id="cloud_identity_id_value", + parent="parent_value", + sku="sku_value", + ) + + # Make the request + page_result = client.list_transferable_offers(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListTransferableOffersRequest, dict]): + The request object. Request message for + [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableOffersAsyncPager: + Response message for + [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListTransferableOffersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_transferable_offers, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListTransferableOffersAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_entitlement(self, + request: Union[service.GetEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> entitlements.Entitlement: + r"""Returns the requested + [Entitlement][google.cloud.channel.v1.Entitlement] resource. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer entitlement was not found. + + Return value: The requested + [Entitlement][google.cloud.channel.v1.Entitlement] resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_get_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetEntitlementRequest( + name="name_value", + ) + + # Make the request + response = await client.get_entitlement(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.GetEntitlement][google.cloud.channel.v1.CloudChannelService.GetEntitlement]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Entitlement: + An entitlement is a representation of + a customer's ability to use a service. + + """ + # Create or coerce a protobuf request object. + request = service.GetEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_entitlement, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_entitlement(self, + request: Union[service.CreateEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates an entitlement for a customer. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - There is already a customer entitlement for a SKU from the + same product family. + + - INVALID_VALUE: Make sure the OfferId is valid. If it is, + contact Google Channel support for further troubleshooting. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: + + - The SKU was already purchased for the customer. + - The customer's primary email already exists. Retry after + changing the customer's primary contact email. + + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The domain required for purchasing a SKU has not been + verified. + - A pre-requisite SKU required to purchase an Add-On SKU is + missing. For example, Google Workspace Business Starter is + required to purchase Vault or Drive. + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_create_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + entitlement = channel_v1.Entitlement() + entitlement.offer = "offer_value" + + request = channel_v1.CreateEntitlementRequest( + parent="parent_value", + entitlement=entitlement, + ) + + # Make the request + operation = client.create_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateEntitlement][google.cloud.channel.v1.CloudChannelService.CreateEntitlement] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + request = service.CreateEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_entitlement, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def change_parameters(self, + request: Union[service.ChangeParametersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Change parameters of the entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. For example, the number of seats being changed is + greater than the allowed number of max seats, or decreasing + seats for a commitment based plan. + - NOT_FOUND: Entitlement resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_change_parameters(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ChangeParametersRequest( + name="name_value", + ) + + # Make the request + operation = client.change_parameters(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ChangeParametersRequest, dict]): + The request object. Request message for + [CloudChannelService.ChangeParametersRequest][]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + request = service.ChangeParametersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.change_parameters, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def change_renewal_settings(self, + request: Union[service.ChangeRenewalSettingsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates the renewal settings for an existing customer + entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for + a commitment plan. Can't enable or disable renewals for + non-commitment plans. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_change_renewal_settings(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ChangeRenewalSettingsRequest( + name="name_value", + ) + + # Make the request + operation = client.change_renewal_settings(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ChangeRenewalSettingsRequest, dict]): + The request object. Request message for + [CloudChannelService.ChangeRenewalSettings][google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + request = service.ChangeRenewalSettingsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.change_renewal_settings, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def change_offer(self, + request: Union[service.ChangeOfferRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Updates the Offer for an existing customer entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Offer or Entitlement resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_change_offer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ChangeOfferRequest( + name="name_value", + offer="offer_value", + ) + + # Make the request + operation = client.change_offer(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ChangeOfferRequest, dict]): + The request object. Request message for + [CloudChannelService.ChangeOffer][google.cloud.channel.v1.CloudChannelService.ChangeOffer]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + request = service.ChangeOfferRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.change_offer, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def start_paid_service(self, + request: Union[service.StartPaidServiceRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Starts paid service for a trial entitlement. + + Starts paid service for a trial entitlement immediately. This + method is only applicable if a plan is set up for a trial + entitlement but has some trial days remaining. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for + entitlement on trial plans. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_start_paid_service(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.StartPaidServiceRequest( + name="name_value", + ) + + # Make the request + operation = client.start_paid_service(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.StartPaidServiceRequest, dict]): + The request object. Request message for + [CloudChannelService.StartPaidService][google.cloud.channel.v1.CloudChannelService.StartPaidService]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + request = service.StartPaidServiceRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.start_paid_service, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def suspend_entitlement(self, + request: Union[service.SuspendEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Suspends a previously fulfilled entitlement. + + An entitlement suspension is a long-running operation. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - NOT_ACTIVE: Entitlement is not active. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_suspend_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.SuspendEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.suspend_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.SuspendEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.SuspendEntitlement][google.cloud.channel.v1.CloudChannelService.SuspendEntitlement]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + request = service.SuspendEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.suspend_entitlement, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def cancel_entitlement(self, + request: Union[service.CancelEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Cancels a previously fulfilled entitlement. + + An entitlement cancellation is a long-running operation. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - FAILED_PRECONDITION: There are Google Cloud projects linked + to the Google Cloud entitlement's Cloud Billing subaccount. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google + Workspace add-ons, or entitlements for Google Cloud's + development platform. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The response will + contain google.protobuf.Empty on success. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_cancel_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.CancelEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.cancel_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CancelEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.CancelEntitlement][google.cloud.channel.v1.CloudChannelService.CancelEntitlement]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + request = service.CancelEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.cancel_entitlement, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def activate_entitlement(self, + request: Union[service.ActivateEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Activates a previously suspended entitlement. Entitlements + suspended for pending ToS acceptance can't be activated using + this method. + + An entitlement activation is a long-running operation and it + updates the state of the customer entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - SUSPENSION_NOT_RESELLER_INITIATED: Can only activate + reseller-initiated suspensions and entitlements that have + accepted the TOS. + - NOT_SUSPENDED: Can only activate suspended entitlements not + in an ACTIVE state. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_activate_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ActivateEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.activate_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ActivateEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.ActivateEntitlement][google.cloud.channel.v1.CloudChannelService.ActivateEntitlement]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + request = service.ActivateEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.activate_entitlement, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def transfer_entitlements(self, + request: Union[service.TransferEntitlementsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Transfers customer entitlements to new reseller. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: The SKU was already transferred for the + customer. + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The SKU requires domain verification to transfer, but the + domain is not verified. + - An Add-On SKU (example, Vault or Drive) is missing the + pre-requisite SKU (example, G Suite Basic). + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - Specify all transferring entitlements. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_transfer_entitlements(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + entitlements = channel_v1.Entitlement() + entitlements.offer = "offer_value" + + request = channel_v1.TransferEntitlementsRequest( + parent="parent_value", + entitlements=entitlements, + ) + + # Make the request + operation = client.transfer_entitlements(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.TransferEntitlementsRequest, dict]): + The request object. Request message for + [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.channel_v1.types.TransferEntitlementsResponse` Response message for [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. + This is put in the response field of + google.longrunning.Operation. + + """ + # Create or coerce a protobuf request object. + request = service.TransferEntitlementsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.transfer_entitlements, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + service.TransferEntitlementsResponse, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def transfer_entitlements_to_google(self, + request: Union[service.TransferEntitlementsToGoogleRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Transfers customer entitlements from their current reseller to + Google. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: The SKU was already transferred for the + customer. + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The SKU requires domain verification to transfer, but the + domain is not verified. + - An Add-On SKU (example, Vault or Drive) is missing the + pre-requisite SKU (example, G Suite Basic). + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The response will + contain google.protobuf.Empty on success. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_transfer_entitlements_to_google(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + entitlements = channel_v1.Entitlement() + entitlements.offer = "offer_value" + + request = channel_v1.TransferEntitlementsToGoogleRequest( + parent="parent_value", + entitlements=entitlements, + ) + + # Make the request + operation = client.transfer_entitlements_to_google(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.TransferEntitlementsToGoogleRequest, dict]): + The request object. Request message for + [CloudChannelService.TransferEntitlementsToGoogle][google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + request = service.TransferEntitlementsToGoogleRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.transfer_entitlements_to_google, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + async def list_channel_partner_links(self, + request: Union[service.ListChannelPartnerLinksRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListChannelPartnerLinksAsyncPager: + r"""List + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s + belonging to a distributor. You must be a distributor to call + this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: The list of the distributor account's + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resources. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_channel_partner_links(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListChannelPartnerLinksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_channel_partner_links(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListChannelPartnerLinksRequest, dict]): + The request object. Request message for + [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerLinksAsyncPager: + Response message for + [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListChannelPartnerLinksRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_channel_partner_links, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListChannelPartnerLinksAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_channel_partner_link(self, + request: Union[service.GetChannelPartnerLinkRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> channel_partner_links.ChannelPartnerLink: + r"""Returns the requested + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. You must be a distributor to call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: ChannelPartnerLink resource not found because of + an invalid channel partner link name. + + Return value: The + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_get_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetChannelPartnerLinkRequest( + name="name_value", + ) + + # Make the request + response = await client.get_channel_partner_link(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetChannelPartnerLinkRequest, dict]): + The request object. Request message for + [CloudChannelService.GetChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerLink: + Entity representing a link between + distributors and their indirect + resellers in an n-tier resale channel. + + """ + # Create or coerce a protobuf request object. + request = service.GetChannelPartnerLinkRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_channel_partner_link, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_channel_partner_link(self, + request: Union[service.CreateChannelPartnerLinkRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> channel_partner_links.ChannelPartnerLink: + r"""Initiates a channel partner link between a distributor and a + reseller, or between resellers in an n-tier reseller channel. + Invited partners need to follow the invite_link_uri provided in + the response to accept. After accepting the invitation, a link + is set up between the two parties. You must be a distributor to + call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - ALREADY_EXISTS: The ChannelPartnerLink sent in the request + already exists. + - NOT_FOUND: No Cloud Identity customer exists for provided + domain. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The new + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_create_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + channel_partner_link = channel_v1.ChannelPartnerLink() + channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" + channel_partner_link.link_state = "SUSPENDED" + + request = channel_v1.CreateChannelPartnerLinkRequest( + parent="parent_value", + channel_partner_link=channel_partner_link, + ) + + # Make the request + response = await client.create_channel_partner_link(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateChannelPartnerLinkRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerLink: + Entity representing a link between + distributors and their indirect + resellers in an n-tier resale channel. + + """ + # Create or coerce a protobuf request object. + request = service.CreateChannelPartnerLinkRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_channel_partner_link, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_channel_partner_link(self, + request: Union[service.UpdateChannelPartnerLinkRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> channel_partner_links.ChannelPartnerLink: + r"""Updates a channel partner link. Distributors call this method to + change a link's status. For example, to suspend a partner link. + You must be a distributor to call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - Link state cannot change from invited to active or + suspended. + - Cannot send reseller_cloud_identity_id, invite_url, or + name in update mask. + + - NOT_FOUND: ChannelPartnerLink resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The updated + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_update_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + channel_partner_link = channel_v1.ChannelPartnerLink() + channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" + channel_partner_link.link_state = "SUSPENDED" + + request = channel_v1.UpdateChannelPartnerLinkRequest( + name="name_value", + channel_partner_link=channel_partner_link, + ) + + # Make the request + response = await client.update_channel_partner_link(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UpdateChannelPartnerLinkRequest, dict]): + The request object. Request message for + [CloudChannelService.UpdateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerLink: + Entity representing a link between + distributors and their indirect + resellers in an n-tier resale channel. + + """ + # Create or coerce a protobuf request object. + request = service.UpdateChannelPartnerLinkRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_channel_partner_link, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_customer_repricing_config(self, + request: Union[service.GetCustomerRepricingConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.CustomerRepricingConfig: + r"""Gets information about how a Reseller modifies their bill before + sending it to a Customer. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + was not found. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_get_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetCustomerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + response = await client.get_customer_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetCustomerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.GetCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig]. + name (:class:`str`): + Required. The resource name of the + CustomerRepricingConfig. Format: + accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.CustomerRepricingConfig: + Configuration for how a reseller will + reprice a Customer. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.GetCustomerRepricingConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_customer_repricing_config, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_customer_repricing_configs(self, + request: Union[service.ListCustomerRepricingConfigsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCustomerRepricingConfigsAsyncPager: + r"""Lists information about how a Reseller modifies their bill + before sending it to a Customer. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resources. The data for each resource is displayed in the + ascending order of: + + - customer ID + - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] + - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + - [CustomerRepricingConfig.update_time][google.cloud.channel.v1.CustomerRepricingConfig.update_time] + + If unsuccessful, returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_customer_repricing_configs(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListCustomerRepricingConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_customer_repricing_configs(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest, dict]): + The request object. Request message for + [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. + parent (:class:`str`): + Required. The resource name of the customer. Parent uses + the format: + accounts/{account_id}/customers/{customer_id}. Supports + accounts/{account_id}/customers/- to retrieve configs + for all customers. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomerRepricingConfigsAsyncPager: + Response message for + [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.ListCustomerRepricingConfigsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_customer_repricing_configs, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCustomerRepricingConfigsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_customer_repricing_config(self, + request: Union[service.CreateCustomerRepricingConfigRequest, dict] = None, + *, + parent: str = None, + customer_repricing_config: repricing.CustomerRepricingConfig = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.CustomerRepricingConfig: + r"""Creates a CustomerRepricingConfig. Call this method to set + modifications for a specific customer's bill. You can only + create configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. If needed, you can create a config for the + current month, with some restrictions. + + When creating a config for a future month, make sure there are + no existing configs for that + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + The following restrictions are for creating configs in the + current month. + + - This functionality is reserved for recovering from an + erroneous config, and should not be used for regular business + cases. + - The new config will not modify exports used with other + configs. Changes to the config may be immediate, but may take + up to 24 hours. + - There is a limit of ten configs for any + [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] + or + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + - The contained + [CustomerRepricingConfig.repricing_config][google.cloud.channel.v1.CustomerRepricingConfig.repricing_config] + vaule must be different from the value used in the current + config for a + [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement]. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_create_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + customer_repricing_config = channel_v1.CustomerRepricingConfig() + customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.CreateCustomerRepricingConfigRequest( + parent="parent_value", + customer_repricing_config=customer_repricing_config, + ) + + # Make the request + response = await client.create_customer_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateCustomerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig]. + parent (:class:`str`): + Required. The resource name of the customer that will + receive this repricing config. Parent uses the format: + accounts/{account_id}/customers/{customer_id} + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + customer_repricing_config (:class:`google.cloud.channel_v1.types.CustomerRepricingConfig`): + Required. The CustomerRepricingConfig + object to update. + + This corresponds to the ``customer_repricing_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.CustomerRepricingConfig: + Configuration for how a reseller will + reprice a Customer. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, customer_repricing_config]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.CreateCustomerRepricingConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if customer_repricing_config is not None: + request.customer_repricing_config = customer_repricing_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_customer_repricing_config, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_customer_repricing_config(self, + request: Union[service.UpdateCustomerRepricingConfigRequest, dict] = None, + *, + customer_repricing_config: repricing.CustomerRepricingConfig = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.CustomerRepricingConfig: + r"""Updates a CustomerRepricingConfig. Call this method to set + modifications for a specific customer's bill. This method + overwrites the existing CustomerRepricingConfig. + + You can only update configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. To make changes to configs for the current + month, use + [CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig], + taking note of its restrictions. You cannot update the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + When updating a config in the future: + + - This config must already exist. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_update_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + customer_repricing_config = channel_v1.CustomerRepricingConfig() + customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.UpdateCustomerRepricingConfigRequest( + customer_repricing_config=customer_repricing_config, + ) + + # Make the request + response = await client.update_customer_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UpdateCustomerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.UpdateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig]. + customer_repricing_config (:class:`google.cloud.channel_v1.types.CustomerRepricingConfig`): + Required. The CustomerRepricingConfig + object to update. + + This corresponds to the ``customer_repricing_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.CustomerRepricingConfig: + Configuration for how a reseller will + reprice a Customer. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([customer_repricing_config]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.UpdateCustomerRepricingConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if customer_repricing_config is not None: + request.customer_repricing_config = customer_repricing_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_customer_repricing_config, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer_repricing_config.name", request.customer_repricing_config.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_customer_repricing_config(self, + request: Union[service.DeleteCustomerRepricingConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the given + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + permanently. You can only delete configs if their + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is set to a date after the current month. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + is active or in the past. + - NOT_FOUND: No + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + found for the name in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_delete_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.DeleteCustomerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + await client.delete_customer_repricing_config(request=request) + + Args: + request (Union[google.cloud.channel_v1.types.DeleteCustomerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.DeleteCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig]. + name (:class:`str`): + Required. The resource name of the customer repricing + config rule to delete. Format: + accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.DeleteCustomerRepricingConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_customer_repricing_config, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def get_channel_partner_repricing_config(self, + request: Union[service.GetChannelPartnerRepricingConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.ChannelPartnerRepricingConfig: + r"""Gets information about how a Distributor modifies their bill + before sending it to a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + was not found. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_get_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetChannelPartnerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + response = await client.get_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetChannelPartnerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.GetChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig] + name (:class:`str`): + Required. The resource name of the + ChannelPartnerRepricingConfig Format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: + Configuration for how a distributor + will rebill a channel partner (also + known as a distributor-authorized + reseller). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.GetChannelPartnerRepricingConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_channel_partner_repricing_config, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_channel_partner_repricing_configs(self, + request: Union[service.ListChannelPartnerRepricingConfigsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListChannelPartnerRepricingConfigsAsyncPager: + r"""Lists information about how a Reseller modifies their bill + before sending it to a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resources. The data for each resource is displayed in the + ascending order of: + + - channel partner ID + - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + - [ChannelPartnerRepricingConfig.update_time][google.cloud.channel.v1.ChannelPartnerRepricingConfig.update_time] + + If unsuccessful, returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_channel_partner_repricing_configs(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListChannelPartnerRepricingConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_channel_partner_repricing_configs(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest, dict]): + The request object. Request message for + [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. + parent (:class:`str`): + Required. The resource name of the account's + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]. + Parent uses the format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id}. + Supports accounts/{account_id}/channelPartnerLinks/- to + retrieve configs for all channel partners. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerRepricingConfigsAsyncPager: + Response message for + [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.ListChannelPartnerRepricingConfigsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_channel_partner_repricing_configs, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListChannelPartnerRepricingConfigsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_channel_partner_repricing_config(self, + request: Union[service.CreateChannelPartnerRepricingConfigRequest, dict] = None, + *, + parent: str = None, + channel_partner_repricing_config: repricing.ChannelPartnerRepricingConfig = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.ChannelPartnerRepricingConfig: + r"""Creates a ChannelPartnerRepricingConfig. Call this method to set + modifications for a specific ChannelPartner's bill. You can only + create configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. If needed, you can create a config for the + current month, with some restrictions. + + When creating a config for a future month, make sure there are + no existing configs for that + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + The following restrictions are for creating configs in the + current month. + + - This functionality is reserved for recovering from an + erroneous config, and should not be used for regular business + cases. + - The new config will not modify exports used with other + configs. Changes to the config may be immediate, but may take + up to 24 hours. + - There is a limit of ten configs for any ChannelPartner or + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + - The contained + [ChannelPartnerRepricingConfig.repricing_config][google.cloud.channel.v1.ChannelPartnerRepricingConfig.repricing_config] + vaule must be different from the value used in the current + config for a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_create_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() + channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.CreateChannelPartnerRepricingConfigRequest( + parent="parent_value", + channel_partner_repricing_config=channel_partner_repricing_config, + ) + + # Make the request + response = await client.create_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateChannelPartnerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig]. + parent (:class:`str`): + Required. The resource name of the ChannelPartner that + will receive the repricing config. Parent uses the + format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id} + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + channel_partner_repricing_config (:class:`google.cloud.channel_v1.types.ChannelPartnerRepricingConfig`): + Required. The + ChannelPartnerRepricingConfig object to + update. + + This corresponds to the ``channel_partner_repricing_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: + Configuration for how a distributor + will rebill a channel partner (also + known as a distributor-authorized + reseller). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, channel_partner_repricing_config]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.CreateChannelPartnerRepricingConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if channel_partner_repricing_config is not None: + request.channel_partner_repricing_config = channel_partner_repricing_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_channel_partner_repricing_config, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_channel_partner_repricing_config(self, + request: Union[service.UpdateChannelPartnerRepricingConfigRequest, dict] = None, + *, + channel_partner_repricing_config: repricing.ChannelPartnerRepricingConfig = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.ChannelPartnerRepricingConfig: + r"""Updates a ChannelPartnerRepricingConfig. Call this method to set + modifications for a specific ChannelPartner's bill. This method + overwrites the existing CustomerRepricingConfig. + + You can only update configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. To make changes to configs for the current + month, use + [CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig], + taking note of its restrictions. You cannot update the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + When updating a config in the future: + + - This config must already exist. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_update_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() + channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.UpdateChannelPartnerRepricingConfigRequest( + channel_partner_repricing_config=channel_partner_repricing_config, + ) + + # Make the request + response = await client.update_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UpdateChannelPartnerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.UpdateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig]. + channel_partner_repricing_config (:class:`google.cloud.channel_v1.types.ChannelPartnerRepricingConfig`): + Required. The + ChannelPartnerRepricingConfig object to + update. + + This corresponds to the ``channel_partner_repricing_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: + Configuration for how a distributor + will rebill a channel partner (also + known as a distributor-authorized + reseller). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([channel_partner_repricing_config]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.UpdateChannelPartnerRepricingConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if channel_partner_repricing_config is not None: + request.channel_partner_repricing_config = channel_partner_repricing_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_channel_partner_repricing_config, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("channel_partner_repricing_config.name", request.channel_partner_repricing_config.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_channel_partner_repricing_config(self, + request: Union[service.DeleteChannelPartnerRepricingConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the given + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + permanently. You can only delete configs if their + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is set to a date after the current month. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + is active or in the past. + - NOT_FOUND: No + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + found for the name in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_delete_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.DeleteChannelPartnerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + await client.delete_channel_partner_repricing_config(request=request) + + Args: + request (Union[google.cloud.channel_v1.types.DeleteChannelPartnerRepricingConfigRequest, dict]): + The request object. Request message for + DeleteChannelPartnerRepricingConfig. + name (:class:`str`): + Required. The resource name of the + channel partner repricing config rule to + delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + request = service.DeleteChannelPartnerRepricingConfigRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_channel_partner_repricing_config, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def lookup_offer(self, + request: Union[service.LookupOfferRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> offers.Offer: + r"""Returns the requested [Offer][google.cloud.channel.v1.Offer] + resource. + + Possible error codes: + + - PERMISSION_DENIED: The entitlement doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement or offer was not found. + + Return value: The [Offer][google.cloud.channel.v1.Offer] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_lookup_offer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.LookupOfferRequest( + entitlement="entitlement_value", + ) + + # Make the request + response = await client.lookup_offer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.LookupOfferRequest, dict]): + The request object. Request message for LookupOffer. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Offer: + Represents an offer made to resellers for purchase. + An offer is associated with a + [Sku][google.cloud.channel.v1.Sku], has a plan for + payment, a price, and defines the constraints for + buying. + + """ + # Create or coerce a protobuf request object. + request = service.LookupOfferRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.lookup_offer, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("entitlement", request.entitlement), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_products(self, + request: Union[service.ListProductsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListProductsAsyncPager: + r"""Lists the Products the reseller is authorized to sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_products(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListProductsRequest( + account="account_value", + ) + + # Make the request + page_result = client.list_products(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListProductsRequest, dict]): + The request object. Request message for ListProducts. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListProductsAsyncPager: + Response message for ListProducts. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListProductsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_products, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListProductsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_skus(self, + request: Union[service.ListSkusRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListSkusAsyncPager: + r"""Lists the SKUs for a product the reseller is authorized to sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_skus(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListSkusRequest( + parent="parent_value", + account="account_value", + ) + + # Make the request + page_result = client.list_skus(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListSkusRequest, dict]): + The request object. Request message for ListSkus. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSkusAsyncPager: + Response message for ListSkus. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListSkusRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_skus, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListSkusAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_offers(self, + request: Union[service.ListOffersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListOffersAsyncPager: + r"""Lists the Offers the reseller can sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_offers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListOffersRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_offers(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListOffersRequest, dict]): + The request object. Request message for ListOffers. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListOffersAsyncPager: + Response message for ListOffers. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListOffersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_offers, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListOffersAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_purchasable_skus(self, + request: Union[service.ListPurchasableSkusRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPurchasableSkusAsyncPager: + r"""Lists the following: + + - SKUs that you can purchase for a customer + - SKUs that you can upgrade or downgrade for an entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_purchasable_skus(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() + create_entitlement_purchase.product = "product_value" + + request = channel_v1.ListPurchasableSkusRequest( + create_entitlement_purchase=create_entitlement_purchase, + customer="customer_value", + ) + + # Make the request + page_result = client.list_purchasable_skus(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListPurchasableSkusRequest, dict]): + The request object. Request message for + ListPurchasableSkus. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableSkusAsyncPager: + Response message for + ListPurchasableSkus. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListPurchasableSkusRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_purchasable_skus, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer", request.customer), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListPurchasableSkusAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_purchasable_offers(self, + request: Union[service.ListPurchasableOffersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPurchasableOffersAsyncPager: + r"""Lists the following: + + - Offers that you can purchase for a customer. + - Offers that you can change for an entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_purchasable_offers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() + create_entitlement_purchase.sku = "sku_value" + + request = channel_v1.ListPurchasableOffersRequest( + create_entitlement_purchase=create_entitlement_purchase, + customer="customer_value", + ) + + # Make the request + page_result = client.list_purchasable_offers(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListPurchasableOffersRequest, dict]): + The request object. Request message for + ListPurchasableOffers. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableOffersAsyncPager: + Response message for + ListPurchasableOffers. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListPurchasableOffersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_purchasable_offers, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer", request.customer), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListPurchasableOffersAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def register_subscriber(self, + request: Union[service.RegisterSubscriberRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.RegisterSubscriberResponse: + r"""Registers a service account with subscriber privileges on the + Cloud Pub/Sub topic for this Channel Services account. After you + create a subscriber, you get the events through + [SubscriberEvent][google.cloud.channel.v1.SubscriberEvent] + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The topic name with the registered service email + address. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_register_subscriber(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.RegisterSubscriberRequest( + account="account_value", + service_account="service_account_value", + ) + + # Make the request + response = await client.register_subscriber(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.RegisterSubscriberRequest, dict]): + The request object. Request Message for + RegisterSubscriber. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.RegisterSubscriberResponse: + Response Message for + RegisterSubscriber. + + """ + # Create or coerce a protobuf request object. + request = service.RegisterSubscriberRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.register_subscriber, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("account", request.account), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def unregister_subscriber(self, + request: Union[service.UnregisterSubscriberRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.UnregisterSubscriberResponse: + r"""Unregisters a service account with subscriber privileges on the + Cloud Pub/Sub topic created for this Channel Services account. + If there are no service accounts left with subscriber + privileges, this deletes the topic. You can call ListSubscribers + to check for these accounts. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The topic resource doesn't exist. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The topic name that unregistered the service email + address. Returns a success response if the service email address + wasn't registered with the topic. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_unregister_subscriber(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.UnregisterSubscriberRequest( + account="account_value", + service_account="service_account_value", + ) + + # Make the request + response = await client.unregister_subscriber(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UnregisterSubscriberRequest, dict]): + The request object. Request Message for + UnregisterSubscriber. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.UnregisterSubscriberResponse: + Response Message for + UnregisterSubscriber. + + """ + # Create or coerce a protobuf request object. + request = service.UnregisterSubscriberRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.unregister_subscriber, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("account", request.account), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_subscribers(self, + request: Union[service.ListSubscribersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListSubscribersAsyncPager: + r"""Lists service accounts with subscriber privileges on the Cloud + Pub/Sub topic created for this Channel Services account. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The topic resource doesn't exist. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: A list of service email addresses. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + async def sample_list_subscribers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListSubscribersRequest( + account="account_value", + ) + + # Make the request + page_result = client.list_subscribers(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListSubscribersRequest, dict]): + The request object. Request Message for ListSubscribers. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSubscribersAsyncPager: + Response Message for ListSubscribers. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + request = service.ListSubscribersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_subscribers, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("account", request.account), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListSubscribersAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_operations( + self, + request: operations_pb2.ListOperationsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Lists operations that match the specified filter in the request. + + Args: + request (:class:`~.operations_pb2.ListOperationsRequest`): + The request object. Request message for + `ListOperations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.ListOperationsResponse: + Response message for ``ListOperations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.ListOperationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.list_operations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_operation( + self, + request: operations_pb2.GetOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Gets the latest state of a long-running operation. + + Args: + request (:class:`~.operations_pb2.GetOperationRequest`): + The request object. Request message for + `GetOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.Operation: + An ``Operation`` object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.GetOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.get_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_operation( + self, + request: operations_pb2.DeleteOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a long-running operation. + + This method indicates that the client is no longer interested + in the operation result. It does not cancel the operation. + If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.DeleteOperationRequest`): + The request object. Request message for + `DeleteOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.DeleteOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.delete_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + async def cancel_operation( + self, + request: operations_pb2.CancelOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Starts asynchronous cancellation on a long-running operation. + + The server makes a best effort to cancel the operation, but success + is not guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.CancelOperationRequest`): + The request object. Request message for + `CancelOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.CancelOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._client._transport.cancel_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-channel", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ( + "CloudChannelServiceAsyncClient", +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/client.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/client.py new file mode 100644 index 0000000..5e42438 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/client.py @@ -0,0 +1,5973 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +import pkg_resources + +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.channel_v1.services.cloud_channel_service import pagers +from google.cloud.channel_v1.types import channel_partner_links +from google.cloud.channel_v1.types import common +from google.cloud.channel_v1.types import customers +from google.cloud.channel_v1.types import entitlements +from google.cloud.channel_v1.types import offers +from google.cloud.channel_v1.types import operations +from google.cloud.channel_v1.types import products +from google.cloud.channel_v1.types import repricing +from google.cloud.channel_v1.types import service +from google.longrunning import operations_pb2 +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import postal_address_pb2 # type: ignore +from .transports.base import CloudChannelServiceTransport, DEFAULT_CLIENT_INFO +from .transports.grpc import CloudChannelServiceGrpcTransport +from .transports.grpc_asyncio import CloudChannelServiceGrpcAsyncIOTransport + + +class CloudChannelServiceClientMeta(type): + """Metaclass for the CloudChannelService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + _transport_registry = OrderedDict() # type: Dict[str, Type[CloudChannelServiceTransport]] + _transport_registry["grpc"] = CloudChannelServiceGrpcTransport + _transport_registry["grpc_asyncio"] = CloudChannelServiceGrpcAsyncIOTransport + + def get_transport_class(cls, + label: str = None, + ) -> Type[CloudChannelServiceTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class CloudChannelServiceClient(metaclass=CloudChannelServiceClientMeta): + """CloudChannelService lets Google cloud resellers and distributors + manage their customers, channel partners, entitlements, and reports. + + Using this service: + + 1. Resellers and distributors can manage a customer entity. + 2. Distributors can register an authorized reseller in their channel + and provide them with delegated admin access. + 3. Resellers and distributors can manage customer entitlements. + + CloudChannelService exposes the following resources: + + - [Customer][google.cloud.channel.v1.Customer]s: An entity—usually + an enterprise—managed by a reseller or distributor. + + - [Entitlement][google.cloud.channel.v1.Entitlement]s: An entity + that provides a customer with the means to use a service. + Entitlements are created or updated as a result of a successful + fulfillment. + + - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s: + An entity that identifies links between distributors and their + indirect resellers in a channel. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Converts api endpoint to mTLS endpoint. + + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "cloudchannel.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudChannelServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CloudChannelServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file( + filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> CloudChannelServiceTransport: + """Returns the transport used by the client instance. + + Returns: + CloudChannelServiceTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def channel_partner_link_path(account: str,channel_partner_link: str,) -> str: + """Returns a fully-qualified channel_partner_link string.""" + return "accounts/{account}/channelPartnerLinks/{channel_partner_link}".format(account=account, channel_partner_link=channel_partner_link, ) + + @staticmethod + def parse_channel_partner_link_path(path: str) -> Dict[str,str]: + """Parses a channel_partner_link path into its component segments.""" + m = re.match(r"^accounts/(?P.+?)/channelPartnerLinks/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def channel_partner_repricing_config_path(account: str,channel_partner: str,channel_partner_repricing_config: str,) -> str: + """Returns a fully-qualified channel_partner_repricing_config string.""" + return "accounts/{account}/channelPartnerLinks/{channel_partner}/channelPartnerRepricingConfigs/{channel_partner_repricing_config}".format(account=account, channel_partner=channel_partner, channel_partner_repricing_config=channel_partner_repricing_config, ) + + @staticmethod + def parse_channel_partner_repricing_config_path(path: str) -> Dict[str,str]: + """Parses a channel_partner_repricing_config path into its component segments.""" + m = re.match(r"^accounts/(?P.+?)/channelPartnerLinks/(?P.+?)/channelPartnerRepricingConfigs/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def customer_path(account: str,customer: str,) -> str: + """Returns a fully-qualified customer string.""" + return "accounts/{account}/customers/{customer}".format(account=account, customer=customer, ) + + @staticmethod + def parse_customer_path(path: str) -> Dict[str,str]: + """Parses a customer path into its component segments.""" + m = re.match(r"^accounts/(?P.+?)/customers/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def customer_repricing_config_path(account: str,customer: str,customer_repricing_config: str,) -> str: + """Returns a fully-qualified customer_repricing_config string.""" + return "accounts/{account}/customers/{customer}/customerRepricingConfigs/{customer_repricing_config}".format(account=account, customer=customer, customer_repricing_config=customer_repricing_config, ) + + @staticmethod + def parse_customer_repricing_config_path(path: str) -> Dict[str,str]: + """Parses a customer_repricing_config path into its component segments.""" + m = re.match(r"^accounts/(?P.+?)/customers/(?P.+?)/customerRepricingConfigs/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def entitlement_path(account: str,customer: str,entitlement: str,) -> str: + """Returns a fully-qualified entitlement string.""" + return "accounts/{account}/customers/{customer}/entitlements/{entitlement}".format(account=account, customer=customer, entitlement=entitlement, ) + + @staticmethod + def parse_entitlement_path(path: str) -> Dict[str,str]: + """Parses a entitlement path into its component segments.""" + m = re.match(r"^accounts/(?P.+?)/customers/(?P.+?)/entitlements/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def offer_path(account: str,offer: str,) -> str: + """Returns a fully-qualified offer string.""" + return "accounts/{account}/offers/{offer}".format(account=account, offer=offer, ) + + @staticmethod + def parse_offer_path(path: str) -> Dict[str,str]: + """Parses a offer path into its component segments.""" + m = re.match(r"^accounts/(?P.+?)/offers/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def product_path(product: str,) -> str: + """Returns a fully-qualified product string.""" + return "products/{product}".format(product=product, ) + + @staticmethod + def parse_product_path(path: str) -> Dict[str,str]: + """Parses a product path into its component segments.""" + m = re.match(r"^products/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def sku_path(product: str,sku: str,) -> str: + """Returns a fully-qualified sku string.""" + return "products/{product}/skus/{sku}".format(product=product, sku=sku, ) + + @staticmethod + def parse_sku_path(path: str) -> Dict[str,str]: + """Parses a sku path into its component segments.""" + m = re.match(r"^products/(?P.+?)/skus/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str, ) -> str: + """Returns a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str,str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str, ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder, ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str,str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str, ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization, ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str,str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str, ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format(project=project, ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str,str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str, ) -> str: + """Returns a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format(project=project, location=location, ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str,str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, CloudChannelServiceTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the cloud channel service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, CloudChannelServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError("client_options.api_key and credentials are mutually exclusive") + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, CloudChannelServiceTransport): + # transport is a CloudChannelServiceTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError("When providing a transport instance, " + "provide its credentials directly.") + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): + credentials = google.auth._default.get_api_key_credentials(api_key_value) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=client_options.api_audience, + ) + + def list_customers(self, + request: Union[service.ListCustomersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCustomersPager: + r"""List [Customer][google.cloud.channel.v1.Customer]s. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: List of + [Customer][google.cloud.channel.v1.Customer]s, or an empty list + if there are no customers. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_customers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListCustomersRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_customers(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListCustomersRequest, dict]): + The request object. Request message for + [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomersPager: + Response message for + [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCustomersRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListCustomersRequest): + request = service.ListCustomersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_customers] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCustomersPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_customer(self, + request: Union[service.GetCustomerRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> customers.Customer: + r"""Returns the requested + [Customer][google.cloud.channel.v1.Customer] resource. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer resource doesn't exist. Usually the + result of an invalid name parameter. + + Return value: The [Customer][google.cloud.channel.v1.Customer] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_get_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetCustomerRequest( + name="name_value", + ) + + # Make the request + response = client.get_customer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.GetCustomer][google.cloud.channel.v1.CloudChannelService.GetCustomer]. + name (str): + Required. The resource name of the customer to retrieve. + Name uses the format: + accounts/{account_id}/customers/{customer_id} + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Customer: + Entity representing a customer of a + reseller or distributor. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCustomerRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.GetCustomerRequest): + request = service.GetCustomerRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_customer] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def check_cloud_identity_accounts_exist(self, + request: Union[service.CheckCloudIdentityAccountsExistRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.CheckCloudIdentityAccountsExistResponse: + r"""Confirms the existence of Cloud Identity accounts based on the + domain and if the Cloud Identity accounts are owned by the + reseller. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - INVALID_VALUE: Invalid domain value in the request. + + Return value: A list of + [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] + resources for the domain (may be empty) + + Note: in the v1alpha1 version of the API, a NOT_FOUND error + returns if no + [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] + resources match the domain. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_check_cloud_identity_accounts_exist(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.CheckCloudIdentityAccountsExistRequest( + parent="parent_value", + domain="domain_value", + ) + + # Make the request + response = client.check_cloud_identity_accounts_exist(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistRequest, dict]): + The request object. Request message for + [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistResponse: + Response message for + [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.CheckCloudIdentityAccountsExistRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.CheckCloudIdentityAccountsExistRequest): + request = service.CheckCloudIdentityAccountsExistRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.check_cloud_identity_accounts_exist] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_customer(self, + request: Union[service.CreateCustomerRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> customers.Customer: + r"""Creates a new [Customer][google.cloud.channel.v1.Customer] + resource under the reseller or distributor account. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - Domain field value doesn't match the primary email domain. + + Return value: The newly created + [Customer][google.cloud.channel.v1.Customer] resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_create_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + customer = channel_v1.Customer() + customer.org_display_name = "org_display_name_value" + customer.domain = "domain_value" + + request = channel_v1.CreateCustomerRequest( + parent="parent_value", + customer=customer, + ) + + # Make the request + response = client.create_customer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateCustomer][google.cloud.channel.v1.CloudChannelService.CreateCustomer] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Customer: + Entity representing a customer of a + reseller or distributor. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateCustomerRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.CreateCustomerRequest): + request = service.CreateCustomerRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_customer] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_customer(self, + request: Union[service.UpdateCustomerRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> customers.Customer: + r"""Updates an existing [Customer][google.cloud.channel.v1.Customer] + resource for the reseller or distributor. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] + resource found for the name in the request. + + Return value: The updated + [Customer][google.cloud.channel.v1.Customer] resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_update_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + customer = channel_v1.Customer() + customer.org_display_name = "org_display_name_value" + customer.domain = "domain_value" + + request = channel_v1.UpdateCustomerRequest( + customer=customer, + ) + + # Make the request + response = client.update_customer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UpdateCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.UpdateCustomer][google.cloud.channel.v1.CloudChannelService.UpdateCustomer]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Customer: + Entity representing a customer of a + reseller or distributor. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCustomerRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.UpdateCustomerRequest): + request = service.UpdateCustomerRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_customer] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer.name", request.customer.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_customer(self, + request: Union[service.DeleteCustomerRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the given [Customer][google.cloud.channel.v1.Customer] + permanently. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The customer has existing entitlements. + - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] + resource found for the name in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_delete_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.DeleteCustomerRequest( + name="name_value", + ) + + # Make the request + client.delete_customer(request=request) + + Args: + request (Union[google.cloud.channel_v1.types.DeleteCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.DeleteCustomer][google.cloud.channel.v1.CloudChannelService.DeleteCustomer]. + name (str): + Required. The resource name of the + customer to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.DeleteCustomerRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.DeleteCustomerRequest): + request = service.DeleteCustomerRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_customer] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def import_customer(self, + request: Union[service.ImportCustomerRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> customers.Customer: + r"""Imports a [Customer][google.cloud.channel.v1.Customer] from the + Cloud Identity associated with the provided Cloud Identity ID or + domain before a TransferEntitlements call. If a linked Customer + already exists and overwrite_if_exists is true, it will update + that Customer's data. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - NOT_FOUND: Cloud Identity doesn't exist or was deleted. + - INVALID_ARGUMENT: Required parameters are missing, or the + auth_token is expired or invalid. + - ALREADY_EXISTS: A customer already exists and has conflicting + critical fields. Requires an overwrite. + + Return value: The [Customer][google.cloud.channel.v1.Customer]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_import_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ImportCustomerRequest( + domain="domain_value", + parent="parent_value", + overwrite_if_exists=True, + ) + + # Make the request + response = client.import_customer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ImportCustomerRequest, dict]): + The request object. Request message for + [CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Customer: + Entity representing a customer of a + reseller or distributor. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ImportCustomerRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ImportCustomerRequest): + request = service.ImportCustomerRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.import_customer] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def provision_cloud_identity(self, + request: Union[service.ProvisionCloudIdentityRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates a Cloud Identity for the given customer using the + customer's information, or the information provided here. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer was not found. + - ALREADY_EXISTS: The customer's primary email already exists. + Retry after changing the customer's primary contact email. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + contains an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_provision_cloud_identity(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ProvisionCloudIdentityRequest( + customer="customer_value", + ) + + # Make the request + operation = client.provision_cloud_identity(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ProvisionCloudIdentityRequest, dict]): + The request object. Request message for + [CloudChannelService.ProvisionCloudIdentity][google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Customer` Entity + representing a customer of a reseller or distributor. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ProvisionCloudIdentityRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ProvisionCloudIdentityRequest): + request = service.ProvisionCloudIdentityRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.provision_cloud_identity] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer", request.customer), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + customers.Customer, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def list_entitlements(self, + request: Union[service.ListEntitlementsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEntitlementsPager: + r"""Lists [Entitlement][google.cloud.channel.v1.Entitlement]s + belonging to a customer. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: A list of the customer's + [Entitlement][google.cloud.channel.v1.Entitlement]s. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_entitlements(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListEntitlementsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_entitlements(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListEntitlementsRequest, dict]): + The request object. Request message for + [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListEntitlementsPager: + Response message for + [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListEntitlementsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListEntitlementsRequest): + request = service.ListEntitlementsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_entitlements] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListEntitlementsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_transferable_skus(self, + request: Union[service.ListTransferableSkusRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTransferableSkusPager: + r"""List [TransferableSku][google.cloud.channel.v1.TransferableSku]s + of a customer based on the Cloud Identity ID or Customer Name in + the request. + + Use this method to list the entitlements information of an + unowned customer. You should provide the customer's Cloud + Identity ID or Customer Name. + + Possible error codes: + + - PERMISSION_DENIED: + + - The customer doesn't belong to the reseller and has no + auth token. + - The supplied auth token is invalid. + - The reseller account making the request is different from + the reseller account in the query. + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: A list of the customer's + [TransferableSku][google.cloud.channel.v1.TransferableSku]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_transferable_skus(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListTransferableSkusRequest( + cloud_identity_id="cloud_identity_id_value", + parent="parent_value", + ) + + # Make the request + page_result = client.list_transferable_skus(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListTransferableSkusRequest, dict]): + The request object. Request message for + [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableSkusPager: + Response message for + [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListTransferableSkusRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListTransferableSkusRequest): + request = service.ListTransferableSkusRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_transferable_skus] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListTransferableSkusPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_transferable_offers(self, + request: Union[service.ListTransferableOffersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTransferableOffersPager: + r"""List + [TransferableOffer][google.cloud.channel.v1.TransferableOffer]s + of a customer based on Cloud Identity ID or Customer Name in the + request. + + Use this method when a reseller gets the entitlement information + of an unowned customer. The reseller should provide the + customer's Cloud Identity ID or Customer Name. + + Possible error codes: + + - PERMISSION_DENIED: + + - The customer doesn't belong to the reseller and has no + auth token. + - The customer provided incorrect reseller information when + generating auth token. + - The reseller account making the request is different from + the reseller account in the query. + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: List of + [TransferableOffer][google.cloud.channel.v1.TransferableOffer] + for the given customer and SKU. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_transferable_offers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListTransferableOffersRequest( + cloud_identity_id="cloud_identity_id_value", + parent="parent_value", + sku="sku_value", + ) + + # Make the request + page_result = client.list_transferable_offers(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListTransferableOffersRequest, dict]): + The request object. Request message for + [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableOffersPager: + Response message for + [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListTransferableOffersRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListTransferableOffersRequest): + request = service.ListTransferableOffersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_transferable_offers] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListTransferableOffersPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_entitlement(self, + request: Union[service.GetEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> entitlements.Entitlement: + r"""Returns the requested + [Entitlement][google.cloud.channel.v1.Entitlement] resource. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer entitlement was not found. + + Return value: The requested + [Entitlement][google.cloud.channel.v1.Entitlement] resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_get_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetEntitlementRequest( + name="name_value", + ) + + # Make the request + response = client.get_entitlement(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.GetEntitlement][google.cloud.channel.v1.CloudChannelService.GetEntitlement]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Entitlement: + An entitlement is a representation of + a customer's ability to use a service. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.GetEntitlementRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.GetEntitlementRequest): + request = service.GetEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_entitlement] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_entitlement(self, + request: Union[service.CreateEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates an entitlement for a customer. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - There is already a customer entitlement for a SKU from the + same product family. + + - INVALID_VALUE: Make sure the OfferId is valid. If it is, + contact Google Channel support for further troubleshooting. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: + + - The SKU was already purchased for the customer. + - The customer's primary email already exists. Retry after + changing the customer's primary contact email. + + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The domain required for purchasing a SKU has not been + verified. + - A pre-requisite SKU required to purchase an Add-On SKU is + missing. For example, Google Workspace Business Starter is + required to purchase Vault or Drive. + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_create_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + entitlement = channel_v1.Entitlement() + entitlement.offer = "offer_value" + + request = channel_v1.CreateEntitlementRequest( + parent="parent_value", + entitlement=entitlement, + ) + + # Make the request + operation = client.create_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateEntitlement][google.cloud.channel.v1.CloudChannelService.CreateEntitlement] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateEntitlementRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.CreateEntitlementRequest): + request = service.CreateEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_entitlement] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def change_parameters(self, + request: Union[service.ChangeParametersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Change parameters of the entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. For example, the number of seats being changed is + greater than the allowed number of max seats, or decreasing + seats for a commitment based plan. + - NOT_FOUND: Entitlement resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_change_parameters(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ChangeParametersRequest( + name="name_value", + ) + + # Make the request + operation = client.change_parameters(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ChangeParametersRequest, dict]): + The request object. Request message for + [CloudChannelService.ChangeParametersRequest][]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ChangeParametersRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ChangeParametersRequest): + request = service.ChangeParametersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.change_parameters] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def change_renewal_settings(self, + request: Union[service.ChangeRenewalSettingsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates the renewal settings for an existing customer + entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for + a commitment plan. Can't enable or disable renewals for + non-commitment plans. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_change_renewal_settings(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ChangeRenewalSettingsRequest( + name="name_value", + ) + + # Make the request + operation = client.change_renewal_settings(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ChangeRenewalSettingsRequest, dict]): + The request object. Request message for + [CloudChannelService.ChangeRenewalSettings][google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ChangeRenewalSettingsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ChangeRenewalSettingsRequest): + request = service.ChangeRenewalSettingsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.change_renewal_settings] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def change_offer(self, + request: Union[service.ChangeOfferRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Updates the Offer for an existing customer entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Offer or Entitlement resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_change_offer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ChangeOfferRequest( + name="name_value", + offer="offer_value", + ) + + # Make the request + operation = client.change_offer(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ChangeOfferRequest, dict]): + The request object. Request message for + [CloudChannelService.ChangeOffer][google.cloud.channel.v1.CloudChannelService.ChangeOffer]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ChangeOfferRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ChangeOfferRequest): + request = service.ChangeOfferRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.change_offer] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def start_paid_service(self, + request: Union[service.StartPaidServiceRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Starts paid service for a trial entitlement. + + Starts paid service for a trial entitlement immediately. This + method is only applicable if a plan is set up for a trial + entitlement but has some trial days remaining. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for + entitlement on trial plans. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_start_paid_service(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.StartPaidServiceRequest( + name="name_value", + ) + + # Make the request + operation = client.start_paid_service(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.StartPaidServiceRequest, dict]): + The request object. Request message for + [CloudChannelService.StartPaidService][google.cloud.channel.v1.CloudChannelService.StartPaidService]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.StartPaidServiceRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.StartPaidServiceRequest): + request = service.StartPaidServiceRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.start_paid_service] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def suspend_entitlement(self, + request: Union[service.SuspendEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Suspends a previously fulfilled entitlement. + + An entitlement suspension is a long-running operation. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - NOT_ACTIVE: Entitlement is not active. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_suspend_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.SuspendEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.suspend_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.SuspendEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.SuspendEntitlement][google.cloud.channel.v1.CloudChannelService.SuspendEntitlement]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.SuspendEntitlementRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.SuspendEntitlementRequest): + request = service.SuspendEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.suspend_entitlement] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def cancel_entitlement(self, + request: Union[service.CancelEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Cancels a previously fulfilled entitlement. + + An entitlement cancellation is a long-running operation. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - FAILED_PRECONDITION: There are Google Cloud projects linked + to the Google Cloud entitlement's Cloud Billing subaccount. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google + Workspace add-ons, or entitlements for Google Cloud's + development platform. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The response will + contain google.protobuf.Empty on success. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_cancel_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.CancelEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.cancel_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CancelEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.CancelEntitlement][google.cloud.channel.v1.CloudChannelService.CancelEntitlement]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.CancelEntitlementRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.CancelEntitlementRequest): + request = service.CancelEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.cancel_entitlement] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def activate_entitlement(self, + request: Union[service.ActivateEntitlementRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Activates a previously suspended entitlement. Entitlements + suspended for pending ToS acceptance can't be activated using + this method. + + An entitlement activation is a long-running operation and it + updates the state of the customer entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - SUSPENSION_NOT_RESELLER_INITIATED: Can only activate + reseller-initiated suspensions and entitlements that have + accepted the TOS. + - NOT_SUSPENDED: Can only activate suspended entitlements not + in an ACTIVE state. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_activate_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ActivateEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.activate_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ActivateEntitlementRequest, dict]): + The request object. Request message for + [CloudChannelService.ActivateEntitlement][google.cloud.channel.v1.CloudChannelService.ActivateEntitlement]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.channel_v1.types.Entitlement` An + entitlement is a representation of a customer's ability + to use a service. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ActivateEntitlementRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ActivateEntitlementRequest): + request = service.ActivateEntitlementRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.activate_entitlement] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + entitlements.Entitlement, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def transfer_entitlements(self, + request: Union[service.TransferEntitlementsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Transfers customer entitlements to new reseller. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: The SKU was already transferred for the + customer. + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The SKU requires domain verification to transfer, but the + domain is not verified. + - An Add-On SKU (example, Vault or Drive) is missing the + pre-requisite SKU (example, G Suite Basic). + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - Specify all transferring entitlements. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_transfer_entitlements(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + entitlements = channel_v1.Entitlement() + entitlements.offer = "offer_value" + + request = channel_v1.TransferEntitlementsRequest( + parent="parent_value", + entitlements=entitlements, + ) + + # Make the request + operation = client.transfer_entitlements(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.TransferEntitlementsRequest, dict]): + The request object. Request message for + [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.channel_v1.types.TransferEntitlementsResponse` Response message for [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. + This is put in the response field of + google.longrunning.Operation. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.TransferEntitlementsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.TransferEntitlementsRequest): + request = service.TransferEntitlementsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.transfer_entitlements] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + service.TransferEntitlementsResponse, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def transfer_entitlements_to_google(self, + request: Union[service.TransferEntitlementsToGoogleRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Transfers customer entitlements from their current reseller to + Google. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: The SKU was already transferred for the + customer. + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The SKU requires domain verification to transfer, but the + domain is not verified. + - An Add-On SKU (example, Vault or Drive) is missing the + pre-requisite SKU (example, G Suite Basic). + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The response will + contain google.protobuf.Empty on success. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_transfer_entitlements_to_google(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + entitlements = channel_v1.Entitlement() + entitlements.offer = "offer_value" + + request = channel_v1.TransferEntitlementsToGoogleRequest( + parent="parent_value", + entitlements=entitlements, + ) + + # Make the request + operation = client.transfer_entitlements_to_google(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.TransferEntitlementsToGoogleRequest, dict]): + The request object. Request message for + [CloudChannelService.TransferEntitlementsToGoogle][google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.TransferEntitlementsToGoogleRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.TransferEntitlementsToGoogleRequest): + request = service.TransferEntitlementsToGoogleRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.transfer_entitlements_to_google] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=operations.OperationMetadata, + ) + + # Done; return the response. + return response + + def list_channel_partner_links(self, + request: Union[service.ListChannelPartnerLinksRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListChannelPartnerLinksPager: + r"""List + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s + belonging to a distributor. You must be a distributor to call + this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: The list of the distributor account's + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resources. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_channel_partner_links(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListChannelPartnerLinksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_channel_partner_links(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListChannelPartnerLinksRequest, dict]): + The request object. Request message for + [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerLinksPager: + Response message for + [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListChannelPartnerLinksRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListChannelPartnerLinksRequest): + request = service.ListChannelPartnerLinksRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_channel_partner_links] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListChannelPartnerLinksPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_channel_partner_link(self, + request: Union[service.GetChannelPartnerLinkRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> channel_partner_links.ChannelPartnerLink: + r"""Returns the requested + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. You must be a distributor to call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: ChannelPartnerLink resource not found because of + an invalid channel partner link name. + + Return value: The + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_get_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetChannelPartnerLinkRequest( + name="name_value", + ) + + # Make the request + response = client.get_channel_partner_link(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetChannelPartnerLinkRequest, dict]): + The request object. Request message for + [CloudChannelService.GetChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerLink: + Entity representing a link between + distributors and their indirect + resellers in an n-tier resale channel. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.GetChannelPartnerLinkRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.GetChannelPartnerLinkRequest): + request = service.GetChannelPartnerLinkRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_channel_partner_link] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_channel_partner_link(self, + request: Union[service.CreateChannelPartnerLinkRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> channel_partner_links.ChannelPartnerLink: + r"""Initiates a channel partner link between a distributor and a + reseller, or between resellers in an n-tier reseller channel. + Invited partners need to follow the invite_link_uri provided in + the response to accept. After accepting the invitation, a link + is set up between the two parties. You must be a distributor to + call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - ALREADY_EXISTS: The ChannelPartnerLink sent in the request + already exists. + - NOT_FOUND: No Cloud Identity customer exists for provided + domain. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The new + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_create_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + channel_partner_link = channel_v1.ChannelPartnerLink() + channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" + channel_partner_link.link_state = "SUSPENDED" + + request = channel_v1.CreateChannelPartnerLinkRequest( + parent="parent_value", + channel_partner_link=channel_partner_link, + ) + + # Make the request + response = client.create_channel_partner_link(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateChannelPartnerLinkRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerLink: + Entity representing a link between + distributors and their indirect + resellers in an n-tier resale channel. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateChannelPartnerLinkRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.CreateChannelPartnerLinkRequest): + request = service.CreateChannelPartnerLinkRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_channel_partner_link] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_channel_partner_link(self, + request: Union[service.UpdateChannelPartnerLinkRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> channel_partner_links.ChannelPartnerLink: + r"""Updates a channel partner link. Distributors call this method to + change a link's status. For example, to suspend a partner link. + You must be a distributor to call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - Link state cannot change from invited to active or + suspended. + - Cannot send reseller_cloud_identity_id, invite_url, or + name in update mask. + + - NOT_FOUND: ChannelPartnerLink resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The updated + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_update_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + channel_partner_link = channel_v1.ChannelPartnerLink() + channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" + channel_partner_link.link_state = "SUSPENDED" + + request = channel_v1.UpdateChannelPartnerLinkRequest( + name="name_value", + channel_partner_link=channel_partner_link, + ) + + # Make the request + response = client.update_channel_partner_link(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UpdateChannelPartnerLinkRequest, dict]): + The request object. Request message for + [CloudChannelService.UpdateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink] + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerLink: + Entity representing a link between + distributors and their indirect + resellers in an n-tier resale channel. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateChannelPartnerLinkRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.UpdateChannelPartnerLinkRequest): + request = service.UpdateChannelPartnerLinkRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_channel_partner_link] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_customer_repricing_config(self, + request: Union[service.GetCustomerRepricingConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.CustomerRepricingConfig: + r"""Gets information about how a Reseller modifies their bill before + sending it to a Customer. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + was not found. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_get_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetCustomerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + response = client.get_customer_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetCustomerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.GetCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig]. + name (str): + Required. The resource name of the + CustomerRepricingConfig. Format: + accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.CustomerRepricingConfig: + Configuration for how a reseller will + reprice a Customer. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCustomerRepricingConfigRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.GetCustomerRepricingConfigRequest): + request = service.GetCustomerRepricingConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_customer_repricing_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_customer_repricing_configs(self, + request: Union[service.ListCustomerRepricingConfigsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCustomerRepricingConfigsPager: + r"""Lists information about how a Reseller modifies their bill + before sending it to a Customer. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resources. The data for each resource is displayed in the + ascending order of: + + - customer ID + - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] + - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + - [CustomerRepricingConfig.update_time][google.cloud.channel.v1.CustomerRepricingConfig.update_time] + + If unsuccessful, returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_customer_repricing_configs(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListCustomerRepricingConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_customer_repricing_configs(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest, dict]): + The request object. Request message for + [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. + parent (str): + Required. The resource name of the customer. Parent uses + the format: + accounts/{account_id}/customers/{customer_id}. Supports + accounts/{account_id}/customers/- to retrieve configs + for all customers. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomerRepricingConfigsPager: + Response message for + [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCustomerRepricingConfigsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListCustomerRepricingConfigsRequest): + request = service.ListCustomerRepricingConfigsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_customer_repricing_configs] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCustomerRepricingConfigsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_customer_repricing_config(self, + request: Union[service.CreateCustomerRepricingConfigRequest, dict] = None, + *, + parent: str = None, + customer_repricing_config: repricing.CustomerRepricingConfig = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.CustomerRepricingConfig: + r"""Creates a CustomerRepricingConfig. Call this method to set + modifications for a specific customer's bill. You can only + create configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. If needed, you can create a config for the + current month, with some restrictions. + + When creating a config for a future month, make sure there are + no existing configs for that + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + The following restrictions are for creating configs in the + current month. + + - This functionality is reserved for recovering from an + erroneous config, and should not be used for regular business + cases. + - The new config will not modify exports used with other + configs. Changes to the config may be immediate, but may take + up to 24 hours. + - There is a limit of ten configs for any + [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] + or + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + - The contained + [CustomerRepricingConfig.repricing_config][google.cloud.channel.v1.CustomerRepricingConfig.repricing_config] + vaule must be different from the value used in the current + config for a + [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement]. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_create_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + customer_repricing_config = channel_v1.CustomerRepricingConfig() + customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.CreateCustomerRepricingConfigRequest( + parent="parent_value", + customer_repricing_config=customer_repricing_config, + ) + + # Make the request + response = client.create_customer_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateCustomerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig]. + parent (str): + Required. The resource name of the customer that will + receive this repricing config. Parent uses the format: + accounts/{account_id}/customers/{customer_id} + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + customer_repricing_config (google.cloud.channel_v1.types.CustomerRepricingConfig): + Required. The CustomerRepricingConfig + object to update. + + This corresponds to the ``customer_repricing_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.CustomerRepricingConfig: + Configuration for how a reseller will + reprice a Customer. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, customer_repricing_config]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateCustomerRepricingConfigRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.CreateCustomerRepricingConfigRequest): + request = service.CreateCustomerRepricingConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if customer_repricing_config is not None: + request.customer_repricing_config = customer_repricing_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_customer_repricing_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_customer_repricing_config(self, + request: Union[service.UpdateCustomerRepricingConfigRequest, dict] = None, + *, + customer_repricing_config: repricing.CustomerRepricingConfig = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.CustomerRepricingConfig: + r"""Updates a CustomerRepricingConfig. Call this method to set + modifications for a specific customer's bill. This method + overwrites the existing CustomerRepricingConfig. + + You can only update configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. To make changes to configs for the current + month, use + [CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig], + taking note of its restrictions. You cannot update the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + When updating a config in the future: + + - This config must already exist. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_update_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + customer_repricing_config = channel_v1.CustomerRepricingConfig() + customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.UpdateCustomerRepricingConfigRequest( + customer_repricing_config=customer_repricing_config, + ) + + # Make the request + response = client.update_customer_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UpdateCustomerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.UpdateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig]. + customer_repricing_config (google.cloud.channel_v1.types.CustomerRepricingConfig): + Required. The CustomerRepricingConfig + object to update. + + This corresponds to the ``customer_repricing_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.CustomerRepricingConfig: + Configuration for how a reseller will + reprice a Customer. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([customer_repricing_config]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCustomerRepricingConfigRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.UpdateCustomerRepricingConfigRequest): + request = service.UpdateCustomerRepricingConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if customer_repricing_config is not None: + request.customer_repricing_config = customer_repricing_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_customer_repricing_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer_repricing_config.name", request.customer_repricing_config.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_customer_repricing_config(self, + request: Union[service.DeleteCustomerRepricingConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the given + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + permanently. You can only delete configs if their + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is set to a date after the current month. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + is active or in the past. + - NOT_FOUND: No + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + found for the name in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_delete_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.DeleteCustomerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + client.delete_customer_repricing_config(request=request) + + Args: + request (Union[google.cloud.channel_v1.types.DeleteCustomerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.DeleteCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig]. + name (str): + Required. The resource name of the customer repricing + config rule to delete. Format: + accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.DeleteCustomerRepricingConfigRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.DeleteCustomerRepricingConfigRequest): + request = service.DeleteCustomerRepricingConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_customer_repricing_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def get_channel_partner_repricing_config(self, + request: Union[service.GetChannelPartnerRepricingConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.ChannelPartnerRepricingConfig: + r"""Gets information about how a Distributor modifies their bill + before sending it to a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + was not found. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_get_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetChannelPartnerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + response = client.get_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.GetChannelPartnerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.GetChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig] + name (str): + Required. The resource name of the + ChannelPartnerRepricingConfig Format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: + Configuration for how a distributor + will rebill a channel partner (also + known as a distributor-authorized + reseller). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetChannelPartnerRepricingConfigRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.GetChannelPartnerRepricingConfigRequest): + request = service.GetChannelPartnerRepricingConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_channel_partner_repricing_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_channel_partner_repricing_configs(self, + request: Union[service.ListChannelPartnerRepricingConfigsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListChannelPartnerRepricingConfigsPager: + r"""Lists information about how a Reseller modifies their bill + before sending it to a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resources. The data for each resource is displayed in the + ascending order of: + + - channel partner ID + - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + - [ChannelPartnerRepricingConfig.update_time][google.cloud.channel.v1.ChannelPartnerRepricingConfig.update_time] + + If unsuccessful, returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_channel_partner_repricing_configs(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListChannelPartnerRepricingConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_channel_partner_repricing_configs(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest, dict]): + The request object. Request message for + [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. + parent (str): + Required. The resource name of the account's + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]. + Parent uses the format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id}. + Supports accounts/{account_id}/channelPartnerLinks/- to + retrieve configs for all channel partners. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerRepricingConfigsPager: + Response message for + [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListChannelPartnerRepricingConfigsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListChannelPartnerRepricingConfigsRequest): + request = service.ListChannelPartnerRepricingConfigsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_channel_partner_repricing_configs] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListChannelPartnerRepricingConfigsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_channel_partner_repricing_config(self, + request: Union[service.CreateChannelPartnerRepricingConfigRequest, dict] = None, + *, + parent: str = None, + channel_partner_repricing_config: repricing.ChannelPartnerRepricingConfig = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.ChannelPartnerRepricingConfig: + r"""Creates a ChannelPartnerRepricingConfig. Call this method to set + modifications for a specific ChannelPartner's bill. You can only + create configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. If needed, you can create a config for the + current month, with some restrictions. + + When creating a config for a future month, make sure there are + no existing configs for that + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + The following restrictions are for creating configs in the + current month. + + - This functionality is reserved for recovering from an + erroneous config, and should not be used for regular business + cases. + - The new config will not modify exports used with other + configs. Changes to the config may be immediate, but may take + up to 24 hours. + - There is a limit of ten configs for any ChannelPartner or + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + - The contained + [ChannelPartnerRepricingConfig.repricing_config][google.cloud.channel.v1.ChannelPartnerRepricingConfig.repricing_config] + vaule must be different from the value used in the current + config for a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_create_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() + channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.CreateChannelPartnerRepricingConfigRequest( + parent="parent_value", + channel_partner_repricing_config=channel_partner_repricing_config, + ) + + # Make the request + response = client.create_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.CreateChannelPartnerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig]. + parent (str): + Required. The resource name of the ChannelPartner that + will receive the repricing config. Parent uses the + format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id} + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + channel_partner_repricing_config (google.cloud.channel_v1.types.ChannelPartnerRepricingConfig): + Required. The + ChannelPartnerRepricingConfig object to + update. + + This corresponds to the ``channel_partner_repricing_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: + Configuration for how a distributor + will rebill a channel partner (also + known as a distributor-authorized + reseller). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, channel_partner_repricing_config]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateChannelPartnerRepricingConfigRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.CreateChannelPartnerRepricingConfigRequest): + request = service.CreateChannelPartnerRepricingConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if channel_partner_repricing_config is not None: + request.channel_partner_repricing_config = channel_partner_repricing_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_channel_partner_repricing_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_channel_partner_repricing_config(self, + request: Union[service.UpdateChannelPartnerRepricingConfigRequest, dict] = None, + *, + channel_partner_repricing_config: repricing.ChannelPartnerRepricingConfig = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repricing.ChannelPartnerRepricingConfig: + r"""Updates a ChannelPartnerRepricingConfig. Call this method to set + modifications for a specific ChannelPartner's bill. This method + overwrites the existing CustomerRepricingConfig. + + You can only update configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. To make changes to configs for the current + month, use + [CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig], + taking note of its restrictions. You cannot update the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + When updating a config in the future: + + - This config must already exist. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_update_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() + channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.UpdateChannelPartnerRepricingConfigRequest( + channel_partner_repricing_config=channel_partner_repricing_config, + ) + + # Make the request + response = client.update_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UpdateChannelPartnerRepricingConfigRequest, dict]): + The request object. Request message for + [CloudChannelService.UpdateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig]. + channel_partner_repricing_config (google.cloud.channel_v1.types.ChannelPartnerRepricingConfig): + Required. The + ChannelPartnerRepricingConfig object to + update. + + This corresponds to the ``channel_partner_repricing_config`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: + Configuration for how a distributor + will rebill a channel partner (also + known as a distributor-authorized + reseller). + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([channel_partner_repricing_config]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateChannelPartnerRepricingConfigRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.UpdateChannelPartnerRepricingConfigRequest): + request = service.UpdateChannelPartnerRepricingConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if channel_partner_repricing_config is not None: + request.channel_partner_repricing_config = channel_partner_repricing_config + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_channel_partner_repricing_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("channel_partner_repricing_config.name", request.channel_partner_repricing_config.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_channel_partner_repricing_config(self, + request: Union[service.DeleteChannelPartnerRepricingConfigRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the given + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + permanently. You can only delete configs if their + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is set to a date after the current month. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + is active or in the past. + - NOT_FOUND: No + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + found for the name in the request. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_delete_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.DeleteChannelPartnerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + client.delete_channel_partner_repricing_config(request=request) + + Args: + request (Union[google.cloud.channel_v1.types.DeleteChannelPartnerRepricingConfigRequest, dict]): + The request object. Request message for + DeleteChannelPartnerRepricingConfig. + name (str): + Required. The resource name of the + channel partner repricing config rule to + delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.DeleteChannelPartnerRepricingConfigRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.DeleteChannelPartnerRepricingConfigRequest): + request = service.DeleteChannelPartnerRepricingConfigRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_channel_partner_repricing_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def lookup_offer(self, + request: Union[service.LookupOfferRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> offers.Offer: + r"""Returns the requested [Offer][google.cloud.channel.v1.Offer] + resource. + + Possible error codes: + + - PERMISSION_DENIED: The entitlement doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement or offer was not found. + + Return value: The [Offer][google.cloud.channel.v1.Offer] + resource. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_lookup_offer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.LookupOfferRequest( + entitlement="entitlement_value", + ) + + # Make the request + response = client.lookup_offer(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.LookupOfferRequest, dict]): + The request object. Request message for LookupOffer. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.Offer: + Represents an offer made to resellers for purchase. + An offer is associated with a + [Sku][google.cloud.channel.v1.Sku], has a plan for + payment, a price, and defines the constraints for + buying. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.LookupOfferRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.LookupOfferRequest): + request = service.LookupOfferRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.lookup_offer] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("entitlement", request.entitlement), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_products(self, + request: Union[service.ListProductsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListProductsPager: + r"""Lists the Products the reseller is authorized to sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_products(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListProductsRequest( + account="account_value", + ) + + # Make the request + page_result = client.list_products(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListProductsRequest, dict]): + The request object. Request message for ListProducts. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListProductsPager: + Response message for ListProducts. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListProductsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListProductsRequest): + request = service.ListProductsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_products] + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListProductsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_skus(self, + request: Union[service.ListSkusRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListSkusPager: + r"""Lists the SKUs for a product the reseller is authorized to sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_skus(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListSkusRequest( + parent="parent_value", + account="account_value", + ) + + # Make the request + page_result = client.list_skus(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListSkusRequest, dict]): + The request object. Request message for ListSkus. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSkusPager: + Response message for ListSkus. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListSkusRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListSkusRequest): + request = service.ListSkusRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_skus] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListSkusPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_offers(self, + request: Union[service.ListOffersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListOffersPager: + r"""Lists the Offers the reseller can sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_offers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListOffersRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_offers(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListOffersRequest, dict]): + The request object. Request message for ListOffers. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListOffersPager: + Response message for ListOffers. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListOffersRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListOffersRequest): + request = service.ListOffersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_offers] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListOffersPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_purchasable_skus(self, + request: Union[service.ListPurchasableSkusRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPurchasableSkusPager: + r"""Lists the following: + + - SKUs that you can purchase for a customer + - SKUs that you can upgrade or downgrade for an entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_purchasable_skus(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() + create_entitlement_purchase.product = "product_value" + + request = channel_v1.ListPurchasableSkusRequest( + create_entitlement_purchase=create_entitlement_purchase, + customer="customer_value", + ) + + # Make the request + page_result = client.list_purchasable_skus(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListPurchasableSkusRequest, dict]): + The request object. Request message for + ListPurchasableSkus. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableSkusPager: + Response message for + ListPurchasableSkus. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListPurchasableSkusRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListPurchasableSkusRequest): + request = service.ListPurchasableSkusRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_purchasable_skus] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer", request.customer), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListPurchasableSkusPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_purchasable_offers(self, + request: Union[service.ListPurchasableOffersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPurchasableOffersPager: + r"""Lists the following: + + - Offers that you can purchase for a customer. + - Offers that you can change for an entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_purchasable_offers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() + create_entitlement_purchase.sku = "sku_value" + + request = channel_v1.ListPurchasableOffersRequest( + create_entitlement_purchase=create_entitlement_purchase, + customer="customer_value", + ) + + # Make the request + page_result = client.list_purchasable_offers(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListPurchasableOffersRequest, dict]): + The request object. Request message for + ListPurchasableOffers. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableOffersPager: + Response message for + ListPurchasableOffers. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListPurchasableOffersRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListPurchasableOffersRequest): + request = service.ListPurchasableOffersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_purchasable_offers] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("customer", request.customer), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListPurchasableOffersPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def register_subscriber(self, + request: Union[service.RegisterSubscriberRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.RegisterSubscriberResponse: + r"""Registers a service account with subscriber privileges on the + Cloud Pub/Sub topic for this Channel Services account. After you + create a subscriber, you get the events through + [SubscriberEvent][google.cloud.channel.v1.SubscriberEvent] + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The topic name with the registered service email + address. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_register_subscriber(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.RegisterSubscriberRequest( + account="account_value", + service_account="service_account_value", + ) + + # Make the request + response = client.register_subscriber(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.RegisterSubscriberRequest, dict]): + The request object. Request Message for + RegisterSubscriber. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.RegisterSubscriberResponse: + Response Message for + RegisterSubscriber. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.RegisterSubscriberRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.RegisterSubscriberRequest): + request = service.RegisterSubscriberRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.register_subscriber] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("account", request.account), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def unregister_subscriber(self, + request: Union[service.UnregisterSubscriberRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.UnregisterSubscriberResponse: + r"""Unregisters a service account with subscriber privileges on the + Cloud Pub/Sub topic created for this Channel Services account. + If there are no service accounts left with subscriber + privileges, this deletes the topic. You can call ListSubscribers + to check for these accounts. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The topic resource doesn't exist. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The topic name that unregistered the service email + address. Returns a success response if the service email address + wasn't registered with the topic. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_unregister_subscriber(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.UnregisterSubscriberRequest( + account="account_value", + service_account="service_account_value", + ) + + # Make the request + response = client.unregister_subscriber(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.UnregisterSubscriberRequest, dict]): + The request object. Request Message for + UnregisterSubscriber. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.types.UnregisterSubscriberResponse: + Response Message for + UnregisterSubscriber. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.UnregisterSubscriberRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.UnregisterSubscriberRequest): + request = service.UnregisterSubscriberRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.unregister_subscriber] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("account", request.account), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_subscribers(self, + request: Union[service.ListSubscribersRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListSubscribersPager: + r"""Lists service accounts with subscriber privileges on the Cloud + Pub/Sub topic created for this Channel Services account. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The topic resource doesn't exist. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: A list of service email addresses. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud import channel_v1 + + def sample_list_subscribers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListSubscribersRequest( + account="account_value", + ) + + # Make the request + page_result = client.list_subscribers(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListSubscribersRequest, dict]): + The request object. Request Message for ListSubscribers. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSubscribersPager: + Response Message for ListSubscribers. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a service.ListSubscribersRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListSubscribersRequest): + request = service.ListSubscribersRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_subscribers] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("account", request.account), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListSubscribersPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + def list_operations( + self, + request: operations_pb2.ListOperationsRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.ListOperationsResponse: + r"""Lists operations that match the specified filter in the request. + + Args: + request (:class:`~.operations_pb2.ListOperationsRequest`): + The request object. Request message for + `ListOperations` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.ListOperationsResponse: + Response message for ``ListOperations`` method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.ListOperationsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.list_operations, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_operation( + self, + request: operations_pb2.GetOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operations_pb2.Operation: + r"""Gets the latest state of a long-running operation. + + Args: + request (:class:`~.operations_pb2.GetOperationRequest`): + The request object. Request message for + `GetOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + ~.operations_pb2.Operation: + An ``Operation`` object. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.GetOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_operation( + self, + request: operations_pb2.DeleteOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a long-running operation. + + This method indicates that the client is no longer interested + in the operation result. It does not cancel the operation. + If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.DeleteOperationRequest`): + The request object. Request message for + `DeleteOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.DeleteOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.delete_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + def cancel_operation( + self, + request: operations_pb2.CancelOperationRequest = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Starts asynchronous cancellation on a long-running operation. + + The server makes a best effort to cancel the operation, but success + is not guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + + Args: + request (:class:`~.operations_pb2.CancelOperationRequest`): + The request object. Request message for + `CancelOperation` method. + retry (google.api_core.retry.Retry): Designation of what errors, + if any, should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + Returns: + None + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = operations_pb2.CancelOperationRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.cancel_operation, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("name", request.name),)), + ) + + # Send the request. + rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + + + + + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-cloud-channel", + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +__all__ = ( + "CloudChannelServiceClient", +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/pagers.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/pagers.py new file mode 100644 index 0000000..a9d06f9 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/pagers.py @@ -0,0 +1,1597 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator + +from google.cloud.channel_v1.types import channel_partner_links +from google.cloud.channel_v1.types import customers +from google.cloud.channel_v1.types import entitlements +from google.cloud.channel_v1.types import offers +from google.cloud.channel_v1.types import products +from google.cloud.channel_v1.types import repricing +from google.cloud.channel_v1.types import service + + +class ListCustomersPager: + """A pager for iterating through ``list_customers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListCustomersResponse` object, and + provides an ``__iter__`` method to iterate through its + ``customers`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCustomers`` requests and continue to iterate + through the ``customers`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListCustomersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCustomersResponse], + request: service.ListCustomersRequest, + response: service.ListCustomersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListCustomersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListCustomersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCustomersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCustomersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[customers.Customer]: + for page in self.pages: + yield from page.customers + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCustomersAsyncPager: + """A pager for iterating through ``list_customers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListCustomersResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``customers`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCustomers`` requests and continue to iterate + through the ``customers`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListCustomersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCustomersResponse]], + request: service.ListCustomersRequest, + response: service.ListCustomersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListCustomersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListCustomersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCustomersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCustomersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[customers.Customer]: + async def async_generator(): + async for page in self.pages: + for response in page.customers: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListEntitlementsPager: + """A pager for iterating through ``list_entitlements`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListEntitlementsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``entitlements`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListEntitlements`` requests and continue to iterate + through the ``entitlements`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListEntitlementsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListEntitlementsResponse], + request: service.ListEntitlementsRequest, + response: service.ListEntitlementsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListEntitlementsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListEntitlementsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListEntitlementsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListEntitlementsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[entitlements.Entitlement]: + for page in self.pages: + yield from page.entitlements + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListEntitlementsAsyncPager: + """A pager for iterating through ``list_entitlements`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListEntitlementsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``entitlements`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListEntitlements`` requests and continue to iterate + through the ``entitlements`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListEntitlementsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListEntitlementsResponse]], + request: service.ListEntitlementsRequest, + response: service.ListEntitlementsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListEntitlementsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListEntitlementsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListEntitlementsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListEntitlementsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[entitlements.Entitlement]: + async def async_generator(): + async for page in self.pages: + for response in page.entitlements: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListTransferableSkusPager: + """A pager for iterating through ``list_transferable_skus`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListTransferableSkusResponse` object, and + provides an ``__iter__`` method to iterate through its + ``transferable_skus`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListTransferableSkus`` requests and continue to iterate + through the ``transferable_skus`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListTransferableSkusResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListTransferableSkusResponse], + request: service.ListTransferableSkusRequest, + response: service.ListTransferableSkusResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListTransferableSkusRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListTransferableSkusResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListTransferableSkusRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListTransferableSkusResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[entitlements.TransferableSku]: + for page in self.pages: + yield from page.transferable_skus + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListTransferableSkusAsyncPager: + """A pager for iterating through ``list_transferable_skus`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListTransferableSkusResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``transferable_skus`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListTransferableSkus`` requests and continue to iterate + through the ``transferable_skus`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListTransferableSkusResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListTransferableSkusResponse]], + request: service.ListTransferableSkusRequest, + response: service.ListTransferableSkusResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListTransferableSkusRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListTransferableSkusResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListTransferableSkusRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListTransferableSkusResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[entitlements.TransferableSku]: + async def async_generator(): + async for page in self.pages: + for response in page.transferable_skus: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListTransferableOffersPager: + """A pager for iterating through ``list_transferable_offers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListTransferableOffersResponse` object, and + provides an ``__iter__`` method to iterate through its + ``transferable_offers`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListTransferableOffers`` requests and continue to iterate + through the ``transferable_offers`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListTransferableOffersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListTransferableOffersResponse], + request: service.ListTransferableOffersRequest, + response: service.ListTransferableOffersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListTransferableOffersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListTransferableOffersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListTransferableOffersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListTransferableOffersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[service.TransferableOffer]: + for page in self.pages: + yield from page.transferable_offers + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListTransferableOffersAsyncPager: + """A pager for iterating through ``list_transferable_offers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListTransferableOffersResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``transferable_offers`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListTransferableOffers`` requests and continue to iterate + through the ``transferable_offers`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListTransferableOffersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListTransferableOffersResponse]], + request: service.ListTransferableOffersRequest, + response: service.ListTransferableOffersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListTransferableOffersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListTransferableOffersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListTransferableOffersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListTransferableOffersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[service.TransferableOffer]: + async def async_generator(): + async for page in self.pages: + for response in page.transferable_offers: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListChannelPartnerLinksPager: + """A pager for iterating through ``list_channel_partner_links`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListChannelPartnerLinksResponse` object, and + provides an ``__iter__`` method to iterate through its + ``channel_partner_links`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListChannelPartnerLinks`` requests and continue to iterate + through the ``channel_partner_links`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListChannelPartnerLinksResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListChannelPartnerLinksResponse], + request: service.ListChannelPartnerLinksRequest, + response: service.ListChannelPartnerLinksResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListChannelPartnerLinksRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListChannelPartnerLinksResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListChannelPartnerLinksRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListChannelPartnerLinksResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[channel_partner_links.ChannelPartnerLink]: + for page in self.pages: + yield from page.channel_partner_links + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListChannelPartnerLinksAsyncPager: + """A pager for iterating through ``list_channel_partner_links`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListChannelPartnerLinksResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``channel_partner_links`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListChannelPartnerLinks`` requests and continue to iterate + through the ``channel_partner_links`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListChannelPartnerLinksResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListChannelPartnerLinksResponse]], + request: service.ListChannelPartnerLinksRequest, + response: service.ListChannelPartnerLinksResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListChannelPartnerLinksRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListChannelPartnerLinksResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListChannelPartnerLinksRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListChannelPartnerLinksResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[channel_partner_links.ChannelPartnerLink]: + async def async_generator(): + async for page in self.pages: + for response in page.channel_partner_links: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCustomerRepricingConfigsPager: + """A pager for iterating through ``list_customer_repricing_configs`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``customer_repricing_configs`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCustomerRepricingConfigs`` requests and continue to iterate + through the ``customer_repricing_configs`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCustomerRepricingConfigsResponse], + request: service.ListCustomerRepricingConfigsRequest, + response: service.ListCustomerRepricingConfigsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCustomerRepricingConfigsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCustomerRepricingConfigsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[repricing.CustomerRepricingConfig]: + for page in self.pages: + yield from page.customer_repricing_configs + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCustomerRepricingConfigsAsyncPager: + """A pager for iterating through ``list_customer_repricing_configs`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``customer_repricing_configs`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCustomerRepricingConfigs`` requests and continue to iterate + through the ``customer_repricing_configs`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCustomerRepricingConfigsResponse]], + request: service.ListCustomerRepricingConfigsRequest, + response: service.ListCustomerRepricingConfigsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCustomerRepricingConfigsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCustomerRepricingConfigsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[repricing.CustomerRepricingConfig]: + async def async_generator(): + async for page in self.pages: + for response in page.customer_repricing_configs: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListChannelPartnerRepricingConfigsPager: + """A pager for iterating through ``list_channel_partner_repricing_configs`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``channel_partner_repricing_configs`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListChannelPartnerRepricingConfigs`` requests and continue to iterate + through the ``channel_partner_repricing_configs`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListChannelPartnerRepricingConfigsResponse], + request: service.ListChannelPartnerRepricingConfigsRequest, + response: service.ListChannelPartnerRepricingConfigsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListChannelPartnerRepricingConfigsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListChannelPartnerRepricingConfigsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[repricing.ChannelPartnerRepricingConfig]: + for page in self.pages: + yield from page.channel_partner_repricing_configs + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListChannelPartnerRepricingConfigsAsyncPager: + """A pager for iterating through ``list_channel_partner_repricing_configs`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``channel_partner_repricing_configs`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListChannelPartnerRepricingConfigs`` requests and continue to iterate + through the ``channel_partner_repricing_configs`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListChannelPartnerRepricingConfigsResponse]], + request: service.ListChannelPartnerRepricingConfigsRequest, + response: service.ListChannelPartnerRepricingConfigsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListChannelPartnerRepricingConfigsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListChannelPartnerRepricingConfigsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[repricing.ChannelPartnerRepricingConfig]: + async def async_generator(): + async for page in self.pages: + for response in page.channel_partner_repricing_configs: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListProductsPager: + """A pager for iterating through ``list_products`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListProductsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``products`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListProducts`` requests and continue to iterate + through the ``products`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListProductsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListProductsResponse], + request: service.ListProductsRequest, + response: service.ListProductsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListProductsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListProductsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListProductsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListProductsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[products.Product]: + for page in self.pages: + yield from page.products + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListProductsAsyncPager: + """A pager for iterating through ``list_products`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListProductsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``products`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListProducts`` requests and continue to iterate + through the ``products`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListProductsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListProductsResponse]], + request: service.ListProductsRequest, + response: service.ListProductsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListProductsRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListProductsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListProductsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListProductsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[products.Product]: + async def async_generator(): + async for page in self.pages: + for response in page.products: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListSkusPager: + """A pager for iterating through ``list_skus`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListSkusResponse` object, and + provides an ``__iter__`` method to iterate through its + ``skus`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListSkus`` requests and continue to iterate + through the ``skus`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListSkusResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListSkusResponse], + request: service.ListSkusRequest, + response: service.ListSkusResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListSkusRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListSkusResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListSkusRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListSkusResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[products.Sku]: + for page in self.pages: + yield from page.skus + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListSkusAsyncPager: + """A pager for iterating through ``list_skus`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListSkusResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``skus`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListSkus`` requests and continue to iterate + through the ``skus`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListSkusResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListSkusResponse]], + request: service.ListSkusRequest, + response: service.ListSkusResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListSkusRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListSkusResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListSkusRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListSkusResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[products.Sku]: + async def async_generator(): + async for page in self.pages: + for response in page.skus: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListOffersPager: + """A pager for iterating through ``list_offers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListOffersResponse` object, and + provides an ``__iter__`` method to iterate through its + ``offers`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListOffers`` requests and continue to iterate + through the ``offers`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListOffersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListOffersResponse], + request: service.ListOffersRequest, + response: service.ListOffersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListOffersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListOffersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListOffersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListOffersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[offers.Offer]: + for page in self.pages: + yield from page.offers + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListOffersAsyncPager: + """A pager for iterating through ``list_offers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListOffersResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``offers`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListOffers`` requests and continue to iterate + through the ``offers`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListOffersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListOffersResponse]], + request: service.ListOffersRequest, + response: service.ListOffersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListOffersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListOffersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListOffersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListOffersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[offers.Offer]: + async def async_generator(): + async for page in self.pages: + for response in page.offers: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListPurchasableSkusPager: + """A pager for iterating through ``list_purchasable_skus`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListPurchasableSkusResponse` object, and + provides an ``__iter__`` method to iterate through its + ``purchasable_skus`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListPurchasableSkus`` requests and continue to iterate + through the ``purchasable_skus`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListPurchasableSkusResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListPurchasableSkusResponse], + request: service.ListPurchasableSkusRequest, + response: service.ListPurchasableSkusResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListPurchasableSkusRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListPurchasableSkusResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListPurchasableSkusRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListPurchasableSkusResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[service.PurchasableSku]: + for page in self.pages: + yield from page.purchasable_skus + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListPurchasableSkusAsyncPager: + """A pager for iterating through ``list_purchasable_skus`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListPurchasableSkusResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``purchasable_skus`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListPurchasableSkus`` requests and continue to iterate + through the ``purchasable_skus`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListPurchasableSkusResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListPurchasableSkusResponse]], + request: service.ListPurchasableSkusRequest, + response: service.ListPurchasableSkusResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListPurchasableSkusRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListPurchasableSkusResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListPurchasableSkusRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListPurchasableSkusResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[service.PurchasableSku]: + async def async_generator(): + async for page in self.pages: + for response in page.purchasable_skus: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListPurchasableOffersPager: + """A pager for iterating through ``list_purchasable_offers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListPurchasableOffersResponse` object, and + provides an ``__iter__`` method to iterate through its + ``purchasable_offers`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListPurchasableOffers`` requests and continue to iterate + through the ``purchasable_offers`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListPurchasableOffersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListPurchasableOffersResponse], + request: service.ListPurchasableOffersRequest, + response: service.ListPurchasableOffersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListPurchasableOffersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListPurchasableOffersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListPurchasableOffersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListPurchasableOffersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[service.PurchasableOffer]: + for page in self.pages: + yield from page.purchasable_offers + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListPurchasableOffersAsyncPager: + """A pager for iterating through ``list_purchasable_offers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListPurchasableOffersResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``purchasable_offers`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListPurchasableOffers`` requests and continue to iterate + through the ``purchasable_offers`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListPurchasableOffersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListPurchasableOffersResponse]], + request: service.ListPurchasableOffersRequest, + response: service.ListPurchasableOffersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListPurchasableOffersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListPurchasableOffersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListPurchasableOffersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListPurchasableOffersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[service.PurchasableOffer]: + async def async_generator(): + async for page in self.pages: + for response in page.purchasable_offers: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListSubscribersPager: + """A pager for iterating through ``list_subscribers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListSubscribersResponse` object, and + provides an ``__iter__`` method to iterate through its + ``service_accounts`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListSubscribers`` requests and continue to iterate + through the ``service_accounts`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListSubscribersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListSubscribersResponse], + request: service.ListSubscribersRequest, + response: service.ListSubscribersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListSubscribersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListSubscribersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListSubscribersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListSubscribersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[str]: + for page in self.pages: + yield from page.service_accounts + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListSubscribersAsyncPager: + """A pager for iterating through ``list_subscribers`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListSubscribersResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``service_accounts`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListSubscribers`` requests and continue to iterate + through the ``service_accounts`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListSubscribersResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListSubscribersResponse]], + request: service.ListSubscribersRequest, + response: service.ListSubscribersResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.channel_v1.types.ListSubscribersRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListSubscribersResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListSubscribersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListSubscribersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[str]: + async def async_generator(): + async for page in self.pages: + for response in page.service_accounts: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/__init__.py new file mode 100644 index 0000000..eb57bb2 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import CloudChannelServiceTransport +from .grpc import CloudChannelServiceGrpcTransport +from .grpc_asyncio import CloudChannelServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[CloudChannelServiceTransport]] +_transport_registry['grpc'] = CloudChannelServiceGrpcTransport +_transport_registry['grpc_asyncio'] = CloudChannelServiceGrpcAsyncIOTransport + +__all__ = ( + 'CloudChannelServiceTransport', + 'CloudChannelServiceGrpcTransport', + 'CloudChannelServiceGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py new file mode 100644 index 0000000..f0ea07d --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py @@ -0,0 +1,820 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union +import pkg_resources + +import google.auth # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.channel_v1.types import channel_partner_links +from google.cloud.channel_v1.types import customers +from google.cloud.channel_v1.types import entitlements +from google.cloud.channel_v1.types import offers +from google.cloud.channel_v1.types import repricing +from google.cloud.channel_v1.types import service +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore + +try: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + 'google-cloud-channel', + ).version, + ) +except pkg_resources.DistributionNotFound: + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() + + +class CloudChannelServiceTransport(abc.ABC): + """Abstract transport class for CloudChannelService.""" + + AUTH_SCOPES = ( + 'https://www.googleapis.com/auth/apps.order', + ) + + DEFAULT_HOST: str = 'cloudchannel.googleapis.com' + def __init__( + self, *, + host: str = DEFAULT_HOST, + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, + **scopes_kwargs, + quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience(api_audience if api_audience else host) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ':' not in host: + host += ':443' + self._host = host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_customers: gapic_v1.method.wrap_method( + self.list_customers, + default_timeout=None, + client_info=client_info, + ), + self.get_customer: gapic_v1.method.wrap_method( + self.get_customer, + default_timeout=None, + client_info=client_info, + ), + self.check_cloud_identity_accounts_exist: gapic_v1.method.wrap_method( + self.check_cloud_identity_accounts_exist, + default_timeout=None, + client_info=client_info, + ), + self.create_customer: gapic_v1.method.wrap_method( + self.create_customer, + default_timeout=None, + client_info=client_info, + ), + self.update_customer: gapic_v1.method.wrap_method( + self.update_customer, + default_timeout=None, + client_info=client_info, + ), + self.delete_customer: gapic_v1.method.wrap_method( + self.delete_customer, + default_timeout=None, + client_info=client_info, + ), + self.import_customer: gapic_v1.method.wrap_method( + self.import_customer, + default_timeout=None, + client_info=client_info, + ), + self.provision_cloud_identity: gapic_v1.method.wrap_method( + self.provision_cloud_identity, + default_timeout=60.0, + client_info=client_info, + ), + self.list_entitlements: gapic_v1.method.wrap_method( + self.list_entitlements, + default_timeout=None, + client_info=client_info, + ), + self.list_transferable_skus: gapic_v1.method.wrap_method( + self.list_transferable_skus, + default_timeout=None, + client_info=client_info, + ), + self.list_transferable_offers: gapic_v1.method.wrap_method( + self.list_transferable_offers, + default_timeout=None, + client_info=client_info, + ), + self.get_entitlement: gapic_v1.method.wrap_method( + self.get_entitlement, + default_timeout=None, + client_info=client_info, + ), + self.create_entitlement: gapic_v1.method.wrap_method( + self.create_entitlement, + default_timeout=60.0, + client_info=client_info, + ), + self.change_parameters: gapic_v1.method.wrap_method( + self.change_parameters, + default_timeout=60.0, + client_info=client_info, + ), + self.change_renewal_settings: gapic_v1.method.wrap_method( + self.change_renewal_settings, + default_timeout=60.0, + client_info=client_info, + ), + self.change_offer: gapic_v1.method.wrap_method( + self.change_offer, + default_timeout=60.0, + client_info=client_info, + ), + self.start_paid_service: gapic_v1.method.wrap_method( + self.start_paid_service, + default_timeout=60.0, + client_info=client_info, + ), + self.suspend_entitlement: gapic_v1.method.wrap_method( + self.suspend_entitlement, + default_timeout=60.0, + client_info=client_info, + ), + self.cancel_entitlement: gapic_v1.method.wrap_method( + self.cancel_entitlement, + default_timeout=60.0, + client_info=client_info, + ), + self.activate_entitlement: gapic_v1.method.wrap_method( + self.activate_entitlement, + default_timeout=60.0, + client_info=client_info, + ), + self.transfer_entitlements: gapic_v1.method.wrap_method( + self.transfer_entitlements, + default_timeout=60.0, + client_info=client_info, + ), + self.transfer_entitlements_to_google: gapic_v1.method.wrap_method( + self.transfer_entitlements_to_google, + default_timeout=60.0, + client_info=client_info, + ), + self.list_channel_partner_links: gapic_v1.method.wrap_method( + self.list_channel_partner_links, + default_timeout=None, + client_info=client_info, + ), + self.get_channel_partner_link: gapic_v1.method.wrap_method( + self.get_channel_partner_link, + default_timeout=None, + client_info=client_info, + ), + self.create_channel_partner_link: gapic_v1.method.wrap_method( + self.create_channel_partner_link, + default_timeout=None, + client_info=client_info, + ), + self.update_channel_partner_link: gapic_v1.method.wrap_method( + self.update_channel_partner_link, + default_timeout=None, + client_info=client_info, + ), + self.get_customer_repricing_config: gapic_v1.method.wrap_method( + self.get_customer_repricing_config, + default_timeout=None, + client_info=client_info, + ), + self.list_customer_repricing_configs: gapic_v1.method.wrap_method( + self.list_customer_repricing_configs, + default_timeout=None, + client_info=client_info, + ), + self.create_customer_repricing_config: gapic_v1.method.wrap_method( + self.create_customer_repricing_config, + default_timeout=None, + client_info=client_info, + ), + self.update_customer_repricing_config: gapic_v1.method.wrap_method( + self.update_customer_repricing_config, + default_timeout=None, + client_info=client_info, + ), + self.delete_customer_repricing_config: gapic_v1.method.wrap_method( + self.delete_customer_repricing_config, + default_timeout=None, + client_info=client_info, + ), + self.get_channel_partner_repricing_config: gapic_v1.method.wrap_method( + self.get_channel_partner_repricing_config, + default_timeout=None, + client_info=client_info, + ), + self.list_channel_partner_repricing_configs: gapic_v1.method.wrap_method( + self.list_channel_partner_repricing_configs, + default_timeout=None, + client_info=client_info, + ), + self.create_channel_partner_repricing_config: gapic_v1.method.wrap_method( + self.create_channel_partner_repricing_config, + default_timeout=None, + client_info=client_info, + ), + self.update_channel_partner_repricing_config: gapic_v1.method.wrap_method( + self.update_channel_partner_repricing_config, + default_timeout=None, + client_info=client_info, + ), + self.delete_channel_partner_repricing_config: gapic_v1.method.wrap_method( + self.delete_channel_partner_repricing_config, + default_timeout=None, + client_info=client_info, + ), + self.lookup_offer: gapic_v1.method.wrap_method( + self.lookup_offer, + default_timeout=None, + client_info=client_info, + ), + self.list_products: gapic_v1.method.wrap_method( + self.list_products, + default_timeout=None, + client_info=client_info, + ), + self.list_skus: gapic_v1.method.wrap_method( + self.list_skus, + default_timeout=None, + client_info=client_info, + ), + self.list_offers: gapic_v1.method.wrap_method( + self.list_offers, + default_timeout=None, + client_info=client_info, + ), + self.list_purchasable_skus: gapic_v1.method.wrap_method( + self.list_purchasable_skus, + default_timeout=None, + client_info=client_info, + ), + self.list_purchasable_offers: gapic_v1.method.wrap_method( + self.list_purchasable_offers, + default_timeout=None, + client_info=client_info, + ), + self.register_subscriber: gapic_v1.method.wrap_method( + self.register_subscriber, + default_timeout=None, + client_info=client_info, + ), + self.unregister_subscriber: gapic_v1.method.wrap_method( + self.unregister_subscriber, + default_timeout=None, + client_info=client_info, + ), + self.list_subscribers: gapic_v1.method.wrap_method( + self.list_subscribers, + default_timeout=None, + client_info=client_info, + ), + } + + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + + @property + def operations_client(self): + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def list_customers(self) -> Callable[ + [service.ListCustomersRequest], + Union[ + service.ListCustomersResponse, + Awaitable[service.ListCustomersResponse] + ]]: + raise NotImplementedError() + + @property + def get_customer(self) -> Callable[ + [service.GetCustomerRequest], + Union[ + customers.Customer, + Awaitable[customers.Customer] + ]]: + raise NotImplementedError() + + @property + def check_cloud_identity_accounts_exist(self) -> Callable[ + [service.CheckCloudIdentityAccountsExistRequest], + Union[ + service.CheckCloudIdentityAccountsExistResponse, + Awaitable[service.CheckCloudIdentityAccountsExistResponse] + ]]: + raise NotImplementedError() + + @property + def create_customer(self) -> Callable[ + [service.CreateCustomerRequest], + Union[ + customers.Customer, + Awaitable[customers.Customer] + ]]: + raise NotImplementedError() + + @property + def update_customer(self) -> Callable[ + [service.UpdateCustomerRequest], + Union[ + customers.Customer, + Awaitable[customers.Customer] + ]]: + raise NotImplementedError() + + @property + def delete_customer(self) -> Callable[ + [service.DeleteCustomerRequest], + Union[ + empty_pb2.Empty, + Awaitable[empty_pb2.Empty] + ]]: + raise NotImplementedError() + + @property + def import_customer(self) -> Callable[ + [service.ImportCustomerRequest], + Union[ + customers.Customer, + Awaitable[customers.Customer] + ]]: + raise NotImplementedError() + + @property + def provision_cloud_identity(self) -> Callable[ + [service.ProvisionCloudIdentityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def list_entitlements(self) -> Callable[ + [service.ListEntitlementsRequest], + Union[ + service.ListEntitlementsResponse, + Awaitable[service.ListEntitlementsResponse] + ]]: + raise NotImplementedError() + + @property + def list_transferable_skus(self) -> Callable[ + [service.ListTransferableSkusRequest], + Union[ + service.ListTransferableSkusResponse, + Awaitable[service.ListTransferableSkusResponse] + ]]: + raise NotImplementedError() + + @property + def list_transferable_offers(self) -> Callable[ + [service.ListTransferableOffersRequest], + Union[ + service.ListTransferableOffersResponse, + Awaitable[service.ListTransferableOffersResponse] + ]]: + raise NotImplementedError() + + @property + def get_entitlement(self) -> Callable[ + [service.GetEntitlementRequest], + Union[ + entitlements.Entitlement, + Awaitable[entitlements.Entitlement] + ]]: + raise NotImplementedError() + + @property + def create_entitlement(self) -> Callable[ + [service.CreateEntitlementRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def change_parameters(self) -> Callable[ + [service.ChangeParametersRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def change_renewal_settings(self) -> Callable[ + [service.ChangeRenewalSettingsRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def change_offer(self) -> Callable[ + [service.ChangeOfferRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def start_paid_service(self) -> Callable[ + [service.StartPaidServiceRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def suspend_entitlement(self) -> Callable[ + [service.SuspendEntitlementRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def cancel_entitlement(self) -> Callable[ + [service.CancelEntitlementRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def activate_entitlement(self) -> Callable[ + [service.ActivateEntitlementRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def transfer_entitlements(self) -> Callable[ + [service.TransferEntitlementsRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def transfer_entitlements_to_google(self) -> Callable[ + [service.TransferEntitlementsToGoogleRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def list_channel_partner_links(self) -> Callable[ + [service.ListChannelPartnerLinksRequest], + Union[ + service.ListChannelPartnerLinksResponse, + Awaitable[service.ListChannelPartnerLinksResponse] + ]]: + raise NotImplementedError() + + @property + def get_channel_partner_link(self) -> Callable[ + [service.GetChannelPartnerLinkRequest], + Union[ + channel_partner_links.ChannelPartnerLink, + Awaitable[channel_partner_links.ChannelPartnerLink] + ]]: + raise NotImplementedError() + + @property + def create_channel_partner_link(self) -> Callable[ + [service.CreateChannelPartnerLinkRequest], + Union[ + channel_partner_links.ChannelPartnerLink, + Awaitable[channel_partner_links.ChannelPartnerLink] + ]]: + raise NotImplementedError() + + @property + def update_channel_partner_link(self) -> Callable[ + [service.UpdateChannelPartnerLinkRequest], + Union[ + channel_partner_links.ChannelPartnerLink, + Awaitable[channel_partner_links.ChannelPartnerLink] + ]]: + raise NotImplementedError() + + @property + def get_customer_repricing_config(self) -> Callable[ + [service.GetCustomerRepricingConfigRequest], + Union[ + repricing.CustomerRepricingConfig, + Awaitable[repricing.CustomerRepricingConfig] + ]]: + raise NotImplementedError() + + @property + def list_customer_repricing_configs(self) -> Callable[ + [service.ListCustomerRepricingConfigsRequest], + Union[ + service.ListCustomerRepricingConfigsResponse, + Awaitable[service.ListCustomerRepricingConfigsResponse] + ]]: + raise NotImplementedError() + + @property + def create_customer_repricing_config(self) -> Callable[ + [service.CreateCustomerRepricingConfigRequest], + Union[ + repricing.CustomerRepricingConfig, + Awaitable[repricing.CustomerRepricingConfig] + ]]: + raise NotImplementedError() + + @property + def update_customer_repricing_config(self) -> Callable[ + [service.UpdateCustomerRepricingConfigRequest], + Union[ + repricing.CustomerRepricingConfig, + Awaitable[repricing.CustomerRepricingConfig] + ]]: + raise NotImplementedError() + + @property + def delete_customer_repricing_config(self) -> Callable[ + [service.DeleteCustomerRepricingConfigRequest], + Union[ + empty_pb2.Empty, + Awaitable[empty_pb2.Empty] + ]]: + raise NotImplementedError() + + @property + def get_channel_partner_repricing_config(self) -> Callable[ + [service.GetChannelPartnerRepricingConfigRequest], + Union[ + repricing.ChannelPartnerRepricingConfig, + Awaitable[repricing.ChannelPartnerRepricingConfig] + ]]: + raise NotImplementedError() + + @property + def list_channel_partner_repricing_configs(self) -> Callable[ + [service.ListChannelPartnerRepricingConfigsRequest], + Union[ + service.ListChannelPartnerRepricingConfigsResponse, + Awaitable[service.ListChannelPartnerRepricingConfigsResponse] + ]]: + raise NotImplementedError() + + @property + def create_channel_partner_repricing_config(self) -> Callable[ + [service.CreateChannelPartnerRepricingConfigRequest], + Union[ + repricing.ChannelPartnerRepricingConfig, + Awaitable[repricing.ChannelPartnerRepricingConfig] + ]]: + raise NotImplementedError() + + @property + def update_channel_partner_repricing_config(self) -> Callable[ + [service.UpdateChannelPartnerRepricingConfigRequest], + Union[ + repricing.ChannelPartnerRepricingConfig, + Awaitable[repricing.ChannelPartnerRepricingConfig] + ]]: + raise NotImplementedError() + + @property + def delete_channel_partner_repricing_config(self) -> Callable[ + [service.DeleteChannelPartnerRepricingConfigRequest], + Union[ + empty_pb2.Empty, + Awaitable[empty_pb2.Empty] + ]]: + raise NotImplementedError() + + @property + def lookup_offer(self) -> Callable[ + [service.LookupOfferRequest], + Union[ + offers.Offer, + Awaitable[offers.Offer] + ]]: + raise NotImplementedError() + + @property + def list_products(self) -> Callable[ + [service.ListProductsRequest], + Union[ + service.ListProductsResponse, + Awaitable[service.ListProductsResponse] + ]]: + raise NotImplementedError() + + @property + def list_skus(self) -> Callable[ + [service.ListSkusRequest], + Union[ + service.ListSkusResponse, + Awaitable[service.ListSkusResponse] + ]]: + raise NotImplementedError() + + @property + def list_offers(self) -> Callable[ + [service.ListOffersRequest], + Union[ + service.ListOffersResponse, + Awaitable[service.ListOffersResponse] + ]]: + raise NotImplementedError() + + @property + def list_purchasable_skus(self) -> Callable[ + [service.ListPurchasableSkusRequest], + Union[ + service.ListPurchasableSkusResponse, + Awaitable[service.ListPurchasableSkusResponse] + ]]: + raise NotImplementedError() + + @property + def list_purchasable_offers(self) -> Callable[ + [service.ListPurchasableOffersRequest], + Union[ + service.ListPurchasableOffersResponse, + Awaitable[service.ListPurchasableOffersResponse] + ]]: + raise NotImplementedError() + + @property + def register_subscriber(self) -> Callable[ + [service.RegisterSubscriberRequest], + Union[ + service.RegisterSubscriberResponse, + Awaitable[service.RegisterSubscriberResponse] + ]]: + raise NotImplementedError() + + @property + def unregister_subscriber(self) -> Callable[ + [service.UnregisterSubscriberRequest], + Union[ + service.UnregisterSubscriberResponse, + Awaitable[service.UnregisterSubscriberResponse] + ]]: + raise NotImplementedError() + + @property + def list_subscribers(self) -> Callable[ + [service.ListSubscribersRequest], + Union[ + service.ListSubscribersResponse, + Awaitable[service.ListSubscribersResponse] + ]]: + raise NotImplementedError() + + @property + def list_operations( + self, + ) -> Callable[ + [operations_pb2.ListOperationsRequest], + Union[operations_pb2.ListOperationsResponse, Awaitable[operations_pb2.ListOperationsResponse]], + ]: + raise NotImplementedError() + + @property + def get_operation( + self, + ) -> Callable[ + [operations_pb2.GetOperationRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def cancel_operation( + self, + ) -> Callable[ + [operations_pb2.CancelOperationRequest], + None, + ]: + raise NotImplementedError() + + @property + def delete_operation( + self, + ) -> Callable[ + [operations_pb2.DeleteOperationRequest], + None, + ]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + + +__all__ = ( + 'CloudChannelServiceTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py new file mode 100644 index 0000000..2acce35 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py @@ -0,0 +1,2459 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_v1 +import google.auth # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore + +from google.cloud.channel_v1.types import channel_partner_links +from google.cloud.channel_v1.types import customers +from google.cloud.channel_v1.types import entitlements +from google.cloud.channel_v1.types import offers +from google.cloud.channel_v1.types import repricing +from google.cloud.channel_v1.types import service +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore +from .base import CloudChannelServiceTransport, DEFAULT_CLIENT_INFO + + +class CloudChannelServiceGrpcTransport(CloudChannelServiceTransport): + """gRPC backend transport for CloudChannelService. + + CloudChannelService lets Google cloud resellers and distributors + manage their customers, channel partners, entitlements, and reports. + + Using this service: + + 1. Resellers and distributors can manage a customer entity. + 2. Distributors can register an authorized reseller in their channel + and provide them with delegated admin access. + 3. Resellers and distributors can manage customer entitlements. + + CloudChannelService exposes the following resources: + + - [Customer][google.cloud.channel.v1.Customer]s: An entity—usually + an enterprise—managed by a reseller or distributor. + + - [Entitlement][google.cloud.channel.v1.Entitlement]s: An entity + that provides a customer with the means to use a service. + Entitlements are created or updated as a result of a successful + fulfillment. + + - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s: + An entity that identifies links between distributors and their + indirect resellers in a channel. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + _stubs: Dict[str, Callable] + + def __init__(self, *, + host: str = 'cloudchannel.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel(cls, + host: str = 'cloudchannel.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def list_customers(self) -> Callable[ + [service.ListCustomersRequest], + service.ListCustomersResponse]: + r"""Return a callable for the list customers method over gRPC. + + List [Customer][google.cloud.channel.v1.Customer]s. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: List of + [Customer][google.cloud.channel.v1.Customer]s, or an empty list + if there are no customers. + + Returns: + Callable[[~.ListCustomersRequest], + ~.ListCustomersResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_customers' not in self._stubs: + self._stubs['list_customers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListCustomers', + request_serializer=service.ListCustomersRequest.serialize, + response_deserializer=service.ListCustomersResponse.deserialize, + ) + return self._stubs['list_customers'] + + @property + def get_customer(self) -> Callable[ + [service.GetCustomerRequest], + customers.Customer]: + r"""Return a callable for the get customer method over gRPC. + + Returns the requested + [Customer][google.cloud.channel.v1.Customer] resource. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer resource doesn't exist. Usually the + result of an invalid name parameter. + + Return value: The [Customer][google.cloud.channel.v1.Customer] + resource. + + Returns: + Callable[[~.GetCustomerRequest], + ~.Customer]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_customer' not in self._stubs: + self._stubs['get_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetCustomer', + request_serializer=service.GetCustomerRequest.serialize, + response_deserializer=customers.Customer.deserialize, + ) + return self._stubs['get_customer'] + + @property + def check_cloud_identity_accounts_exist(self) -> Callable[ + [service.CheckCloudIdentityAccountsExistRequest], + service.CheckCloudIdentityAccountsExistResponse]: + r"""Return a callable for the check cloud identity accounts + exist method over gRPC. + + Confirms the existence of Cloud Identity accounts based on the + domain and if the Cloud Identity accounts are owned by the + reseller. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - INVALID_VALUE: Invalid domain value in the request. + + Return value: A list of + [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] + resources for the domain (may be empty) + + Note: in the v1alpha1 version of the API, a NOT_FOUND error + returns if no + [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] + resources match the domain. + + Returns: + Callable[[~.CheckCloudIdentityAccountsExistRequest], + ~.CheckCloudIdentityAccountsExistResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'check_cloud_identity_accounts_exist' not in self._stubs: + self._stubs['check_cloud_identity_accounts_exist'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CheckCloudIdentityAccountsExist', + request_serializer=service.CheckCloudIdentityAccountsExistRequest.serialize, + response_deserializer=service.CheckCloudIdentityAccountsExistResponse.deserialize, + ) + return self._stubs['check_cloud_identity_accounts_exist'] + + @property + def create_customer(self) -> Callable[ + [service.CreateCustomerRequest], + customers.Customer]: + r"""Return a callable for the create customer method over gRPC. + + Creates a new [Customer][google.cloud.channel.v1.Customer] + resource under the reseller or distributor account. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - Domain field value doesn't match the primary email domain. + + Return value: The newly created + [Customer][google.cloud.channel.v1.Customer] resource. + + Returns: + Callable[[~.CreateCustomerRequest], + ~.Customer]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_customer' not in self._stubs: + self._stubs['create_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateCustomer', + request_serializer=service.CreateCustomerRequest.serialize, + response_deserializer=customers.Customer.deserialize, + ) + return self._stubs['create_customer'] + + @property + def update_customer(self) -> Callable[ + [service.UpdateCustomerRequest], + customers.Customer]: + r"""Return a callable for the update customer method over gRPC. + + Updates an existing [Customer][google.cloud.channel.v1.Customer] + resource for the reseller or distributor. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] + resource found for the name in the request. + + Return value: The updated + [Customer][google.cloud.channel.v1.Customer] resource. + + Returns: + Callable[[~.UpdateCustomerRequest], + ~.Customer]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_customer' not in self._stubs: + self._stubs['update_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UpdateCustomer', + request_serializer=service.UpdateCustomerRequest.serialize, + response_deserializer=customers.Customer.deserialize, + ) + return self._stubs['update_customer'] + + @property + def delete_customer(self) -> Callable[ + [service.DeleteCustomerRequest], + empty_pb2.Empty]: + r"""Return a callable for the delete customer method over gRPC. + + Deletes the given [Customer][google.cloud.channel.v1.Customer] + permanently. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The customer has existing entitlements. + - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] + resource found for the name in the request. + + Returns: + Callable[[~.DeleteCustomerRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_customer' not in self._stubs: + self._stubs['delete_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/DeleteCustomer', + request_serializer=service.DeleteCustomerRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['delete_customer'] + + @property + def import_customer(self) -> Callable[ + [service.ImportCustomerRequest], + customers.Customer]: + r"""Return a callable for the import customer method over gRPC. + + Imports a [Customer][google.cloud.channel.v1.Customer] from the + Cloud Identity associated with the provided Cloud Identity ID or + domain before a TransferEntitlements call. If a linked Customer + already exists and overwrite_if_exists is true, it will update + that Customer's data. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - NOT_FOUND: Cloud Identity doesn't exist or was deleted. + - INVALID_ARGUMENT: Required parameters are missing, or the + auth_token is expired or invalid. + - ALREADY_EXISTS: A customer already exists and has conflicting + critical fields. Requires an overwrite. + + Return value: The [Customer][google.cloud.channel.v1.Customer]. + + Returns: + Callable[[~.ImportCustomerRequest], + ~.Customer]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'import_customer' not in self._stubs: + self._stubs['import_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ImportCustomer', + request_serializer=service.ImportCustomerRequest.serialize, + response_deserializer=customers.Customer.deserialize, + ) + return self._stubs['import_customer'] + + @property + def provision_cloud_identity(self) -> Callable[ + [service.ProvisionCloudIdentityRequest], + operations_pb2.Operation]: + r"""Return a callable for the provision cloud identity method over gRPC. + + Creates a Cloud Identity for the given customer using the + customer's information, or the information provided here. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer was not found. + - ALREADY_EXISTS: The customer's primary email already exists. + Retry after changing the customer's primary contact email. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + contains an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ProvisionCloudIdentityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'provision_cloud_identity' not in self._stubs: + self._stubs['provision_cloud_identity'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ProvisionCloudIdentity', + request_serializer=service.ProvisionCloudIdentityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['provision_cloud_identity'] + + @property + def list_entitlements(self) -> Callable[ + [service.ListEntitlementsRequest], + service.ListEntitlementsResponse]: + r"""Return a callable for the list entitlements method over gRPC. + + Lists [Entitlement][google.cloud.channel.v1.Entitlement]s + belonging to a customer. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: A list of the customer's + [Entitlement][google.cloud.channel.v1.Entitlement]s. + + Returns: + Callable[[~.ListEntitlementsRequest], + ~.ListEntitlementsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_entitlements' not in self._stubs: + self._stubs['list_entitlements'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListEntitlements', + request_serializer=service.ListEntitlementsRequest.serialize, + response_deserializer=service.ListEntitlementsResponse.deserialize, + ) + return self._stubs['list_entitlements'] + + @property + def list_transferable_skus(self) -> Callable[ + [service.ListTransferableSkusRequest], + service.ListTransferableSkusResponse]: + r"""Return a callable for the list transferable skus method over gRPC. + + List [TransferableSku][google.cloud.channel.v1.TransferableSku]s + of a customer based on the Cloud Identity ID or Customer Name in + the request. + + Use this method to list the entitlements information of an + unowned customer. You should provide the customer's Cloud + Identity ID or Customer Name. + + Possible error codes: + + - PERMISSION_DENIED: + + - The customer doesn't belong to the reseller and has no + auth token. + - The supplied auth token is invalid. + - The reseller account making the request is different from + the reseller account in the query. + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: A list of the customer's + [TransferableSku][google.cloud.channel.v1.TransferableSku]. + + Returns: + Callable[[~.ListTransferableSkusRequest], + ~.ListTransferableSkusResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_transferable_skus' not in self._stubs: + self._stubs['list_transferable_skus'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListTransferableSkus', + request_serializer=service.ListTransferableSkusRequest.serialize, + response_deserializer=service.ListTransferableSkusResponse.deserialize, + ) + return self._stubs['list_transferable_skus'] + + @property + def list_transferable_offers(self) -> Callable[ + [service.ListTransferableOffersRequest], + service.ListTransferableOffersResponse]: + r"""Return a callable for the list transferable offers method over gRPC. + + List + [TransferableOffer][google.cloud.channel.v1.TransferableOffer]s + of a customer based on Cloud Identity ID or Customer Name in the + request. + + Use this method when a reseller gets the entitlement information + of an unowned customer. The reseller should provide the + customer's Cloud Identity ID or Customer Name. + + Possible error codes: + + - PERMISSION_DENIED: + + - The customer doesn't belong to the reseller and has no + auth token. + - The customer provided incorrect reseller information when + generating auth token. + - The reseller account making the request is different from + the reseller account in the query. + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: List of + [TransferableOffer][google.cloud.channel.v1.TransferableOffer] + for the given customer and SKU. + + Returns: + Callable[[~.ListTransferableOffersRequest], + ~.ListTransferableOffersResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_transferable_offers' not in self._stubs: + self._stubs['list_transferable_offers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListTransferableOffers', + request_serializer=service.ListTransferableOffersRequest.serialize, + response_deserializer=service.ListTransferableOffersResponse.deserialize, + ) + return self._stubs['list_transferable_offers'] + + @property + def get_entitlement(self) -> Callable[ + [service.GetEntitlementRequest], + entitlements.Entitlement]: + r"""Return a callable for the get entitlement method over gRPC. + + Returns the requested + [Entitlement][google.cloud.channel.v1.Entitlement] resource. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer entitlement was not found. + + Return value: The requested + [Entitlement][google.cloud.channel.v1.Entitlement] resource. + + Returns: + Callable[[~.GetEntitlementRequest], + ~.Entitlement]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_entitlement' not in self._stubs: + self._stubs['get_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetEntitlement', + request_serializer=service.GetEntitlementRequest.serialize, + response_deserializer=entitlements.Entitlement.deserialize, + ) + return self._stubs['get_entitlement'] + + @property + def create_entitlement(self) -> Callable[ + [service.CreateEntitlementRequest], + operations_pb2.Operation]: + r"""Return a callable for the create entitlement method over gRPC. + + Creates an entitlement for a customer. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - There is already a customer entitlement for a SKU from the + same product family. + + - INVALID_VALUE: Make sure the OfferId is valid. If it is, + contact Google Channel support for further troubleshooting. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: + + - The SKU was already purchased for the customer. + - The customer's primary email already exists. Retry after + changing the customer's primary contact email. + + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The domain required for purchasing a SKU has not been + verified. + - A pre-requisite SKU required to purchase an Add-On SKU is + missing. For example, Google Workspace Business Starter is + required to purchase Vault or Drive. + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.CreateEntitlementRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_entitlement' not in self._stubs: + self._stubs['create_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateEntitlement', + request_serializer=service.CreateEntitlementRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_entitlement'] + + @property + def change_parameters(self) -> Callable[ + [service.ChangeParametersRequest], + operations_pb2.Operation]: + r"""Return a callable for the change parameters method over gRPC. + + Change parameters of the entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. For example, the number of seats being changed is + greater than the allowed number of max seats, or decreasing + seats for a commitment based plan. + - NOT_FOUND: Entitlement resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ChangeParametersRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'change_parameters' not in self._stubs: + self._stubs['change_parameters'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ChangeParameters', + request_serializer=service.ChangeParametersRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['change_parameters'] + + @property + def change_renewal_settings(self) -> Callable[ + [service.ChangeRenewalSettingsRequest], + operations_pb2.Operation]: + r"""Return a callable for the change renewal settings method over gRPC. + + Updates the renewal settings for an existing customer + entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for + a commitment plan. Can't enable or disable renewals for + non-commitment plans. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ChangeRenewalSettingsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'change_renewal_settings' not in self._stubs: + self._stubs['change_renewal_settings'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ChangeRenewalSettings', + request_serializer=service.ChangeRenewalSettingsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['change_renewal_settings'] + + @property + def change_offer(self) -> Callable[ + [service.ChangeOfferRequest], + operations_pb2.Operation]: + r"""Return a callable for the change offer method over gRPC. + + Updates the Offer for an existing customer entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Offer or Entitlement resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ChangeOfferRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'change_offer' not in self._stubs: + self._stubs['change_offer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ChangeOffer', + request_serializer=service.ChangeOfferRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['change_offer'] + + @property + def start_paid_service(self) -> Callable[ + [service.StartPaidServiceRequest], + operations_pb2.Operation]: + r"""Return a callable for the start paid service method over gRPC. + + Starts paid service for a trial entitlement. + + Starts paid service for a trial entitlement immediately. This + method is only applicable if a plan is set up for a trial + entitlement but has some trial days remaining. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for + entitlement on trial plans. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.StartPaidServiceRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'start_paid_service' not in self._stubs: + self._stubs['start_paid_service'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/StartPaidService', + request_serializer=service.StartPaidServiceRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['start_paid_service'] + + @property + def suspend_entitlement(self) -> Callable[ + [service.SuspendEntitlementRequest], + operations_pb2.Operation]: + r"""Return a callable for the suspend entitlement method over gRPC. + + Suspends a previously fulfilled entitlement. + + An entitlement suspension is a long-running operation. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - NOT_ACTIVE: Entitlement is not active. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.SuspendEntitlementRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'suspend_entitlement' not in self._stubs: + self._stubs['suspend_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/SuspendEntitlement', + request_serializer=service.SuspendEntitlementRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['suspend_entitlement'] + + @property + def cancel_entitlement(self) -> Callable[ + [service.CancelEntitlementRequest], + operations_pb2.Operation]: + r"""Return a callable for the cancel entitlement method over gRPC. + + Cancels a previously fulfilled entitlement. + + An entitlement cancellation is a long-running operation. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - FAILED_PRECONDITION: There are Google Cloud projects linked + to the Google Cloud entitlement's Cloud Billing subaccount. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google + Workspace add-ons, or entitlements for Google Cloud's + development platform. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The response will + contain google.protobuf.Empty on success. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.CancelEntitlementRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'cancel_entitlement' not in self._stubs: + self._stubs['cancel_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CancelEntitlement', + request_serializer=service.CancelEntitlementRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['cancel_entitlement'] + + @property + def activate_entitlement(self) -> Callable[ + [service.ActivateEntitlementRequest], + operations_pb2.Operation]: + r"""Return a callable for the activate entitlement method over gRPC. + + Activates a previously suspended entitlement. Entitlements + suspended for pending ToS acceptance can't be activated using + this method. + + An entitlement activation is a long-running operation and it + updates the state of the customer entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - SUSPENSION_NOT_RESELLER_INITIATED: Can only activate + reseller-initiated suspensions and entitlements that have + accepted the TOS. + - NOT_SUSPENDED: Can only activate suspended entitlements not + in an ACTIVE state. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ActivateEntitlementRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'activate_entitlement' not in self._stubs: + self._stubs['activate_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ActivateEntitlement', + request_serializer=service.ActivateEntitlementRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['activate_entitlement'] + + @property + def transfer_entitlements(self) -> Callable[ + [service.TransferEntitlementsRequest], + operations_pb2.Operation]: + r"""Return a callable for the transfer entitlements method over gRPC. + + Transfers customer entitlements to new reseller. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: The SKU was already transferred for the + customer. + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The SKU requires domain verification to transfer, but the + domain is not verified. + - An Add-On SKU (example, Vault or Drive) is missing the + pre-requisite SKU (example, G Suite Basic). + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - Specify all transferring entitlements. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.TransferEntitlementsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'transfer_entitlements' not in self._stubs: + self._stubs['transfer_entitlements'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/TransferEntitlements', + request_serializer=service.TransferEntitlementsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['transfer_entitlements'] + + @property + def transfer_entitlements_to_google(self) -> Callable[ + [service.TransferEntitlementsToGoogleRequest], + operations_pb2.Operation]: + r"""Return a callable for the transfer entitlements to + google method over gRPC. + + Transfers customer entitlements from their current reseller to + Google. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: The SKU was already transferred for the + customer. + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The SKU requires domain verification to transfer, but the + domain is not verified. + - An Add-On SKU (example, Vault or Drive) is missing the + pre-requisite SKU (example, G Suite Basic). + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The response will + contain google.protobuf.Empty on success. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.TransferEntitlementsToGoogleRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'transfer_entitlements_to_google' not in self._stubs: + self._stubs['transfer_entitlements_to_google'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/TransferEntitlementsToGoogle', + request_serializer=service.TransferEntitlementsToGoogleRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['transfer_entitlements_to_google'] + + @property + def list_channel_partner_links(self) -> Callable[ + [service.ListChannelPartnerLinksRequest], + service.ListChannelPartnerLinksResponse]: + r"""Return a callable for the list channel partner links method over gRPC. + + List + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s + belonging to a distributor. You must be a distributor to call + this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: The list of the distributor account's + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resources. + + Returns: + Callable[[~.ListChannelPartnerLinksRequest], + ~.ListChannelPartnerLinksResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_channel_partner_links' not in self._stubs: + self._stubs['list_channel_partner_links'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListChannelPartnerLinks', + request_serializer=service.ListChannelPartnerLinksRequest.serialize, + response_deserializer=service.ListChannelPartnerLinksResponse.deserialize, + ) + return self._stubs['list_channel_partner_links'] + + @property + def get_channel_partner_link(self) -> Callable[ + [service.GetChannelPartnerLinkRequest], + channel_partner_links.ChannelPartnerLink]: + r"""Return a callable for the get channel partner link method over gRPC. + + Returns the requested + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. You must be a distributor to call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: ChannelPartnerLink resource not found because of + an invalid channel partner link name. + + Return value: The + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + Returns: + Callable[[~.GetChannelPartnerLinkRequest], + ~.ChannelPartnerLink]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_channel_partner_link' not in self._stubs: + self._stubs['get_channel_partner_link'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetChannelPartnerLink', + request_serializer=service.GetChannelPartnerLinkRequest.serialize, + response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, + ) + return self._stubs['get_channel_partner_link'] + + @property + def create_channel_partner_link(self) -> Callable[ + [service.CreateChannelPartnerLinkRequest], + channel_partner_links.ChannelPartnerLink]: + r"""Return a callable for the create channel partner link method over gRPC. + + Initiates a channel partner link between a distributor and a + reseller, or between resellers in an n-tier reseller channel. + Invited partners need to follow the invite_link_uri provided in + the response to accept. After accepting the invitation, a link + is set up between the two parties. You must be a distributor to + call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - ALREADY_EXISTS: The ChannelPartnerLink sent in the request + already exists. + - NOT_FOUND: No Cloud Identity customer exists for provided + domain. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The new + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + Returns: + Callable[[~.CreateChannelPartnerLinkRequest], + ~.ChannelPartnerLink]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_channel_partner_link' not in self._stubs: + self._stubs['create_channel_partner_link'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerLink', + request_serializer=service.CreateChannelPartnerLinkRequest.serialize, + response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, + ) + return self._stubs['create_channel_partner_link'] + + @property + def update_channel_partner_link(self) -> Callable[ + [service.UpdateChannelPartnerLinkRequest], + channel_partner_links.ChannelPartnerLink]: + r"""Return a callable for the update channel partner link method over gRPC. + + Updates a channel partner link. Distributors call this method to + change a link's status. For example, to suspend a partner link. + You must be a distributor to call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - Link state cannot change from invited to active or + suspended. + - Cannot send reseller_cloud_identity_id, invite_url, or + name in update mask. + + - NOT_FOUND: ChannelPartnerLink resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The updated + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + Returns: + Callable[[~.UpdateChannelPartnerLinkRequest], + ~.ChannelPartnerLink]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_channel_partner_link' not in self._stubs: + self._stubs['update_channel_partner_link'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerLink', + request_serializer=service.UpdateChannelPartnerLinkRequest.serialize, + response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, + ) + return self._stubs['update_channel_partner_link'] + + @property + def get_customer_repricing_config(self) -> Callable[ + [service.GetCustomerRepricingConfigRequest], + repricing.CustomerRepricingConfig]: + r"""Return a callable for the get customer repricing config method over gRPC. + + Gets information about how a Reseller modifies their bill before + sending it to a Customer. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + was not found. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.GetCustomerRepricingConfigRequest], + ~.CustomerRepricingConfig]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_customer_repricing_config' not in self._stubs: + self._stubs['get_customer_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetCustomerRepricingConfig', + request_serializer=service.GetCustomerRepricingConfigRequest.serialize, + response_deserializer=repricing.CustomerRepricingConfig.deserialize, + ) + return self._stubs['get_customer_repricing_config'] + + @property + def list_customer_repricing_configs(self) -> Callable[ + [service.ListCustomerRepricingConfigsRequest], + service.ListCustomerRepricingConfigsResponse]: + r"""Return a callable for the list customer repricing + configs method over gRPC. + + Lists information about how a Reseller modifies their bill + before sending it to a Customer. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resources. The data for each resource is displayed in the + ascending order of: + + - customer ID + - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] + - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + - [CustomerRepricingConfig.update_time][google.cloud.channel.v1.CustomerRepricingConfig.update_time] + + If unsuccessful, returns an error. + + Returns: + Callable[[~.ListCustomerRepricingConfigsRequest], + ~.ListCustomerRepricingConfigsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_customer_repricing_configs' not in self._stubs: + self._stubs['list_customer_repricing_configs'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListCustomerRepricingConfigs', + request_serializer=service.ListCustomerRepricingConfigsRequest.serialize, + response_deserializer=service.ListCustomerRepricingConfigsResponse.deserialize, + ) + return self._stubs['list_customer_repricing_configs'] + + @property + def create_customer_repricing_config(self) -> Callable[ + [service.CreateCustomerRepricingConfigRequest], + repricing.CustomerRepricingConfig]: + r"""Return a callable for the create customer repricing + config method over gRPC. + + Creates a CustomerRepricingConfig. Call this method to set + modifications for a specific customer's bill. You can only + create configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. If needed, you can create a config for the + current month, with some restrictions. + + When creating a config for a future month, make sure there are + no existing configs for that + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + The following restrictions are for creating configs in the + current month. + + - This functionality is reserved for recovering from an + erroneous config, and should not be used for regular business + cases. + - The new config will not modify exports used with other + configs. Changes to the config may be immediate, but may take + up to 24 hours. + - There is a limit of ten configs for any + [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] + or + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + - The contained + [CustomerRepricingConfig.repricing_config][google.cloud.channel.v1.CustomerRepricingConfig.repricing_config] + vaule must be different from the value used in the current + config for a + [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement]. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.CreateCustomerRepricingConfigRequest], + ~.CustomerRepricingConfig]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_customer_repricing_config' not in self._stubs: + self._stubs['create_customer_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateCustomerRepricingConfig', + request_serializer=service.CreateCustomerRepricingConfigRequest.serialize, + response_deserializer=repricing.CustomerRepricingConfig.deserialize, + ) + return self._stubs['create_customer_repricing_config'] + + @property + def update_customer_repricing_config(self) -> Callable[ + [service.UpdateCustomerRepricingConfigRequest], + repricing.CustomerRepricingConfig]: + r"""Return a callable for the update customer repricing + config method over gRPC. + + Updates a CustomerRepricingConfig. Call this method to set + modifications for a specific customer's bill. This method + overwrites the existing CustomerRepricingConfig. + + You can only update configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. To make changes to configs for the current + month, use + [CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig], + taking note of its restrictions. You cannot update the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + When updating a config in the future: + + - This config must already exist. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.UpdateCustomerRepricingConfigRequest], + ~.CustomerRepricingConfig]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_customer_repricing_config' not in self._stubs: + self._stubs['update_customer_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UpdateCustomerRepricingConfig', + request_serializer=service.UpdateCustomerRepricingConfigRequest.serialize, + response_deserializer=repricing.CustomerRepricingConfig.deserialize, + ) + return self._stubs['update_customer_repricing_config'] + + @property + def delete_customer_repricing_config(self) -> Callable[ + [service.DeleteCustomerRepricingConfigRequest], + empty_pb2.Empty]: + r"""Return a callable for the delete customer repricing + config method over gRPC. + + Deletes the given + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + permanently. You can only delete configs if their + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is set to a date after the current month. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + is active or in the past. + - NOT_FOUND: No + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + found for the name in the request. + + Returns: + Callable[[~.DeleteCustomerRepricingConfigRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_customer_repricing_config' not in self._stubs: + self._stubs['delete_customer_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/DeleteCustomerRepricingConfig', + request_serializer=service.DeleteCustomerRepricingConfigRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['delete_customer_repricing_config'] + + @property + def get_channel_partner_repricing_config(self) -> Callable[ + [service.GetChannelPartnerRepricingConfigRequest], + repricing.ChannelPartnerRepricingConfig]: + r"""Return a callable for the get channel partner repricing + config method over gRPC. + + Gets information about how a Distributor modifies their bill + before sending it to a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + was not found. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.GetChannelPartnerRepricingConfigRequest], + ~.ChannelPartnerRepricingConfig]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_channel_partner_repricing_config' not in self._stubs: + self._stubs['get_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetChannelPartnerRepricingConfig', + request_serializer=service.GetChannelPartnerRepricingConfigRequest.serialize, + response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, + ) + return self._stubs['get_channel_partner_repricing_config'] + + @property + def list_channel_partner_repricing_configs(self) -> Callable[ + [service.ListChannelPartnerRepricingConfigsRequest], + service.ListChannelPartnerRepricingConfigsResponse]: + r"""Return a callable for the list channel partner repricing + configs method over gRPC. + + Lists information about how a Reseller modifies their bill + before sending it to a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resources. The data for each resource is displayed in the + ascending order of: + + - channel partner ID + - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + - [ChannelPartnerRepricingConfig.update_time][google.cloud.channel.v1.ChannelPartnerRepricingConfig.update_time] + + If unsuccessful, returns an error. + + Returns: + Callable[[~.ListChannelPartnerRepricingConfigsRequest], + ~.ListChannelPartnerRepricingConfigsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_channel_partner_repricing_configs' not in self._stubs: + self._stubs['list_channel_partner_repricing_configs'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListChannelPartnerRepricingConfigs', + request_serializer=service.ListChannelPartnerRepricingConfigsRequest.serialize, + response_deserializer=service.ListChannelPartnerRepricingConfigsResponse.deserialize, + ) + return self._stubs['list_channel_partner_repricing_configs'] + + @property + def create_channel_partner_repricing_config(self) -> Callable[ + [service.CreateChannelPartnerRepricingConfigRequest], + repricing.ChannelPartnerRepricingConfig]: + r"""Return a callable for the create channel partner + repricing config method over gRPC. + + Creates a ChannelPartnerRepricingConfig. Call this method to set + modifications for a specific ChannelPartner's bill. You can only + create configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. If needed, you can create a config for the + current month, with some restrictions. + + When creating a config for a future month, make sure there are + no existing configs for that + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + The following restrictions are for creating configs in the + current month. + + - This functionality is reserved for recovering from an + erroneous config, and should not be used for regular business + cases. + - The new config will not modify exports used with other + configs. Changes to the config may be immediate, but may take + up to 24 hours. + - There is a limit of ten configs for any ChannelPartner or + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + - The contained + [ChannelPartnerRepricingConfig.repricing_config][google.cloud.channel.v1.ChannelPartnerRepricingConfig.repricing_config] + vaule must be different from the value used in the current + config for a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.CreateChannelPartnerRepricingConfigRequest], + ~.ChannelPartnerRepricingConfig]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_channel_partner_repricing_config' not in self._stubs: + self._stubs['create_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerRepricingConfig', + request_serializer=service.CreateChannelPartnerRepricingConfigRequest.serialize, + response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, + ) + return self._stubs['create_channel_partner_repricing_config'] + + @property + def update_channel_partner_repricing_config(self) -> Callable[ + [service.UpdateChannelPartnerRepricingConfigRequest], + repricing.ChannelPartnerRepricingConfig]: + r"""Return a callable for the update channel partner + repricing config method over gRPC. + + Updates a ChannelPartnerRepricingConfig. Call this method to set + modifications for a specific ChannelPartner's bill. This method + overwrites the existing CustomerRepricingConfig. + + You can only update configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. To make changes to configs for the current + month, use + [CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig], + taking note of its restrictions. You cannot update the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + When updating a config in the future: + + - This config must already exist. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.UpdateChannelPartnerRepricingConfigRequest], + ~.ChannelPartnerRepricingConfig]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_channel_partner_repricing_config' not in self._stubs: + self._stubs['update_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerRepricingConfig', + request_serializer=service.UpdateChannelPartnerRepricingConfigRequest.serialize, + response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, + ) + return self._stubs['update_channel_partner_repricing_config'] + + @property + def delete_channel_partner_repricing_config(self) -> Callable[ + [service.DeleteChannelPartnerRepricingConfigRequest], + empty_pb2.Empty]: + r"""Return a callable for the delete channel partner + repricing config method over gRPC. + + Deletes the given + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + permanently. You can only delete configs if their + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is set to a date after the current month. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + is active or in the past. + - NOT_FOUND: No + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + found for the name in the request. + + Returns: + Callable[[~.DeleteChannelPartnerRepricingConfigRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_channel_partner_repricing_config' not in self._stubs: + self._stubs['delete_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/DeleteChannelPartnerRepricingConfig', + request_serializer=service.DeleteChannelPartnerRepricingConfigRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['delete_channel_partner_repricing_config'] + + @property + def lookup_offer(self) -> Callable[ + [service.LookupOfferRequest], + offers.Offer]: + r"""Return a callable for the lookup offer method over gRPC. + + Returns the requested [Offer][google.cloud.channel.v1.Offer] + resource. + + Possible error codes: + + - PERMISSION_DENIED: The entitlement doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement or offer was not found. + + Return value: The [Offer][google.cloud.channel.v1.Offer] + resource. + + Returns: + Callable[[~.LookupOfferRequest], + ~.Offer]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'lookup_offer' not in self._stubs: + self._stubs['lookup_offer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/LookupOffer', + request_serializer=service.LookupOfferRequest.serialize, + response_deserializer=offers.Offer.deserialize, + ) + return self._stubs['lookup_offer'] + + @property + def list_products(self) -> Callable[ + [service.ListProductsRequest], + service.ListProductsResponse]: + r"""Return a callable for the list products method over gRPC. + + Lists the Products the reseller is authorized to sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListProductsRequest], + ~.ListProductsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_products' not in self._stubs: + self._stubs['list_products'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListProducts', + request_serializer=service.ListProductsRequest.serialize, + response_deserializer=service.ListProductsResponse.deserialize, + ) + return self._stubs['list_products'] + + @property + def list_skus(self) -> Callable[ + [service.ListSkusRequest], + service.ListSkusResponse]: + r"""Return a callable for the list skus method over gRPC. + + Lists the SKUs for a product the reseller is authorized to sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListSkusRequest], + ~.ListSkusResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_skus' not in self._stubs: + self._stubs['list_skus'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListSkus', + request_serializer=service.ListSkusRequest.serialize, + response_deserializer=service.ListSkusResponse.deserialize, + ) + return self._stubs['list_skus'] + + @property + def list_offers(self) -> Callable[ + [service.ListOffersRequest], + service.ListOffersResponse]: + r"""Return a callable for the list offers method over gRPC. + + Lists the Offers the reseller can sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListOffersRequest], + ~.ListOffersResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_offers' not in self._stubs: + self._stubs['list_offers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListOffers', + request_serializer=service.ListOffersRequest.serialize, + response_deserializer=service.ListOffersResponse.deserialize, + ) + return self._stubs['list_offers'] + + @property + def list_purchasable_skus(self) -> Callable[ + [service.ListPurchasableSkusRequest], + service.ListPurchasableSkusResponse]: + r"""Return a callable for the list purchasable skus method over gRPC. + + Lists the following: + + - SKUs that you can purchase for a customer + - SKUs that you can upgrade or downgrade for an entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListPurchasableSkusRequest], + ~.ListPurchasableSkusResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_purchasable_skus' not in self._stubs: + self._stubs['list_purchasable_skus'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListPurchasableSkus', + request_serializer=service.ListPurchasableSkusRequest.serialize, + response_deserializer=service.ListPurchasableSkusResponse.deserialize, + ) + return self._stubs['list_purchasable_skus'] + + @property + def list_purchasable_offers(self) -> Callable[ + [service.ListPurchasableOffersRequest], + service.ListPurchasableOffersResponse]: + r"""Return a callable for the list purchasable offers method over gRPC. + + Lists the following: + + - Offers that you can purchase for a customer. + - Offers that you can change for an entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListPurchasableOffersRequest], + ~.ListPurchasableOffersResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_purchasable_offers' not in self._stubs: + self._stubs['list_purchasable_offers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListPurchasableOffers', + request_serializer=service.ListPurchasableOffersRequest.serialize, + response_deserializer=service.ListPurchasableOffersResponse.deserialize, + ) + return self._stubs['list_purchasable_offers'] + + @property + def register_subscriber(self) -> Callable[ + [service.RegisterSubscriberRequest], + service.RegisterSubscriberResponse]: + r"""Return a callable for the register subscriber method over gRPC. + + Registers a service account with subscriber privileges on the + Cloud Pub/Sub topic for this Channel Services account. After you + create a subscriber, you get the events through + [SubscriberEvent][google.cloud.channel.v1.SubscriberEvent] + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The topic name with the registered service email + address. + + Returns: + Callable[[~.RegisterSubscriberRequest], + ~.RegisterSubscriberResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'register_subscriber' not in self._stubs: + self._stubs['register_subscriber'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/RegisterSubscriber', + request_serializer=service.RegisterSubscriberRequest.serialize, + response_deserializer=service.RegisterSubscriberResponse.deserialize, + ) + return self._stubs['register_subscriber'] + + @property + def unregister_subscriber(self) -> Callable[ + [service.UnregisterSubscriberRequest], + service.UnregisterSubscriberResponse]: + r"""Return a callable for the unregister subscriber method over gRPC. + + Unregisters a service account with subscriber privileges on the + Cloud Pub/Sub topic created for this Channel Services account. + If there are no service accounts left with subscriber + privileges, this deletes the topic. You can call ListSubscribers + to check for these accounts. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The topic resource doesn't exist. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The topic name that unregistered the service email + address. Returns a success response if the service email address + wasn't registered with the topic. + + Returns: + Callable[[~.UnregisterSubscriberRequest], + ~.UnregisterSubscriberResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'unregister_subscriber' not in self._stubs: + self._stubs['unregister_subscriber'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UnregisterSubscriber', + request_serializer=service.UnregisterSubscriberRequest.serialize, + response_deserializer=service.UnregisterSubscriberResponse.deserialize, + ) + return self._stubs['unregister_subscriber'] + + @property + def list_subscribers(self) -> Callable[ + [service.ListSubscribersRequest], + service.ListSubscribersResponse]: + r"""Return a callable for the list subscribers method over gRPC. + + Lists service accounts with subscriber privileges on the Cloud + Pub/Sub topic created for this Channel Services account. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The topic resource doesn't exist. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: A list of service email addresses. + + Returns: + Callable[[~.ListSubscribersRequest], + ~.ListSubscribersResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_subscribers' not in self._stubs: + self._stubs['list_subscribers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListSubscribers', + request_serializer=service.ListSubscribersRequest.serialize, + response_deserializer=service.ListSubscribersResponse.deserialize, + ) + return self._stubs['list_subscribers'] + + def close(self): + self.grpc_channel.close() + + @property + def delete_operation( + self, + ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: + r"""Return a callable for the delete_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_operation" not in self._stubs: + self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/DeleteOperation", + request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["delete_operation"] + + @property + def cancel_operation( + self, + ) -> Callable[[operations_pb2.CancelOperationRequest], None]: + r"""Return a callable for the cancel_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_operation" not in self._stubs: + self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def get_operation( + self, + ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: + r"""Return a callable for the get_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_operation" not in self._stubs: + self._stubs["get_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/GetOperation", + request_serializer=operations_pb2.GetOperationRequest.SerializeToString, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["get_operation"] + + @property + def list_operations( + self, + ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: + r"""Return a callable for the list_operations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_operations" not in self._stubs: + self._stubs["list_operations"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/ListOperations", + request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, + response_deserializer=operations_pb2.ListOperationsResponse.FromString, + ) + return self._stubs["list_operations"] + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ( + 'CloudChannelServiceGrpcTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py new file mode 100644 index 0000000..01da4aa --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py @@ -0,0 +1,2458 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.channel_v1.types import channel_partner_links +from google.cloud.channel_v1.types import customers +from google.cloud.channel_v1.types import entitlements +from google.cloud.channel_v1.types import offers +from google.cloud.channel_v1.types import repricing +from google.cloud.channel_v1.types import service +from google.longrunning import operations_pb2 +from google.longrunning import operations_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore +from .base import CloudChannelServiceTransport, DEFAULT_CLIENT_INFO +from .grpc import CloudChannelServiceGrpcTransport + + +class CloudChannelServiceGrpcAsyncIOTransport(CloudChannelServiceTransport): + """gRPC AsyncIO backend transport for CloudChannelService. + + CloudChannelService lets Google cloud resellers and distributors + manage their customers, channel partners, entitlements, and reports. + + Using this service: + + 1. Resellers and distributors can manage a customer entity. + 2. Distributors can register an authorized reseller in their channel + and provide them with delegated admin access. + 3. Resellers and distributors can manage customer entitlements. + + CloudChannelService exposes the following resources: + + - [Customer][google.cloud.channel.v1.Customer]s: An entity—usually + an enterprise—managed by a reseller or distributor. + + - [Entitlement][google.cloud.channel.v1.Entitlement]s: An entity + that provides a customer with the means to use a service. + Entitlements are created or updated as a result of a successful + fulfillment. + + - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s: + An entity that identifies links between distributors and their + indirect resellers in a channel. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel(cls, + host: str = 'cloudchannel.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + def __init__(self, *, + host: str = 'cloudchannel.googleapis.com', + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + self._ssl_channel_credentials = None + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def list_customers(self) -> Callable[ + [service.ListCustomersRequest], + Awaitable[service.ListCustomersResponse]]: + r"""Return a callable for the list customers method over gRPC. + + List [Customer][google.cloud.channel.v1.Customer]s. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: List of + [Customer][google.cloud.channel.v1.Customer]s, or an empty list + if there are no customers. + + Returns: + Callable[[~.ListCustomersRequest], + Awaitable[~.ListCustomersResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_customers' not in self._stubs: + self._stubs['list_customers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListCustomers', + request_serializer=service.ListCustomersRequest.serialize, + response_deserializer=service.ListCustomersResponse.deserialize, + ) + return self._stubs['list_customers'] + + @property + def get_customer(self) -> Callable[ + [service.GetCustomerRequest], + Awaitable[customers.Customer]]: + r"""Return a callable for the get customer method over gRPC. + + Returns the requested + [Customer][google.cloud.channel.v1.Customer] resource. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer resource doesn't exist. Usually the + result of an invalid name parameter. + + Return value: The [Customer][google.cloud.channel.v1.Customer] + resource. + + Returns: + Callable[[~.GetCustomerRequest], + Awaitable[~.Customer]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_customer' not in self._stubs: + self._stubs['get_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetCustomer', + request_serializer=service.GetCustomerRequest.serialize, + response_deserializer=customers.Customer.deserialize, + ) + return self._stubs['get_customer'] + + @property + def check_cloud_identity_accounts_exist(self) -> Callable[ + [service.CheckCloudIdentityAccountsExistRequest], + Awaitable[service.CheckCloudIdentityAccountsExistResponse]]: + r"""Return a callable for the check cloud identity accounts + exist method over gRPC. + + Confirms the existence of Cloud Identity accounts based on the + domain and if the Cloud Identity accounts are owned by the + reseller. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - INVALID_VALUE: Invalid domain value in the request. + + Return value: A list of + [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] + resources for the domain (may be empty) + + Note: in the v1alpha1 version of the API, a NOT_FOUND error + returns if no + [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] + resources match the domain. + + Returns: + Callable[[~.CheckCloudIdentityAccountsExistRequest], + Awaitable[~.CheckCloudIdentityAccountsExistResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'check_cloud_identity_accounts_exist' not in self._stubs: + self._stubs['check_cloud_identity_accounts_exist'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CheckCloudIdentityAccountsExist', + request_serializer=service.CheckCloudIdentityAccountsExistRequest.serialize, + response_deserializer=service.CheckCloudIdentityAccountsExistResponse.deserialize, + ) + return self._stubs['check_cloud_identity_accounts_exist'] + + @property + def create_customer(self) -> Callable[ + [service.CreateCustomerRequest], + Awaitable[customers.Customer]]: + r"""Return a callable for the create customer method over gRPC. + + Creates a new [Customer][google.cloud.channel.v1.Customer] + resource under the reseller or distributor account. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - Domain field value doesn't match the primary email domain. + + Return value: The newly created + [Customer][google.cloud.channel.v1.Customer] resource. + + Returns: + Callable[[~.CreateCustomerRequest], + Awaitable[~.Customer]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_customer' not in self._stubs: + self._stubs['create_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateCustomer', + request_serializer=service.CreateCustomerRequest.serialize, + response_deserializer=customers.Customer.deserialize, + ) + return self._stubs['create_customer'] + + @property + def update_customer(self) -> Callable[ + [service.UpdateCustomerRequest], + Awaitable[customers.Customer]]: + r"""Return a callable for the update customer method over gRPC. + + Updates an existing [Customer][google.cloud.channel.v1.Customer] + resource for the reseller or distributor. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] + resource found for the name in the request. + + Return value: The updated + [Customer][google.cloud.channel.v1.Customer] resource. + + Returns: + Callable[[~.UpdateCustomerRequest], + Awaitable[~.Customer]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_customer' not in self._stubs: + self._stubs['update_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UpdateCustomer', + request_serializer=service.UpdateCustomerRequest.serialize, + response_deserializer=customers.Customer.deserialize, + ) + return self._stubs['update_customer'] + + @property + def delete_customer(self) -> Callable[ + [service.DeleteCustomerRequest], + Awaitable[empty_pb2.Empty]]: + r"""Return a callable for the delete customer method over gRPC. + + Deletes the given [Customer][google.cloud.channel.v1.Customer] + permanently. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The customer has existing entitlements. + - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] + resource found for the name in the request. + + Returns: + Callable[[~.DeleteCustomerRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_customer' not in self._stubs: + self._stubs['delete_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/DeleteCustomer', + request_serializer=service.DeleteCustomerRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['delete_customer'] + + @property + def import_customer(self) -> Callable[ + [service.ImportCustomerRequest], + Awaitable[customers.Customer]]: + r"""Return a callable for the import customer method over gRPC. + + Imports a [Customer][google.cloud.channel.v1.Customer] from the + Cloud Identity associated with the provided Cloud Identity ID or + domain before a TransferEntitlements call. If a linked Customer + already exists and overwrite_if_exists is true, it will update + that Customer's data. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - NOT_FOUND: Cloud Identity doesn't exist or was deleted. + - INVALID_ARGUMENT: Required parameters are missing, or the + auth_token is expired or invalid. + - ALREADY_EXISTS: A customer already exists and has conflicting + critical fields. Requires an overwrite. + + Return value: The [Customer][google.cloud.channel.v1.Customer]. + + Returns: + Callable[[~.ImportCustomerRequest], + Awaitable[~.Customer]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'import_customer' not in self._stubs: + self._stubs['import_customer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ImportCustomer', + request_serializer=service.ImportCustomerRequest.serialize, + response_deserializer=customers.Customer.deserialize, + ) + return self._stubs['import_customer'] + + @property + def provision_cloud_identity(self) -> Callable[ + [service.ProvisionCloudIdentityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the provision cloud identity method over gRPC. + + Creates a Cloud Identity for the given customer using the + customer's information, or the information provided here. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer was not found. + - ALREADY_EXISTS: The customer's primary email already exists. + Retry after changing the customer's primary contact email. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + contains an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ProvisionCloudIdentityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'provision_cloud_identity' not in self._stubs: + self._stubs['provision_cloud_identity'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ProvisionCloudIdentity', + request_serializer=service.ProvisionCloudIdentityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['provision_cloud_identity'] + + @property + def list_entitlements(self) -> Callable[ + [service.ListEntitlementsRequest], + Awaitable[service.ListEntitlementsResponse]]: + r"""Return a callable for the list entitlements method over gRPC. + + Lists [Entitlement][google.cloud.channel.v1.Entitlement]s + belonging to a customer. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: A list of the customer's + [Entitlement][google.cloud.channel.v1.Entitlement]s. + + Returns: + Callable[[~.ListEntitlementsRequest], + Awaitable[~.ListEntitlementsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_entitlements' not in self._stubs: + self._stubs['list_entitlements'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListEntitlements', + request_serializer=service.ListEntitlementsRequest.serialize, + response_deserializer=service.ListEntitlementsResponse.deserialize, + ) + return self._stubs['list_entitlements'] + + @property + def list_transferable_skus(self) -> Callable[ + [service.ListTransferableSkusRequest], + Awaitable[service.ListTransferableSkusResponse]]: + r"""Return a callable for the list transferable skus method over gRPC. + + List [TransferableSku][google.cloud.channel.v1.TransferableSku]s + of a customer based on the Cloud Identity ID or Customer Name in + the request. + + Use this method to list the entitlements information of an + unowned customer. You should provide the customer's Cloud + Identity ID or Customer Name. + + Possible error codes: + + - PERMISSION_DENIED: + + - The customer doesn't belong to the reseller and has no + auth token. + - The supplied auth token is invalid. + - The reseller account making the request is different from + the reseller account in the query. + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: A list of the customer's + [TransferableSku][google.cloud.channel.v1.TransferableSku]. + + Returns: + Callable[[~.ListTransferableSkusRequest], + Awaitable[~.ListTransferableSkusResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_transferable_skus' not in self._stubs: + self._stubs['list_transferable_skus'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListTransferableSkus', + request_serializer=service.ListTransferableSkusRequest.serialize, + response_deserializer=service.ListTransferableSkusResponse.deserialize, + ) + return self._stubs['list_transferable_skus'] + + @property + def list_transferable_offers(self) -> Callable[ + [service.ListTransferableOffersRequest], + Awaitable[service.ListTransferableOffersResponse]]: + r"""Return a callable for the list transferable offers method over gRPC. + + List + [TransferableOffer][google.cloud.channel.v1.TransferableOffer]s + of a customer based on Cloud Identity ID or Customer Name in the + request. + + Use this method when a reseller gets the entitlement information + of an unowned customer. The reseller should provide the + customer's Cloud Identity ID or Customer Name. + + Possible error codes: + + - PERMISSION_DENIED: + + - The customer doesn't belong to the reseller and has no + auth token. + - The customer provided incorrect reseller information when + generating auth token. + - The reseller account making the request is different from + the reseller account in the query. + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: List of + [TransferableOffer][google.cloud.channel.v1.TransferableOffer] + for the given customer and SKU. + + Returns: + Callable[[~.ListTransferableOffersRequest], + Awaitable[~.ListTransferableOffersResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_transferable_offers' not in self._stubs: + self._stubs['list_transferable_offers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListTransferableOffers', + request_serializer=service.ListTransferableOffersRequest.serialize, + response_deserializer=service.ListTransferableOffersResponse.deserialize, + ) + return self._stubs['list_transferable_offers'] + + @property + def get_entitlement(self) -> Callable[ + [service.GetEntitlementRequest], + Awaitable[entitlements.Entitlement]]: + r"""Return a callable for the get entitlement method over gRPC. + + Returns the requested + [Entitlement][google.cloud.channel.v1.Entitlement] resource. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer entitlement was not found. + + Return value: The requested + [Entitlement][google.cloud.channel.v1.Entitlement] resource. + + Returns: + Callable[[~.GetEntitlementRequest], + Awaitable[~.Entitlement]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_entitlement' not in self._stubs: + self._stubs['get_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetEntitlement', + request_serializer=service.GetEntitlementRequest.serialize, + response_deserializer=entitlements.Entitlement.deserialize, + ) + return self._stubs['get_entitlement'] + + @property + def create_entitlement(self) -> Callable[ + [service.CreateEntitlementRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create entitlement method over gRPC. + + Creates an entitlement for a customer. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - There is already a customer entitlement for a SKU from the + same product family. + + - INVALID_VALUE: Make sure the OfferId is valid. If it is, + contact Google Channel support for further troubleshooting. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: + + - The SKU was already purchased for the customer. + - The customer's primary email already exists. Retry after + changing the customer's primary contact email. + + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The domain required for purchasing a SKU has not been + verified. + - A pre-requisite SKU required to purchase an Add-On SKU is + missing. For example, Google Workspace Business Starter is + required to purchase Vault or Drive. + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.CreateEntitlementRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_entitlement' not in self._stubs: + self._stubs['create_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateEntitlement', + request_serializer=service.CreateEntitlementRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['create_entitlement'] + + @property + def change_parameters(self) -> Callable[ + [service.ChangeParametersRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the change parameters method over gRPC. + + Change parameters of the entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. For example, the number of seats being changed is + greater than the allowed number of max seats, or decreasing + seats for a commitment based plan. + - NOT_FOUND: Entitlement resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ChangeParametersRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'change_parameters' not in self._stubs: + self._stubs['change_parameters'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ChangeParameters', + request_serializer=service.ChangeParametersRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['change_parameters'] + + @property + def change_renewal_settings(self) -> Callable[ + [service.ChangeRenewalSettingsRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the change renewal settings method over gRPC. + + Updates the renewal settings for an existing customer + entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for + a commitment plan. Can't enable or disable renewals for + non-commitment plans. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ChangeRenewalSettingsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'change_renewal_settings' not in self._stubs: + self._stubs['change_renewal_settings'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ChangeRenewalSettings', + request_serializer=service.ChangeRenewalSettingsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['change_renewal_settings'] + + @property + def change_offer(self) -> Callable[ + [service.ChangeOfferRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the change offer method over gRPC. + + Updates the Offer for an existing customer entitlement. + + An entitlement update is a long-running operation and it updates + the entitlement as a result of fulfillment. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Offer or Entitlement resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ChangeOfferRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'change_offer' not in self._stubs: + self._stubs['change_offer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ChangeOffer', + request_serializer=service.ChangeOfferRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['change_offer'] + + @property + def start_paid_service(self) -> Callable[ + [service.StartPaidServiceRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the start paid service method over gRPC. + + Starts paid service for a trial entitlement. + + Starts paid service for a trial entitlement immediately. This + method is only applicable if a plan is set up for a trial + entitlement but has some trial days remaining. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for + entitlement on trial plans. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.StartPaidServiceRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'start_paid_service' not in self._stubs: + self._stubs['start_paid_service'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/StartPaidService', + request_serializer=service.StartPaidServiceRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['start_paid_service'] + + @property + def suspend_entitlement(self) -> Callable[ + [service.SuspendEntitlementRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the suspend entitlement method over gRPC. + + Suspends a previously fulfilled entitlement. + + An entitlement suspension is a long-running operation. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - NOT_ACTIVE: Entitlement is not active. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.SuspendEntitlementRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'suspend_entitlement' not in self._stubs: + self._stubs['suspend_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/SuspendEntitlement', + request_serializer=service.SuspendEntitlementRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['suspend_entitlement'] + + @property + def cancel_entitlement(self) -> Callable[ + [service.CancelEntitlementRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the cancel entitlement method over gRPC. + + Cancels a previously fulfilled entitlement. + + An entitlement cancellation is a long-running operation. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - FAILED_PRECONDITION: There are Google Cloud projects linked + to the Google Cloud entitlement's Cloud Billing subaccount. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google + Workspace add-ons, or entitlements for Google Cloud's + development platform. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The response will + contain google.protobuf.Empty on success. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.CancelEntitlementRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'cancel_entitlement' not in self._stubs: + self._stubs['cancel_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CancelEntitlement', + request_serializer=service.CancelEntitlementRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['cancel_entitlement'] + + @property + def activate_entitlement(self) -> Callable[ + [service.ActivateEntitlementRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the activate entitlement method over gRPC. + + Activates a previously suspended entitlement. Entitlements + suspended for pending ToS acceptance can't be activated using + this method. + + An entitlement activation is a long-running operation and it + updates the state of the customer entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement resource not found. + - SUSPENSION_NOT_RESELLER_INITIATED: Can only activate + reseller-initiated suspensions and entitlements that have + accepted the TOS. + - NOT_SUSPENDED: Can only activate suspended entitlements not + in an ACTIVE state. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.ActivateEntitlementRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'activate_entitlement' not in self._stubs: + self._stubs['activate_entitlement'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ActivateEntitlement', + request_serializer=service.ActivateEntitlementRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['activate_entitlement'] + + @property + def transfer_entitlements(self) -> Callable[ + [service.TransferEntitlementsRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the transfer entitlements method over gRPC. + + Transfers customer entitlements to new reseller. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: The SKU was already transferred for the + customer. + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The SKU requires domain verification to transfer, but the + domain is not verified. + - An Add-On SKU (example, Vault or Drive) is missing the + pre-requisite SKU (example, G Suite Basic). + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - Specify all transferring entitlements. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.TransferEntitlementsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'transfer_entitlements' not in self._stubs: + self._stubs['transfer_entitlements'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/TransferEntitlements', + request_serializer=service.TransferEntitlementsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['transfer_entitlements'] + + @property + def transfer_entitlements_to_google(self) -> Callable[ + [service.TransferEntitlementsToGoogleRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the transfer entitlements to + google method over gRPC. + + Transfers customer entitlements from their current reseller to + Google. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The customer or offer resource was not found. + - ALREADY_EXISTS: The SKU was already transferred for the + customer. + - CONDITION_NOT_MET or FAILED_PRECONDITION: + + - The SKU requires domain verification to transfer, but the + domain is not verified. + - An Add-On SKU (example, Vault or Drive) is missing the + pre-requisite SKU (example, G Suite Basic). + - (Developer accounts only) Reseller and resold domain must + meet the following naming requirements: + + - Domain names must start with goog-test. + - Domain names must include the reseller domain. + + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The ID of a long-running operation. + + To get the results of the operation, call the GetOperation + method of CloudChannelOperationsService. The response will + contain google.protobuf.Empty on success. The Operation metadata + will contain an instance of + [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. + + Returns: + Callable[[~.TransferEntitlementsToGoogleRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'transfer_entitlements_to_google' not in self._stubs: + self._stubs['transfer_entitlements_to_google'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/TransferEntitlementsToGoogle', + request_serializer=service.TransferEntitlementsToGoogleRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['transfer_entitlements_to_google'] + + @property + def list_channel_partner_links(self) -> Callable[ + [service.ListChannelPartnerLinksRequest], + Awaitable[service.ListChannelPartnerLinksResponse]]: + r"""Return a callable for the list channel partner links method over gRPC. + + List + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s + belonging to a distributor. You must be a distributor to call + this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Return value: The list of the distributor account's + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resources. + + Returns: + Callable[[~.ListChannelPartnerLinksRequest], + Awaitable[~.ListChannelPartnerLinksResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_channel_partner_links' not in self._stubs: + self._stubs['list_channel_partner_links'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListChannelPartnerLinks', + request_serializer=service.ListChannelPartnerLinksRequest.serialize, + response_deserializer=service.ListChannelPartnerLinksResponse.deserialize, + ) + return self._stubs['list_channel_partner_links'] + + @property + def get_channel_partner_link(self) -> Callable[ + [service.GetChannelPartnerLinkRequest], + Awaitable[channel_partner_links.ChannelPartnerLink]]: + r"""Return a callable for the get channel partner link method over gRPC. + + Returns the requested + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. You must be a distributor to call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: ChannelPartnerLink resource not found because of + an invalid channel partner link name. + + Return value: The + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + Returns: + Callable[[~.GetChannelPartnerLinkRequest], + Awaitable[~.ChannelPartnerLink]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_channel_partner_link' not in self._stubs: + self._stubs['get_channel_partner_link'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetChannelPartnerLink', + request_serializer=service.GetChannelPartnerLinkRequest.serialize, + response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, + ) + return self._stubs['get_channel_partner_link'] + + @property + def create_channel_partner_link(self) -> Callable[ + [service.CreateChannelPartnerLinkRequest], + Awaitable[channel_partner_links.ChannelPartnerLink]]: + r"""Return a callable for the create channel partner link method over gRPC. + + Initiates a channel partner link between a distributor and a + reseller, or between resellers in an n-tier reseller channel. + Invited partners need to follow the invite_link_uri provided in + the response to accept. After accepting the invitation, a link + is set up between the two parties. You must be a distributor to + call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - ALREADY_EXISTS: The ChannelPartnerLink sent in the request + already exists. + - NOT_FOUND: No Cloud Identity customer exists for provided + domain. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The new + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + Returns: + Callable[[~.CreateChannelPartnerLinkRequest], + Awaitable[~.ChannelPartnerLink]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_channel_partner_link' not in self._stubs: + self._stubs['create_channel_partner_link'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerLink', + request_serializer=service.CreateChannelPartnerLinkRequest.serialize, + response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, + ) + return self._stubs['create_channel_partner_link'] + + @property + def update_channel_partner_link(self) -> Callable[ + [service.UpdateChannelPartnerLinkRequest], + Awaitable[channel_partner_links.ChannelPartnerLink]]: + r"""Return a callable for the update channel partner link method over gRPC. + + Updates a channel partner link. Distributors call this method to + change a link's status. For example, to suspend a partner link. + You must be a distributor to call this method. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request is + different from the reseller account in the API request. + - INVALID_ARGUMENT: + + - Required request parameters are missing or invalid. + - Link state cannot change from invited to active or + suspended. + - Cannot send reseller_cloud_identity_id, invite_url, or + name in update mask. + + - NOT_FOUND: ChannelPartnerLink resource not found. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The updated + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + resource. + + Returns: + Callable[[~.UpdateChannelPartnerLinkRequest], + Awaitable[~.ChannelPartnerLink]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_channel_partner_link' not in self._stubs: + self._stubs['update_channel_partner_link'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerLink', + request_serializer=service.UpdateChannelPartnerLinkRequest.serialize, + response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, + ) + return self._stubs['update_channel_partner_link'] + + @property + def get_customer_repricing_config(self) -> Callable[ + [service.GetCustomerRepricingConfigRequest], + Awaitable[repricing.CustomerRepricingConfig]]: + r"""Return a callable for the get customer repricing config method over gRPC. + + Gets information about how a Reseller modifies their bill before + sending it to a Customer. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + was not found. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.GetCustomerRepricingConfigRequest], + Awaitable[~.CustomerRepricingConfig]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_customer_repricing_config' not in self._stubs: + self._stubs['get_customer_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetCustomerRepricingConfig', + request_serializer=service.GetCustomerRepricingConfigRequest.serialize, + response_deserializer=repricing.CustomerRepricingConfig.deserialize, + ) + return self._stubs['get_customer_repricing_config'] + + @property + def list_customer_repricing_configs(self) -> Callable[ + [service.ListCustomerRepricingConfigsRequest], + Awaitable[service.ListCustomerRepricingConfigsResponse]]: + r"""Return a callable for the list customer repricing + configs method over gRPC. + + Lists information about how a Reseller modifies their bill + before sending it to a Customer. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resources. The data for each resource is displayed in the + ascending order of: + + - customer ID + - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] + - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + - [CustomerRepricingConfig.update_time][google.cloud.channel.v1.CustomerRepricingConfig.update_time] + + If unsuccessful, returns an error. + + Returns: + Callable[[~.ListCustomerRepricingConfigsRequest], + Awaitable[~.ListCustomerRepricingConfigsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_customer_repricing_configs' not in self._stubs: + self._stubs['list_customer_repricing_configs'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListCustomerRepricingConfigs', + request_serializer=service.ListCustomerRepricingConfigsRequest.serialize, + response_deserializer=service.ListCustomerRepricingConfigsResponse.deserialize, + ) + return self._stubs['list_customer_repricing_configs'] + + @property + def create_customer_repricing_config(self) -> Callable[ + [service.CreateCustomerRepricingConfigRequest], + Awaitable[repricing.CustomerRepricingConfig]]: + r"""Return a callable for the create customer repricing + config method over gRPC. + + Creates a CustomerRepricingConfig. Call this method to set + modifications for a specific customer's bill. You can only + create configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. If needed, you can create a config for the + current month, with some restrictions. + + When creating a config for a future month, make sure there are + no existing configs for that + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + The following restrictions are for creating configs in the + current month. + + - This functionality is reserved for recovering from an + erroneous config, and should not be used for regular business + cases. + - The new config will not modify exports used with other + configs. Changes to the config may be immediate, but may take + up to 24 hours. + - There is a limit of ten configs for any + [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] + or + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + - The contained + [CustomerRepricingConfig.repricing_config][google.cloud.channel.v1.CustomerRepricingConfig.repricing_config] + vaule must be different from the value used in the current + config for a + [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement]. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.CreateCustomerRepricingConfigRequest], + Awaitable[~.CustomerRepricingConfig]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_customer_repricing_config' not in self._stubs: + self._stubs['create_customer_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateCustomerRepricingConfig', + request_serializer=service.CreateCustomerRepricingConfigRequest.serialize, + response_deserializer=repricing.CustomerRepricingConfig.deserialize, + ) + return self._stubs['create_customer_repricing_config'] + + @property + def update_customer_repricing_config(self) -> Callable[ + [service.UpdateCustomerRepricingConfigRequest], + Awaitable[repricing.CustomerRepricingConfig]]: + r"""Return a callable for the update customer repricing + config method over gRPC. + + Updates a CustomerRepricingConfig. Call this method to set + modifications for a specific customer's bill. This method + overwrites the existing CustomerRepricingConfig. + + You can only update configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. To make changes to configs for the current + month, use + [CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig], + taking note of its restrictions. You cannot update the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + When updating a config in the future: + + - This config must already exist. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.UpdateCustomerRepricingConfigRequest], + Awaitable[~.CustomerRepricingConfig]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_customer_repricing_config' not in self._stubs: + self._stubs['update_customer_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UpdateCustomerRepricingConfig', + request_serializer=service.UpdateCustomerRepricingConfigRequest.serialize, + response_deserializer=repricing.CustomerRepricingConfig.deserialize, + ) + return self._stubs['update_customer_repricing_config'] + + @property + def delete_customer_repricing_config(self) -> Callable[ + [service.DeleteCustomerRepricingConfigRequest], + Awaitable[empty_pb2.Empty]]: + r"""Return a callable for the delete customer repricing + config method over gRPC. + + Deletes the given + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + permanently. You can only delete configs if their + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is set to a date after the current month. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + is active or in the past. + - NOT_FOUND: No + [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] + found for the name in the request. + + Returns: + Callable[[~.DeleteCustomerRepricingConfigRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_customer_repricing_config' not in self._stubs: + self._stubs['delete_customer_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/DeleteCustomerRepricingConfig', + request_serializer=service.DeleteCustomerRepricingConfigRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['delete_customer_repricing_config'] + + @property + def get_channel_partner_repricing_config(self) -> Callable[ + [service.GetChannelPartnerRepricingConfigRequest], + Awaitable[repricing.ChannelPartnerRepricingConfig]]: + r"""Return a callable for the get channel partner repricing + config method over gRPC. + + Gets information about how a Distributor modifies their bill + before sending it to a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + was not found. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.GetChannelPartnerRepricingConfigRequest], + Awaitable[~.ChannelPartnerRepricingConfig]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_channel_partner_repricing_config' not in self._stubs: + self._stubs['get_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/GetChannelPartnerRepricingConfig', + request_serializer=service.GetChannelPartnerRepricingConfigRequest.serialize, + response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, + ) + return self._stubs['get_channel_partner_repricing_config'] + + @property + def list_channel_partner_repricing_configs(self) -> Callable[ + [service.ListChannelPartnerRepricingConfigsRequest], + Awaitable[service.ListChannelPartnerRepricingConfigsResponse]]: + r"""Return a callable for the list channel partner repricing + configs method over gRPC. + + Lists information about how a Reseller modifies their bill + before sending it to a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resources. The data for each resource is displayed in the + ascending order of: + + - channel partner ID + - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + - [ChannelPartnerRepricingConfig.update_time][google.cloud.channel.v1.ChannelPartnerRepricingConfig.update_time] + + If unsuccessful, returns an error. + + Returns: + Callable[[~.ListChannelPartnerRepricingConfigsRequest], + Awaitable[~.ListChannelPartnerRepricingConfigsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_channel_partner_repricing_configs' not in self._stubs: + self._stubs['list_channel_partner_repricing_configs'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListChannelPartnerRepricingConfigs', + request_serializer=service.ListChannelPartnerRepricingConfigsRequest.serialize, + response_deserializer=service.ListChannelPartnerRepricingConfigsResponse.deserialize, + ) + return self._stubs['list_channel_partner_repricing_configs'] + + @property + def create_channel_partner_repricing_config(self) -> Callable[ + [service.CreateChannelPartnerRepricingConfigRequest], + Awaitable[repricing.ChannelPartnerRepricingConfig]]: + r"""Return a callable for the create channel partner + repricing config method over gRPC. + + Creates a ChannelPartnerRepricingConfig. Call this method to set + modifications for a specific ChannelPartner's bill. You can only + create configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. If needed, you can create a config for the + current month, with some restrictions. + + When creating a config for a future month, make sure there are + no existing configs for that + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + The following restrictions are for creating configs in the + current month. + + - This functionality is reserved for recovering from an + erroneous config, and should not be used for regular business + cases. + - The new config will not modify exports used with other + configs. Changes to the config may be immediate, but may take + up to 24 hours. + - There is a limit of ten configs for any ChannelPartner or + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + - The contained + [ChannelPartnerRepricingConfig.repricing_config][google.cloud.channel.v1.ChannelPartnerRepricingConfig.repricing_config] + vaule must be different from the value used in the current + config for a ChannelPartner. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.CreateChannelPartnerRepricingConfigRequest], + Awaitable[~.ChannelPartnerRepricingConfig]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_channel_partner_repricing_config' not in self._stubs: + self._stubs['create_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerRepricingConfig', + request_serializer=service.CreateChannelPartnerRepricingConfigRequest.serialize, + response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, + ) + return self._stubs['create_channel_partner_repricing_config'] + + @property + def update_channel_partner_repricing_config(self) -> Callable[ + [service.UpdateChannelPartnerRepricingConfigRequest], + Awaitable[repricing.ChannelPartnerRepricingConfig]]: + r"""Return a callable for the update channel partner + repricing config method over gRPC. + + Updates a ChannelPartnerRepricingConfig. Call this method to set + modifications for a specific ChannelPartner's bill. This method + overwrites the existing CustomerRepricingConfig. + + You can only update configs if the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is a future month. To make changes to configs for the current + month, use + [CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig], + taking note of its restrictions. You cannot update the + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. + + When updating a config in the future: + + - This config must already exist. + + Possible Error Codes: + + - PERMISSION_DENIED: If the account making the request and the + account being queried are different. + - INVALID_ARGUMENT: Missing or invalid required parameters in + the request. Also displays if the updated config is for the + current month or past months. + - NOT_FOUND: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + specified does not exist or is not associated with the given + account. + - INTERNAL: Any non-user error related to technical issues in + the backend. In this case, contact Cloud Channel support. + + Return Value: If successful, the updated + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + resource, otherwise returns an error. + + Returns: + Callable[[~.UpdateChannelPartnerRepricingConfigRequest], + Awaitable[~.ChannelPartnerRepricingConfig]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_channel_partner_repricing_config' not in self._stubs: + self._stubs['update_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerRepricingConfig', + request_serializer=service.UpdateChannelPartnerRepricingConfigRequest.serialize, + response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, + ) + return self._stubs['update_channel_partner_repricing_config'] + + @property + def delete_channel_partner_repricing_config(self) -> Callable[ + [service.DeleteChannelPartnerRepricingConfigRequest], + Awaitable[empty_pb2.Empty]]: + r"""Return a callable for the delete channel partner + repricing config method over gRPC. + + Deletes the given + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + permanently. You can only delete configs if their + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + is set to a date after the current month. + + Possible error codes: + + - PERMISSION_DENIED: The account making the request does not + own this customer. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - FAILED_PRECONDITION: The + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + is active or in the past. + - NOT_FOUND: No + [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] + found for the name in the request. + + Returns: + Callable[[~.DeleteChannelPartnerRepricingConfigRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_channel_partner_repricing_config' not in self._stubs: + self._stubs['delete_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/DeleteChannelPartnerRepricingConfig', + request_serializer=service.DeleteChannelPartnerRepricingConfigRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs['delete_channel_partner_repricing_config'] + + @property + def lookup_offer(self) -> Callable[ + [service.LookupOfferRequest], + Awaitable[offers.Offer]]: + r"""Return a callable for the lookup offer method over gRPC. + + Returns the requested [Offer][google.cloud.channel.v1.Offer] + resource. + + Possible error codes: + + - PERMISSION_DENIED: The entitlement doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: Entitlement or offer was not found. + + Return value: The [Offer][google.cloud.channel.v1.Offer] + resource. + + Returns: + Callable[[~.LookupOfferRequest], + Awaitable[~.Offer]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'lookup_offer' not in self._stubs: + self._stubs['lookup_offer'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/LookupOffer', + request_serializer=service.LookupOfferRequest.serialize, + response_deserializer=offers.Offer.deserialize, + ) + return self._stubs['lookup_offer'] + + @property + def list_products(self) -> Callable[ + [service.ListProductsRequest], + Awaitable[service.ListProductsResponse]]: + r"""Return a callable for the list products method over gRPC. + + Lists the Products the reseller is authorized to sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListProductsRequest], + Awaitable[~.ListProductsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_products' not in self._stubs: + self._stubs['list_products'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListProducts', + request_serializer=service.ListProductsRequest.serialize, + response_deserializer=service.ListProductsResponse.deserialize, + ) + return self._stubs['list_products'] + + @property + def list_skus(self) -> Callable[ + [service.ListSkusRequest], + Awaitable[service.ListSkusResponse]]: + r"""Return a callable for the list skus method over gRPC. + + Lists the SKUs for a product the reseller is authorized to sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListSkusRequest], + Awaitable[~.ListSkusResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_skus' not in self._stubs: + self._stubs['list_skus'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListSkus', + request_serializer=service.ListSkusRequest.serialize, + response_deserializer=service.ListSkusResponse.deserialize, + ) + return self._stubs['list_skus'] + + @property + def list_offers(self) -> Callable[ + [service.ListOffersRequest], + Awaitable[service.ListOffersResponse]]: + r"""Return a callable for the list offers method over gRPC. + + Lists the Offers the reseller can sell. + + Possible error codes: + + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListOffersRequest], + Awaitable[~.ListOffersResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_offers' not in self._stubs: + self._stubs['list_offers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListOffers', + request_serializer=service.ListOffersRequest.serialize, + response_deserializer=service.ListOffersResponse.deserialize, + ) + return self._stubs['list_offers'] + + @property + def list_purchasable_skus(self) -> Callable[ + [service.ListPurchasableSkusRequest], + Awaitable[service.ListPurchasableSkusResponse]]: + r"""Return a callable for the list purchasable skus method over gRPC. + + Lists the following: + + - SKUs that you can purchase for a customer + - SKUs that you can upgrade or downgrade for an entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListPurchasableSkusRequest], + Awaitable[~.ListPurchasableSkusResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_purchasable_skus' not in self._stubs: + self._stubs['list_purchasable_skus'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListPurchasableSkus', + request_serializer=service.ListPurchasableSkusRequest.serialize, + response_deserializer=service.ListPurchasableSkusResponse.deserialize, + ) + return self._stubs['list_purchasable_skus'] + + @property + def list_purchasable_offers(self) -> Callable[ + [service.ListPurchasableOffersRequest], + Awaitable[service.ListPurchasableOffersResponse]]: + r"""Return a callable for the list purchasable offers method over gRPC. + + Lists the following: + + - Offers that you can purchase for a customer. + - Offers that you can change for an entitlement. + + Possible error codes: + + - PERMISSION_DENIED: The customer doesn't belong to the + reseller + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + + Returns: + Callable[[~.ListPurchasableOffersRequest], + Awaitable[~.ListPurchasableOffersResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_purchasable_offers' not in self._stubs: + self._stubs['list_purchasable_offers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListPurchasableOffers', + request_serializer=service.ListPurchasableOffersRequest.serialize, + response_deserializer=service.ListPurchasableOffersResponse.deserialize, + ) + return self._stubs['list_purchasable_offers'] + + @property + def register_subscriber(self) -> Callable[ + [service.RegisterSubscriberRequest], + Awaitable[service.RegisterSubscriberResponse]]: + r"""Return a callable for the register subscriber method over gRPC. + + Registers a service account with subscriber privileges on the + Cloud Pub/Sub topic for this Channel Services account. After you + create a subscriber, you get the events through + [SubscriberEvent][google.cloud.channel.v1.SubscriberEvent] + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The topic name with the registered service email + address. + + Returns: + Callable[[~.RegisterSubscriberRequest], + Awaitable[~.RegisterSubscriberResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'register_subscriber' not in self._stubs: + self._stubs['register_subscriber'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/RegisterSubscriber', + request_serializer=service.RegisterSubscriberRequest.serialize, + response_deserializer=service.RegisterSubscriberResponse.deserialize, + ) + return self._stubs['register_subscriber'] + + @property + def unregister_subscriber(self) -> Callable[ + [service.UnregisterSubscriberRequest], + Awaitable[service.UnregisterSubscriberResponse]]: + r"""Return a callable for the unregister subscriber method over gRPC. + + Unregisters a service account with subscriber privileges on the + Cloud Pub/Sub topic created for this Channel Services account. + If there are no service accounts left with subscriber + privileges, this deletes the topic. You can call ListSubscribers + to check for these accounts. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The topic resource doesn't exist. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: The topic name that unregistered the service email + address. Returns a success response if the service email address + wasn't registered with the topic. + + Returns: + Callable[[~.UnregisterSubscriberRequest], + Awaitable[~.UnregisterSubscriberResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'unregister_subscriber' not in self._stubs: + self._stubs['unregister_subscriber'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/UnregisterSubscriber', + request_serializer=service.UnregisterSubscriberRequest.serialize, + response_deserializer=service.UnregisterSubscriberResponse.deserialize, + ) + return self._stubs['unregister_subscriber'] + + @property + def list_subscribers(self) -> Callable[ + [service.ListSubscribersRequest], + Awaitable[service.ListSubscribersResponse]]: + r"""Return a callable for the list subscribers method over gRPC. + + Lists service accounts with subscriber privileges on the Cloud + Pub/Sub topic created for this Channel Services account. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different, or the + impersonated user is not a super admin. + - INVALID_ARGUMENT: Required request parameters are missing or + invalid. + - NOT_FOUND: The topic resource doesn't exist. + - INTERNAL: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. Contact Cloud Channel support. + + Return value: A list of service email addresses. + + Returns: + Callable[[~.ListSubscribersRequest], + Awaitable[~.ListSubscribersResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_subscribers' not in self._stubs: + self._stubs['list_subscribers'] = self.grpc_channel.unary_unary( + '/google.cloud.channel.v1.CloudChannelService/ListSubscribers', + request_serializer=service.ListSubscribersRequest.serialize, + response_deserializer=service.ListSubscribersResponse.deserialize, + ) + return self._stubs['list_subscribers'] + + def close(self): + return self.grpc_channel.close() + + @property + def delete_operation( + self, + ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: + r"""Return a callable for the delete_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_operation" not in self._stubs: + self._stubs["delete_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/DeleteOperation", + request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["delete_operation"] + + @property + def cancel_operation( + self, + ) -> Callable[[operations_pb2.CancelOperationRequest], None]: + r"""Return a callable for the cancel_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_operation" not in self._stubs: + self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/CancelOperation", + request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, + response_deserializer=None, + ) + return self._stubs["cancel_operation"] + + @property + def get_operation( + self, + ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: + r"""Return a callable for the get_operation method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_operation" not in self._stubs: + self._stubs["get_operation"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/GetOperation", + request_serializer=operations_pb2.GetOperationRequest.SerializeToString, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["get_operation"] + + @property + def list_operations( + self, + ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: + r"""Return a callable for the list_operations method over gRPC. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_operations" not in self._stubs: + self._stubs["list_operations"] = self.grpc_channel.unary_unary( + "/google.longrunning.Operations/ListOperations", + request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, + response_deserializer=operations_pb2.ListOperationsResponse.FromString, + ) + return self._stubs["list_operations"] + + +__all__ = ( + 'CloudChannelServiceGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/__init__.py new file mode 100644 index 0000000..0f834fb --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/__init__.py @@ -0,0 +1,296 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .channel_partner_links import ( + ChannelPartnerLink, + ChannelPartnerLinkState, + ChannelPartnerLinkView, +) +from .common import ( + AdminUser, + CloudIdentityInfo, + EduData, + Value, +) +from .customers import ( + ContactInfo, + Customer, +) +from .entitlements import ( + AssociationInfo, + CommitmentSettings, + Entitlement, + Parameter, + ProvisionedService, + RenewalSettings, + TransferableSku, + TransferEligibility, + TrialSettings, +) +from .offers import ( + Constraints, + CustomerConstraints, + Offer, + ParameterDefinition, + Period, + Plan, + Price, + PriceByResource, + PricePhase, + PriceTier, + PaymentPlan, + PaymentType, + PeriodType, + PromotionalOrderType, + ResourceType, +) +from .operations import ( + OperationMetadata, +) +from .products import ( + MarketingInfo, + Media, + Product, + Sku, + MediaType, +) +from .reports_service import ( + Column, + DateRange, + FetchReportResultsRequest, + FetchReportResultsResponse, + ListReportsRequest, + ListReportsResponse, + Report, + ReportJob, + ReportResultsMetadata, + ReportStatus, + ReportValue, + Row, + RunReportJobRequest, + RunReportJobResponse, +) +from .repricing import ( + ChannelPartnerRepricingConfig, + CustomerRepricingConfig, + PercentageAdjustment, + RepricingAdjustment, + RepricingConfig, + RebillingBasis, +) +from .service import ( + ActivateEntitlementRequest, + CancelEntitlementRequest, + ChangeOfferRequest, + ChangeParametersRequest, + ChangeRenewalSettingsRequest, + CheckCloudIdentityAccountsExistRequest, + CheckCloudIdentityAccountsExistResponse, + CloudIdentityCustomerAccount, + CreateChannelPartnerLinkRequest, + CreateChannelPartnerRepricingConfigRequest, + CreateCustomerRepricingConfigRequest, + CreateCustomerRequest, + CreateEntitlementRequest, + DeleteChannelPartnerRepricingConfigRequest, + DeleteCustomerRepricingConfigRequest, + DeleteCustomerRequest, + GetChannelPartnerLinkRequest, + GetChannelPartnerRepricingConfigRequest, + GetCustomerRepricingConfigRequest, + GetCustomerRequest, + GetEntitlementRequest, + ImportCustomerRequest, + ListChannelPartnerLinksRequest, + ListChannelPartnerLinksResponse, + ListChannelPartnerRepricingConfigsRequest, + ListChannelPartnerRepricingConfigsResponse, + ListCustomerRepricingConfigsRequest, + ListCustomerRepricingConfigsResponse, + ListCustomersRequest, + ListCustomersResponse, + ListEntitlementsRequest, + ListEntitlementsResponse, + ListOffersRequest, + ListOffersResponse, + ListProductsRequest, + ListProductsResponse, + ListPurchasableOffersRequest, + ListPurchasableOffersResponse, + ListPurchasableSkusRequest, + ListPurchasableSkusResponse, + ListSkusRequest, + ListSkusResponse, + ListSubscribersRequest, + ListSubscribersResponse, + ListTransferableOffersRequest, + ListTransferableOffersResponse, + ListTransferableSkusRequest, + ListTransferableSkusResponse, + LookupOfferRequest, + ProvisionCloudIdentityRequest, + PurchasableOffer, + PurchasableSku, + RegisterSubscriberRequest, + RegisterSubscriberResponse, + StartPaidServiceRequest, + SuspendEntitlementRequest, + TransferableOffer, + TransferEntitlementsRequest, + TransferEntitlementsResponse, + TransferEntitlementsToGoogleRequest, + UnregisterSubscriberRequest, + UnregisterSubscriberResponse, + UpdateChannelPartnerLinkRequest, + UpdateChannelPartnerRepricingConfigRequest, + UpdateCustomerRepricingConfigRequest, + UpdateCustomerRequest, +) +from .subscriber_event import ( + CustomerEvent, + EntitlementEvent, + SubscriberEvent, +) + +__all__ = ( + 'ChannelPartnerLink', + 'ChannelPartnerLinkState', + 'ChannelPartnerLinkView', + 'AdminUser', + 'CloudIdentityInfo', + 'EduData', + 'Value', + 'ContactInfo', + 'Customer', + 'AssociationInfo', + 'CommitmentSettings', + 'Entitlement', + 'Parameter', + 'ProvisionedService', + 'RenewalSettings', + 'TransferableSku', + 'TransferEligibility', + 'TrialSettings', + 'Constraints', + 'CustomerConstraints', + 'Offer', + 'ParameterDefinition', + 'Period', + 'Plan', + 'Price', + 'PriceByResource', + 'PricePhase', + 'PriceTier', + 'PaymentPlan', + 'PaymentType', + 'PeriodType', + 'PromotionalOrderType', + 'ResourceType', + 'OperationMetadata', + 'MarketingInfo', + 'Media', + 'Product', + 'Sku', + 'MediaType', + 'Column', + 'DateRange', + 'FetchReportResultsRequest', + 'FetchReportResultsResponse', + 'ListReportsRequest', + 'ListReportsResponse', + 'Report', + 'ReportJob', + 'ReportResultsMetadata', + 'ReportStatus', + 'ReportValue', + 'Row', + 'RunReportJobRequest', + 'RunReportJobResponse', + 'ChannelPartnerRepricingConfig', + 'CustomerRepricingConfig', + 'PercentageAdjustment', + 'RepricingAdjustment', + 'RepricingConfig', + 'RebillingBasis', + 'ActivateEntitlementRequest', + 'CancelEntitlementRequest', + 'ChangeOfferRequest', + 'ChangeParametersRequest', + 'ChangeRenewalSettingsRequest', + 'CheckCloudIdentityAccountsExistRequest', + 'CheckCloudIdentityAccountsExistResponse', + 'CloudIdentityCustomerAccount', + 'CreateChannelPartnerLinkRequest', + 'CreateChannelPartnerRepricingConfigRequest', + 'CreateCustomerRepricingConfigRequest', + 'CreateCustomerRequest', + 'CreateEntitlementRequest', + 'DeleteChannelPartnerRepricingConfigRequest', + 'DeleteCustomerRepricingConfigRequest', + 'DeleteCustomerRequest', + 'GetChannelPartnerLinkRequest', + 'GetChannelPartnerRepricingConfigRequest', + 'GetCustomerRepricingConfigRequest', + 'GetCustomerRequest', + 'GetEntitlementRequest', + 'ImportCustomerRequest', + 'ListChannelPartnerLinksRequest', + 'ListChannelPartnerLinksResponse', + 'ListChannelPartnerRepricingConfigsRequest', + 'ListChannelPartnerRepricingConfigsResponse', + 'ListCustomerRepricingConfigsRequest', + 'ListCustomerRepricingConfigsResponse', + 'ListCustomersRequest', + 'ListCustomersResponse', + 'ListEntitlementsRequest', + 'ListEntitlementsResponse', + 'ListOffersRequest', + 'ListOffersResponse', + 'ListProductsRequest', + 'ListProductsResponse', + 'ListPurchasableOffersRequest', + 'ListPurchasableOffersResponse', + 'ListPurchasableSkusRequest', + 'ListPurchasableSkusResponse', + 'ListSkusRequest', + 'ListSkusResponse', + 'ListSubscribersRequest', + 'ListSubscribersResponse', + 'ListTransferableOffersRequest', + 'ListTransferableOffersResponse', + 'ListTransferableSkusRequest', + 'ListTransferableSkusResponse', + 'LookupOfferRequest', + 'ProvisionCloudIdentityRequest', + 'PurchasableOffer', + 'PurchasableSku', + 'RegisterSubscriberRequest', + 'RegisterSubscriberResponse', + 'StartPaidServiceRequest', + 'SuspendEntitlementRequest', + 'TransferableOffer', + 'TransferEntitlementsRequest', + 'TransferEntitlementsResponse', + 'TransferEntitlementsToGoogleRequest', + 'UnregisterSubscriberRequest', + 'UnregisterSubscriberResponse', + 'UpdateChannelPartnerLinkRequest', + 'UpdateChannelPartnerRepricingConfigRequest', + 'UpdateCustomerRepricingConfigRequest', + 'UpdateCustomerRequest', + 'CustomerEvent', + 'EntitlementEvent', + 'SubscriberEvent', +) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/channel_partner_links.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/channel_partner_links.py new file mode 100644 index 0000000..922b062 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/channel_partner_links.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.channel_v1.types import common +from google.protobuf import timestamp_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'ChannelPartnerLinkView', + 'ChannelPartnerLinkState', + 'ChannelPartnerLink', + }, +) + + +class ChannelPartnerLinkView(proto.Enum): + r"""The level of granularity the + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] + will display. + """ + UNSPECIFIED = 0 + BASIC = 1 + FULL = 2 + + +class ChannelPartnerLinkState(proto.Enum): + r"""ChannelPartnerLinkState represents state of a channel partner + link. + """ + CHANNEL_PARTNER_LINK_STATE_UNSPECIFIED = 0 + INVITED = 1 + ACTIVE = 2 + REVOKED = 3 + SUSPENDED = 4 + + +class ChannelPartnerLink(proto.Message): + r"""Entity representing a link between distributors and their + indirect resellers in an n-tier resale channel. + + Attributes: + name (str): + Output only. Resource name for the channel partner link, in + the format accounts/{account_id}/channelPartnerLinks/{id}. + reseller_cloud_identity_id (str): + Required. Cloud Identity ID of the linked + reseller. + link_state (google.cloud.channel_v1.types.ChannelPartnerLinkState): + Required. State of the channel partner link. + invite_link_uri (str): + Output only. URI of the web page where + partner accepts the link invitation. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Timestamp of when the channel + partner link is created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Timestamp of when the channel + partner link is updated. + public_id (str): + Output only. Public identifier that a + customer must use to generate a transfer token + to move to this distributor-reseller + combination. + channel_partner_cloud_identity_info (google.cloud.channel_v1.types.CloudIdentityInfo): + Output only. Cloud Identity info of the + channel partner (IR). + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + reseller_cloud_identity_id = proto.Field( + proto.STRING, + number=2, + ) + link_state = proto.Field( + proto.ENUM, + number=3, + enum='ChannelPartnerLinkState', + ) + invite_link_uri = proto.Field( + proto.STRING, + number=4, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + public_id = proto.Field( + proto.STRING, + number=7, + ) + channel_partner_cloud_identity_info = proto.Field( + proto.MESSAGE, + number=8, + message=common.CloudIdentityInfo, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/common.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/common.py new file mode 100644 index 0000000..36e671a --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/common.py @@ -0,0 +1,236 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.protobuf import any_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'EduData', + 'CloudIdentityInfo', + 'Value', + 'AdminUser', + }, +) + + +class EduData(proto.Message): + r"""Required Edu Attributes + + Attributes: + institute_type (google.cloud.channel_v1.types.EduData.InstituteType): + Designated institute type of customer. + institute_size (google.cloud.channel_v1.types.EduData.InstituteSize): + Size of the institute. + website (str): + Web address for the edu customer's + institution. + """ + class InstituteType(proto.Enum): + r"""Enum to specify the institute type.""" + INSTITUTE_TYPE_UNSPECIFIED = 0 + K12 = 1 + UNIVERSITY = 2 + + class InstituteSize(proto.Enum): + r"""Number of students and staff the institute has.""" + INSTITUTE_SIZE_UNSPECIFIED = 0 + SIZE_1_100 = 1 + SIZE_101_500 = 2 + SIZE_501_1000 = 3 + SIZE_1001_2000 = 4 + SIZE_2001_5000 = 5 + SIZE_5001_10000 = 6 + SIZE_10001_OR_MORE = 7 + + institute_type = proto.Field( + proto.ENUM, + number=1, + enum=InstituteType, + ) + institute_size = proto.Field( + proto.ENUM, + number=2, + enum=InstituteSize, + ) + website = proto.Field( + proto.STRING, + number=3, + ) + + +class CloudIdentityInfo(proto.Message): + r"""Cloud Identity information for the Cloud Channel Customer. + + Attributes: + customer_type (google.cloud.channel_v1.types.CloudIdentityInfo.CustomerType): + CustomerType indicates verification type + needed for using services. + primary_domain (str): + Output only. The primary domain name. + is_domain_verified (bool): + Output only. Whether the domain is verified. This field is + not returned for a Customer's cloud_identity_info resource. + Partners can use the domains.get() method of the Workspace + SDK's Directory API, or listen to the + PRIMARY_DOMAIN_VERIFIED Pub/Sub event in to track domain + verification of their resolve Workspace customers. + alternate_email (str): + The alternate email. + phone_number (str): + Phone number associated with the Cloud + Identity. + language_code (str): + Language code. + admin_console_uri (str): + Output only. URI of Customer's Admin console + dashboard. + edu_data (google.cloud.channel_v1.types.EduData): + Edu information about the customer. + """ + class CustomerType(proto.Enum): + r"""CustomerType of the customer""" + CUSTOMER_TYPE_UNSPECIFIED = 0 + DOMAIN = 1 + TEAM = 2 + + customer_type = proto.Field( + proto.ENUM, + number=1, + enum=CustomerType, + ) + primary_domain = proto.Field( + proto.STRING, + number=9, + ) + is_domain_verified = proto.Field( + proto.BOOL, + number=4, + ) + alternate_email = proto.Field( + proto.STRING, + number=6, + ) + phone_number = proto.Field( + proto.STRING, + number=7, + ) + language_code = proto.Field( + proto.STRING, + number=8, + ) + admin_console_uri = proto.Field( + proto.STRING, + number=10, + ) + edu_data = proto.Field( + proto.MESSAGE, + number=22, + message='EduData', + ) + + +class Value(proto.Message): + r"""Data type and value of a parameter. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + int64_value (int): + Represents an int64 value. + + This field is a member of `oneof`_ ``kind``. + string_value (str): + Represents a string value. + + This field is a member of `oneof`_ ``kind``. + double_value (float): + Represents a double value. + + This field is a member of `oneof`_ ``kind``. + proto_value (google.protobuf.any_pb2.Any): + Represents an 'Any' proto value. + + This field is a member of `oneof`_ ``kind``. + bool_value (bool): + Represents a boolean value. + + This field is a member of `oneof`_ ``kind``. + """ + + int64_value = proto.Field( + proto.INT64, + number=1, + oneof='kind', + ) + string_value = proto.Field( + proto.STRING, + number=2, + oneof='kind', + ) + double_value = proto.Field( + proto.DOUBLE, + number=3, + oneof='kind', + ) + proto_value = proto.Field( + proto.MESSAGE, + number=4, + oneof='kind', + message=any_pb2.Any, + ) + bool_value = proto.Field( + proto.BOOL, + number=5, + oneof='kind', + ) + + +class AdminUser(proto.Message): + r"""Information needed to create an Admin User for Google + Workspace. + + Attributes: + email (str): + Primary email of the admin user. + given_name (str): + Given name of the admin user. + family_name (str): + Family name of the admin user. + """ + + email = proto.Field( + proto.STRING, + number=1, + ) + given_name = proto.Field( + proto.STRING, + number=2, + ) + family_name = proto.Field( + proto.STRING, + number=3, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/customers.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/customers.py new file mode 100644 index 0000000..b008c82 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/customers.py @@ -0,0 +1,194 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.channel_v1.types import common +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import postal_address_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'Customer', + 'ContactInfo', + }, +) + + +class Customer(proto.Message): + r"""Entity representing a customer of a reseller or distributor. + + Attributes: + name (str): + Output only. Resource name of the customer. Format: + accounts/{account_id}/customers/{customer_id} + org_display_name (str): + Required. Name of the organization that the + customer entity represents. + org_postal_address (google.type.postal_address_pb2.PostalAddress): + Required. The organization address for the + customer. To enforce US laws and embargoes, we + require a region and zip code. You must provide + valid addresses for every customer. To set the + customer's language, use the Customer-level + language code. + primary_contact_info (google.cloud.channel_v1.types.ContactInfo): + Primary contact info. + alternate_email (str): + Secondary contact email. You need to provide + an alternate email to create different domains + if a primary contact email already exists. Users + will receive a notification with credentials + when you create an admin.google.com account. + Secondary emails are also recovery email + addresses. Alternate emails are optional when + you create Team customers. + domain (str): + Required. The customer's primary domain. Must + match the primary contact email's domain. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time when the customer was + created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time when the customer was + updated. + cloud_identity_id (str): + Output only. The customer's Cloud Identity ID + if the customer has a Cloud Identity resource. + language_code (str): + Optional. The BCP-47 language code, such as "en-US" or + "sr-Latn". For more information, see + https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + cloud_identity_info (google.cloud.channel_v1.types.CloudIdentityInfo): + Output only. Cloud Identity information for + the customer. Populated only if a Cloud Identity + account exists for this customer. + channel_partner_id (str): + Cloud Identity ID of the customer's channel + partner. Populated only if a channel partner + exists for this customer. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + org_display_name = proto.Field( + proto.STRING, + number=2, + ) + org_postal_address = proto.Field( + proto.MESSAGE, + number=3, + message=postal_address_pb2.PostalAddress, + ) + primary_contact_info = proto.Field( + proto.MESSAGE, + number=4, + message='ContactInfo', + ) + alternate_email = proto.Field( + proto.STRING, + number=5, + ) + domain = proto.Field( + proto.STRING, + number=6, + ) + create_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + cloud_identity_id = proto.Field( + proto.STRING, + number=9, + ) + language_code = proto.Field( + proto.STRING, + number=10, + ) + cloud_identity_info = proto.Field( + proto.MESSAGE, + number=12, + message=common.CloudIdentityInfo, + ) + channel_partner_id = proto.Field( + proto.STRING, + number=13, + ) + + +class ContactInfo(proto.Message): + r"""Contact information for a customer account. + + Attributes: + first_name (str): + The customer account contact's first name. + Optional for Team customers. + last_name (str): + The customer account contact's last name. + Optional for Team customers. + display_name (str): + Output only. The customer account contact's + display name, formatted as a combination of the + customer's first and last name. + email (str): + The customer account's contact email. + Required for entitlements that create + admin.google.com accounts, and serves as the + customer's username for those accounts. Use this + email to invite Team customers. + title (str): + Optional. The customer account contact's job + title. + phone (str): + The customer account's contact phone number. + """ + + first_name = proto.Field( + proto.STRING, + number=1, + ) + last_name = proto.Field( + proto.STRING, + number=2, + ) + display_name = proto.Field( + proto.STRING, + number=4, + ) + email = proto.Field( + proto.STRING, + number=5, + ) + title = proto.Field( + proto.STRING, + number=6, + ) + phone = proto.Field( + proto.STRING, + number=7, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/entitlements.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/entitlements.py new file mode 100644 index 0000000..00021bf --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/entitlements.py @@ -0,0 +1,418 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.channel_v1.types import common +from google.cloud.channel_v1.types import offers +from google.cloud.channel_v1.types import products +from google.protobuf import timestamp_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'Entitlement', + 'Parameter', + 'AssociationInfo', + 'ProvisionedService', + 'CommitmentSettings', + 'RenewalSettings', + 'TrialSettings', + 'TransferableSku', + 'TransferEligibility', + }, +) + + +class Entitlement(proto.Message): + r"""An entitlement is a representation of a customer's ability to + use a service. + + Attributes: + name (str): + Output only. Resource name of an entitlement in the form: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which the + entitlement is created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which the + entitlement is updated. + offer (str): + Required. The offer resource name for which the entitlement + is to be created. Takes the form: + accounts/{account_id}/offers/{offer_id}. + commitment_settings (google.cloud.channel_v1.types.CommitmentSettings): + Commitment settings for a commitment-based + Offer. Required for commitment based offers. + provisioning_state (google.cloud.channel_v1.types.Entitlement.ProvisioningState): + Output only. Current provisioning state of + the entitlement. + provisioned_service (google.cloud.channel_v1.types.ProvisionedService): + Output only. Service provisioning details for + the entitlement. + suspension_reasons (Sequence[google.cloud.channel_v1.types.Entitlement.SuspensionReason]): + Output only. Enumerable of all current + suspension reasons for an entitlement. + purchase_order_id (str): + Optional. This purchase order (PO) + information is for resellers to use for their + company tracking usage. If a purchaseOrderId + value is given, it appears in the API responses + and shows up in the invoice. The property + accepts up to 80 plain text characters. This is + only supported for Google Workspace + entitlements. + trial_settings (google.cloud.channel_v1.types.TrialSettings): + Output only. Settings for trial offers. + association_info (google.cloud.channel_v1.types.AssociationInfo): + Association information to other + entitlements. + parameters (Sequence[google.cloud.channel_v1.types.Parameter]): + Extended entitlement parameters. When creating an + entitlement, valid parameter names and values are defined in + the + [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions]. + + The response may include the following output-only + Parameters: + + - assigned_units: The number of licenses assigned to users. + + - max_units: The maximum assignable units for a flexible + offer. + + - num_units: The total commitment for commitment-based + offers. + """ + class ProvisioningState(proto.Enum): + r"""Indicates the current provisioning state of the entitlement.""" + PROVISIONING_STATE_UNSPECIFIED = 0 + ACTIVE = 1 + SUSPENDED = 5 + + class SuspensionReason(proto.Enum): + r"""Suspension reason for an entitlement if + [provisioning_state][google.cloud.channel.v1.Entitlement.provisioning_state] + = SUSPENDED. + """ + SUSPENSION_REASON_UNSPECIFIED = 0 + RESELLER_INITIATED = 1 + TRIAL_ENDED = 2 + RENEWAL_WITH_TYPE_CANCEL = 3 + PENDING_TOS_ACCEPTANCE = 4 + OTHER = 100 + + name = proto.Field( + proto.STRING, + number=1, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + offer = proto.Field( + proto.STRING, + number=8, + ) + commitment_settings = proto.Field( + proto.MESSAGE, + number=12, + message='CommitmentSettings', + ) + provisioning_state = proto.Field( + proto.ENUM, + number=13, + enum=ProvisioningState, + ) + provisioned_service = proto.Field( + proto.MESSAGE, + number=16, + message='ProvisionedService', + ) + suspension_reasons = proto.RepeatedField( + proto.ENUM, + number=18, + enum=SuspensionReason, + ) + purchase_order_id = proto.Field( + proto.STRING, + number=19, + ) + trial_settings = proto.Field( + proto.MESSAGE, + number=21, + message='TrialSettings', + ) + association_info = proto.Field( + proto.MESSAGE, + number=23, + message='AssociationInfo', + ) + parameters = proto.RepeatedField( + proto.MESSAGE, + number=26, + message='Parameter', + ) + + +class Parameter(proto.Message): + r"""Definition for extended entitlement parameters. + + Attributes: + name (str): + Name of the parameter. + value (google.cloud.channel_v1.types.Value): + Value of the parameter. + editable (bool): + Output only. Specifies whether this parameter is allowed to + be changed. For example, for a Google Workspace Business + Starter entitlement in commitment plan, num_units is + editable when entitlement is active. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.MESSAGE, + number=2, + message=common.Value, + ) + editable = proto.Field( + proto.BOOL, + number=3, + ) + + +class AssociationInfo(proto.Message): + r"""Association links that an entitlement has to other + entitlements. + + Attributes: + base_entitlement (str): + The name of the base entitlement, for which + this entitlement is an add-on. + """ + + base_entitlement = proto.Field( + proto.STRING, + number=1, + ) + + +class ProvisionedService(proto.Message): + r"""Service provisioned for an entitlement. + + Attributes: + provisioning_id (str): + Output only. Provisioning ID of the + entitlement. For Google Workspace, this is the + underlying Subscription ID. For Google Cloud + Platform, this is the Billing Account ID of the + billing subaccount.". + product_id (str): + Output only. The product pertaining to the + provisioning resource as specified in the Offer. + sku_id (str): + Output only. The SKU pertaining to the + provisioning resource as specified in the Offer. + """ + + provisioning_id = proto.Field( + proto.STRING, + number=1, + ) + product_id = proto.Field( + proto.STRING, + number=2, + ) + sku_id = proto.Field( + proto.STRING, + number=3, + ) + + +class CommitmentSettings(proto.Message): + r"""Commitment settings for commitment-based offers. + + Attributes: + start_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Commitment start timestamp. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Commitment end timestamp. + renewal_settings (google.cloud.channel_v1.types.RenewalSettings): + Optional. Renewal settings applicable for a + commitment-based Offer. + """ + + start_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + renewal_settings = proto.Field( + proto.MESSAGE, + number=4, + message='RenewalSettings', + ) + + +class RenewalSettings(proto.Message): + r"""Renewal settings for renewable Offers. + + Attributes: + enable_renewal (bool): + If false, the plan will be completed at the + end date. + resize_unit_count (bool): + If true and enable_renewal = true, the unit (for example + seats or licenses) will be set to the number of active units + at renewal time. + payment_plan (google.cloud.channel_v1.types.PaymentPlan): + Describes how a reseller will be billed. + payment_cycle (google.cloud.channel_v1.types.Period): + Describes how frequently the reseller will be + billed, such as once per month. + """ + + enable_renewal = proto.Field( + proto.BOOL, + number=1, + ) + resize_unit_count = proto.Field( + proto.BOOL, + number=2, + ) + payment_plan = proto.Field( + proto.ENUM, + number=5, + enum=offers.PaymentPlan, + ) + payment_cycle = proto.Field( + proto.MESSAGE, + number=6, + message=offers.Period, + ) + + +class TrialSettings(proto.Message): + r"""Settings for trial offers. + + Attributes: + trial (bool): + Determines if the entitlement is in a trial or not: + + - ``true`` - The entitlement is in trial. + - ``false`` - The entitlement is not in trial. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Date when the trial ends. The value is in milliseconds using + the UNIX Epoch format. See an example `Epoch + converter `__. + """ + + trial = proto.Field( + proto.BOOL, + number=1, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + + +class TransferableSku(proto.Message): + r"""TransferableSku represents information a reseller needs to + view existing provisioned services for a customer that they do + not own. Read-only. + + Attributes: + transfer_eligibility (google.cloud.channel_v1.types.TransferEligibility): + Describes the transfer eligibility of a SKU. + sku (google.cloud.channel_v1.types.Sku): + The SKU pertaining to the provisioning + resource as specified in the Offer. + legacy_sku (google.cloud.channel_v1.types.Sku): + Optional. The customer to transfer has an + entitlement with the populated legacy SKU. + """ + + transfer_eligibility = proto.Field( + proto.MESSAGE, + number=9, + message='TransferEligibility', + ) + sku = proto.Field( + proto.MESSAGE, + number=11, + message=products.Sku, + ) + legacy_sku = proto.Field( + proto.MESSAGE, + number=12, + message=products.Sku, + ) + + +class TransferEligibility(proto.Message): + r"""Specifies transfer eligibility of a SKU. + + Attributes: + is_eligible (bool): + Whether reseller is eligible to transfer the + SKU. + description (str): + Localized description if reseller is not + eligible to transfer the SKU. + ineligibility_reason (google.cloud.channel_v1.types.TransferEligibility.Reason): + Specified the reason for ineligibility. + """ + class Reason(proto.Enum): + r"""Reason of ineligibility.""" + REASON_UNSPECIFIED = 0 + PENDING_TOS_ACCEPTANCE = 1 + SKU_NOT_ELIGIBLE = 2 + SKU_SUSPENDED = 3 + + is_eligible = proto.Field( + proto.BOOL, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + ineligibility_reason = proto.Field( + proto.ENUM, + number=3, + enum=Reason, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/offers.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/offers.py new file mode 100644 index 0000000..51750c5 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/offers.py @@ -0,0 +1,503 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.channel_v1.types import common +from google.cloud.channel_v1.types import products +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import money_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'PromotionalOrderType', + 'PaymentPlan', + 'PaymentType', + 'ResourceType', + 'PeriodType', + 'Offer', + 'ParameterDefinition', + 'Constraints', + 'CustomerConstraints', + 'Plan', + 'PriceByResource', + 'Price', + 'PricePhase', + 'PriceTier', + 'Period', + }, +) + + +class PromotionalOrderType(proto.Enum): + r"""Constraints type for Promotional offers.""" + PROMOTIONAL_TYPE_UNSPECIFIED = 0 + NEW_UPGRADE = 1 + TRANSFER = 2 + PROMOTION_SWITCH = 3 + + +class PaymentPlan(proto.Enum): + r"""Describes how the reseller will be billed.""" + PAYMENT_PLAN_UNSPECIFIED = 0 + COMMITMENT = 1 + FLEXIBLE = 2 + FREE = 3 + TRIAL = 4 + OFFLINE = 5 + + +class PaymentType(proto.Enum): + r"""Specifies when the payment needs to happen.""" + PAYMENT_TYPE_UNSPECIFIED = 0 + PREPAY = 1 + POSTPAY = 2 + + +class ResourceType(proto.Enum): + r"""Represents the type for a monetizable resource(any entity on + which billing happens). For example, this could be MINUTES for + Google Voice and GB for Google Drive. One SKU can map to + multiple monetizable resources. + """ + RESOURCE_TYPE_UNSPECIFIED = 0 + SEAT = 1 + MAU = 2 + GB = 3 + LICENSED_USER = 4 + MINUTES = 5 + IAAS_USAGE = 6 + SUBSCRIPTION = 7 + + +class PeriodType(proto.Enum): + r"""Period Type.""" + PERIOD_TYPE_UNSPECIFIED = 0 + DAY = 1 + MONTH = 2 + YEAR = 3 + + +class Offer(proto.Message): + r"""Represents an offer made to resellers for purchase. An offer is + associated with a [Sku][google.cloud.channel.v1.Sku], has a plan for + payment, a price, and defines the constraints for buying. + + Attributes: + name (str): + Resource Name of the Offer. Format: + accounts/{account_id}/offers/{offer_id} + marketing_info (google.cloud.channel_v1.types.MarketingInfo): + Marketing information for the Offer. + sku (google.cloud.channel_v1.types.Sku): + SKU the offer is associated with. + plan (google.cloud.channel_v1.types.Plan): + Describes the payment plan for the Offer. + constraints (google.cloud.channel_v1.types.Constraints): + Constraints on transacting the Offer. + price_by_resources (Sequence[google.cloud.channel_v1.types.PriceByResource]): + Price for each monetizable resource type. + start_time (google.protobuf.timestamp_pb2.Timestamp): + Start of the Offer validity time. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. End of the Offer validity time. + parameter_definitions (Sequence[google.cloud.channel_v1.types.ParameterDefinition]): + Parameters required to use current Offer to + purchase. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + marketing_info = proto.Field( + proto.MESSAGE, + number=2, + message=products.MarketingInfo, + ) + sku = proto.Field( + proto.MESSAGE, + number=3, + message=products.Sku, + ) + plan = proto.Field( + proto.MESSAGE, + number=4, + message='Plan', + ) + constraints = proto.Field( + proto.MESSAGE, + number=5, + message='Constraints', + ) + price_by_resources = proto.RepeatedField( + proto.MESSAGE, + number=6, + message='PriceByResource', + ) + start_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + parameter_definitions = proto.RepeatedField( + proto.MESSAGE, + number=9, + message='ParameterDefinition', + ) + + +class ParameterDefinition(proto.Message): + r"""Parameter's definition. Specifies what parameter is required + to use the current Offer to purchase. + + Attributes: + name (str): + Name of the parameter. + parameter_type (google.cloud.channel_v1.types.ParameterDefinition.ParameterType): + Data type of the parameter. Minimal value, + Maximum value and allowed values will use + specified data type here. + min_value (google.cloud.channel_v1.types.Value): + Minimal value of the parameter, if + applicable. Inclusive. For example, minimal + commitment when purchasing Anthos is 0.01. + Applicable to INT64 and DOUBLE parameter types. + max_value (google.cloud.channel_v1.types.Value): + Maximum value of the parameter, if + applicable. Inclusive. For example, maximum + seats when purchasing Google Workspace Business + Standard. Applicable to INT64 and DOUBLE + parameter types. + allowed_values (Sequence[google.cloud.channel_v1.types.Value]): + If not empty, parameter values must be drawn from this list. + For example, [us-west1, us-west2, ...] Applicable to STRING + parameter type. + optional (bool): + If set to true, parameter is optional to + purchase this Offer. + """ + class ParameterType(proto.Enum): + r"""Data type of the parameter.""" + PARAMETER_TYPE_UNSPECIFIED = 0 + INT64 = 1 + STRING = 2 + DOUBLE = 3 + + name = proto.Field( + proto.STRING, + number=1, + ) + parameter_type = proto.Field( + proto.ENUM, + number=2, + enum=ParameterType, + ) + min_value = proto.Field( + proto.MESSAGE, + number=3, + message=common.Value, + ) + max_value = proto.Field( + proto.MESSAGE, + number=4, + message=common.Value, + ) + allowed_values = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=common.Value, + ) + optional = proto.Field( + proto.BOOL, + number=6, + ) + + +class Constraints(proto.Message): + r"""Represents the constraints for buying the Offer. + + Attributes: + customer_constraints (google.cloud.channel_v1.types.CustomerConstraints): + Represents constraints required to purchase + the Offer for a customer. + """ + + customer_constraints = proto.Field( + proto.MESSAGE, + number=1, + message='CustomerConstraints', + ) + + +class CustomerConstraints(proto.Message): + r"""Represents constraints required to purchase the Offer for a + customer. + + Attributes: + allowed_regions (Sequence[str]): + Allowed geographical regions of the customer. + allowed_customer_types (Sequence[google.cloud.channel_v1.types.CloudIdentityInfo.CustomerType]): + Allowed Customer Type. + promotional_order_types (Sequence[google.cloud.channel_v1.types.PromotionalOrderType]): + Allowed Promotional Order Type. Present for + Promotional offers. + """ + + allowed_regions = proto.RepeatedField( + proto.STRING, + number=1, + ) + allowed_customer_types = proto.RepeatedField( + proto.ENUM, + number=2, + enum=common.CloudIdentityInfo.CustomerType, + ) + promotional_order_types = proto.RepeatedField( + proto.ENUM, + number=3, + enum='PromotionalOrderType', + ) + + +class Plan(proto.Message): + r"""The payment plan for the Offer. Describes how to make a + payment. + + Attributes: + payment_plan (google.cloud.channel_v1.types.PaymentPlan): + Describes how a reseller will be billed. + payment_type (google.cloud.channel_v1.types.PaymentType): + Specifies when the payment needs to happen. + payment_cycle (google.cloud.channel_v1.types.Period): + Describes how frequently the reseller will be + billed, such as once per month. + trial_period (google.cloud.channel_v1.types.Period): + Present for Offers with a trial period. + For trial-only Offers, a paid service needs to + start before the trial period ends for continued + service. + For Regular Offers with a trial period, the + regular pricing goes into effect when trial + period ends, or if paid service is started + before the end of the trial period. + billing_account (str): + Reseller Billing account to charge after an + offer transaction. Only present for Google Cloud + Platform offers. + """ + + payment_plan = proto.Field( + proto.ENUM, + number=1, + enum='PaymentPlan', + ) + payment_type = proto.Field( + proto.ENUM, + number=2, + enum='PaymentType', + ) + payment_cycle = proto.Field( + proto.MESSAGE, + number=3, + message='Period', + ) + trial_period = proto.Field( + proto.MESSAGE, + number=4, + message='Period', + ) + billing_account = proto.Field( + proto.STRING, + number=5, + ) + + +class PriceByResource(proto.Message): + r"""Represents price by resource type. + + Attributes: + resource_type (google.cloud.channel_v1.types.ResourceType): + Resource Type. Example: SEAT + price (google.cloud.channel_v1.types.Price): + Price of the Offer. Present if there are no + price phases. + price_phases (Sequence[google.cloud.channel_v1.types.PricePhase]): + Specifies the price by time range. + """ + + resource_type = proto.Field( + proto.ENUM, + number=1, + enum='ResourceType', + ) + price = proto.Field( + proto.MESSAGE, + number=2, + message='Price', + ) + price_phases = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='PricePhase', + ) + + +class Price(proto.Message): + r"""Represents the price of the Offer. + + Attributes: + base_price (google.type.money_pb2.Money): + Base price. + discount (float): + Discount percentage, represented as decimal. + For example, a 20% discount will be represent as + 0.2. + effective_price (google.type.money_pb2.Money): + Effective Price after applying the discounts. + external_price_uri (str): + Link to external price list, such as link to + Google Voice rate card. + """ + + base_price = proto.Field( + proto.MESSAGE, + number=1, + message=money_pb2.Money, + ) + discount = proto.Field( + proto.DOUBLE, + number=2, + ) + effective_price = proto.Field( + proto.MESSAGE, + number=3, + message=money_pb2.Money, + ) + external_price_uri = proto.Field( + proto.STRING, + number=4, + ) + + +class PricePhase(proto.Message): + r"""Specifies the price by the duration of months. + For example, a 20% discount for the first six months, then a 10% + discount starting on the seventh month. + + Attributes: + period_type (google.cloud.channel_v1.types.PeriodType): + Defines the phase period type. + first_period (int): + Defines first period for the phase. + last_period (int): + Defines first period for the phase. + price (google.cloud.channel_v1.types.Price): + Price of the phase. Present if there are no + price tiers. + price_tiers (Sequence[google.cloud.channel_v1.types.PriceTier]): + Price by the resource tiers. + """ + + period_type = proto.Field( + proto.ENUM, + number=1, + enum='PeriodType', + ) + first_period = proto.Field( + proto.INT32, + number=2, + ) + last_period = proto.Field( + proto.INT32, + number=3, + ) + price = proto.Field( + proto.MESSAGE, + number=4, + message='Price', + ) + price_tiers = proto.RepeatedField( + proto.MESSAGE, + number=5, + message='PriceTier', + ) + + +class PriceTier(proto.Message): + r"""Defines price at resource tier level. For example, an offer with + following definition : + + - Tier 1: Provide 25% discount for all seats between 1 and 25. + - Tier 2: Provide 10% discount for all seats between 26 and 100. + - Tier 3: Provide flat 15% discount for all seats above 100. + + Each of these tiers is represented as a PriceTier. + + Attributes: + first_resource (int): + First resource for which the tier price + applies. + last_resource (int): + Last resource for which the tier price + applies. + price (google.cloud.channel_v1.types.Price): + Price of the tier. + """ + + first_resource = proto.Field( + proto.INT32, + number=1, + ) + last_resource = proto.Field( + proto.INT32, + number=2, + ) + price = proto.Field( + proto.MESSAGE, + number=3, + message='Price', + ) + + +class Period(proto.Message): + r"""Represents period in days/months/years. + + Attributes: + duration (int): + Total duration of Period Type defined. + period_type (google.cloud.channel_v1.types.PeriodType): + Period Type. + """ + + duration = proto.Field( + proto.INT32, + number=1, + ) + period_type = proto.Field( + proto.ENUM, + number=2, + enum='PeriodType', + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/operations.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/operations.py new file mode 100644 index 0000000..16098fc --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/operations.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'OperationMetadata', + }, +) + + +class OperationMetadata(proto.Message): + r"""Provides contextual information about a + [google.longrunning.Operation][google.longrunning.Operation]. + + Attributes: + operation_type (google.cloud.channel_v1.types.OperationMetadata.OperationType): + The RPC that initiated this Long Running + Operation. + """ + class OperationType(proto.Enum): + r"""RPCs that return a Long Running Operation.""" + OPERATION_TYPE_UNSPECIFIED = 0 + CREATE_ENTITLEMENT = 1 + CHANGE_RENEWAL_SETTINGS = 3 + START_PAID_SERVICE = 5 + ACTIVATE_ENTITLEMENT = 7 + SUSPEND_ENTITLEMENT = 8 + CANCEL_ENTITLEMENT = 9 + TRANSFER_ENTITLEMENTS = 10 + TRANSFER_ENTITLEMENTS_TO_GOOGLE = 11 + CHANGE_OFFER = 14 + CHANGE_PARAMETERS = 15 + PROVISION_CLOUD_IDENTITY = 16 + + operation_type = proto.Field( + proto.ENUM, + number=1, + enum=OperationType, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/products.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/products.py new file mode 100644 index 0000000..a4f6312 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/products.py @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'MediaType', + 'Product', + 'Sku', + 'MarketingInfo', + 'Media', + }, +) + + +class MediaType(proto.Enum): + r"""Type of media used.""" + MEDIA_TYPE_UNSPECIFIED = 0 + MEDIA_TYPE_IMAGE = 1 + + +class Product(proto.Message): + r"""A Product is the entity a customer uses when placing an + order. For example, Google Workspace, Google Voice, etc. + + Attributes: + name (str): + Resource Name of the Product. Format: products/{product_id} + marketing_info (google.cloud.channel_v1.types.MarketingInfo): + Marketing information for the product. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + marketing_info = proto.Field( + proto.MESSAGE, + number=2, + message='MarketingInfo', + ) + + +class Sku(proto.Message): + r"""Represents a product's purchasable Stock Keeping Unit (SKU). + SKUs represent the different variations of the product. For + example, Google Workspace Business Standard and Google Workspace + Business Plus are Google Workspace product SKUs. + + Attributes: + name (str): + Resource Name of the SKU. Format: + products/{product_id}/skus/{sku_id} + marketing_info (google.cloud.channel_v1.types.MarketingInfo): + Marketing information for the SKU. + product (google.cloud.channel_v1.types.Product): + Product the SKU is associated with. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + marketing_info = proto.Field( + proto.MESSAGE, + number=2, + message='MarketingInfo', + ) + product = proto.Field( + proto.MESSAGE, + number=3, + message='Product', + ) + + +class MarketingInfo(proto.Message): + r"""Represents the marketing information for a Product, SKU or + Offer. + + Attributes: + display_name (str): + Human readable name. + description (str): + Human readable description. Description can + contain HTML. + default_logo (google.cloud.channel_v1.types.Media): + Default logo. + """ + + display_name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + default_logo = proto.Field( + proto.MESSAGE, + number=3, + message='Media', + ) + + +class Media(proto.Message): + r"""Represents media information. + + Attributes: + title (str): + Title of the media. + content (str): + URL of the media. + type_ (google.cloud.channel_v1.types.MediaType): + Type of the media. + """ + + title = proto.Field( + proto.STRING, + number=1, + ) + content = proto.Field( + proto.STRING, + number=2, + ) + type_ = proto.Field( + proto.ENUM, + number=3, + enum='MediaType', + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/reports_service.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/reports_service.py new file mode 100644 index 0000000..f1c4116 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/reports_service.py @@ -0,0 +1,617 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import date_pb2 # type: ignore +from google.type import datetime_pb2 # type: ignore +from google.type import decimal_pb2 # type: ignore +from google.type import money_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'RunReportJobRequest', + 'RunReportJobResponse', + 'FetchReportResultsRequest', + 'FetchReportResultsResponse', + 'ListReportsRequest', + 'ListReportsResponse', + 'ReportJob', + 'ReportResultsMetadata', + 'Column', + 'DateRange', + 'Row', + 'ReportValue', + 'ReportStatus', + 'Report', + }, +) + + +class RunReportJobRequest(proto.Message): + r"""Request message for + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + + Attributes: + name (str): + Required. The report's resource name. Specifies the account + and report used to generate report data. The report_id + identifier is a UID (for example, ``613bf59q``). Name uses + the format: accounts/{account_id}/reports/{report_id} + date_range (google.cloud.channel_v1.types.DateRange): + Optional. The range of usage or invoice dates + to include in the result. + filter (str): + Optional. A structured string that defines conditions on + dimension columns to restrict the report output. + + Filters support logical operators (AND, OR, NOT) and + conditional operators (=, !=, <, >, <=, and >=) using + ``column_id`` as keys. + + For example: + ``(customer:"accounts/C123abc/customers/S456def" OR customer:"accounts/C123abc/customers/S789ghi") AND invoice_start_date.year >= 2022`` + language_code (str): + Optional. The BCP-47 language code, such as + "en-US". If specified, the response is + localized to the corresponding language code if + the original data sources support it. + Default is "en-US". + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + date_range = proto.Field( + proto.MESSAGE, + number=2, + message='DateRange', + ) + filter = proto.Field( + proto.STRING, + number=3, + ) + language_code = proto.Field( + proto.STRING, + number=4, + ) + + +class RunReportJobResponse(proto.Message): + r"""Response message for + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + + Attributes: + report_job (google.cloud.channel_v1.types.ReportJob): + Pass ``report_job.name`` to + [FetchReportResultsRequest.report_job][google.cloud.channel.v1.FetchReportResultsRequest.report_job] + to retrieve the report's results. + report_metadata (google.cloud.channel_v1.types.ReportResultsMetadata): + The metadata for the report's results + (display name, columns, row count, and date + range). If you view this before the operation + finishes, you may see incomplete data. + """ + + report_job = proto.Field( + proto.MESSAGE, + number=1, + message='ReportJob', + ) + report_metadata = proto.Field( + proto.MESSAGE, + number=2, + message='ReportResultsMetadata', + ) + + +class FetchReportResultsRequest(proto.Message): + r"""Request message for + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]. + + Attributes: + report_job (str): + Required. The report job created by + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. + Report_job uses the format: + accounts/{account_id}/reportJobs/{report_job_id} + page_size (int): + Optional. Requested page size of the report. + The server may return fewer results than + requested. If you don't specify a page size, the + server uses a sensible default (may change over + time). + + The maximum value is 30,000; the server will + change larger values to 30,000. + page_token (str): + Optional. A token that specifies a page of results beyond + the first page. Obtained through + [FetchReportResultsResponse.next_page_token][google.cloud.channel.v1.FetchReportResultsResponse.next_page_token] + of the previous + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults] + call. + """ + + report_job = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + + +class FetchReportResultsResponse(proto.Message): + r"""Response message for + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]. + Contains a tabular representation of the report results. + + Attributes: + report_metadata (google.cloud.channel_v1.types.ReportResultsMetadata): + The metadata for the report results (display + name, columns, row count, and date ranges). + rows (Sequence[google.cloud.channel_v1.types.Row]): + The report's lists of values. Each row follows the settings + and ordering of the columns from ``report_metadata``. + next_page_token (str): + Pass this token to + [FetchReportResultsRequest.page_token][google.cloud.channel.v1.FetchReportResultsRequest.page_token] + to retrieve the next page of results. + """ + + @property + def raw_page(self): + return self + + report_metadata = proto.Field( + proto.MESSAGE, + number=1, + message='ReportResultsMetadata', + ) + rows = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='Row', + ) + next_page_token = proto.Field( + proto.STRING, + number=3, + ) + + +class ListReportsRequest(proto.Message): + r"""Request message for + [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports]. + + Attributes: + parent (str): + Required. The resource name of the partner account to list + available reports for. Parent uses the format: + accounts/{account_id} + page_size (int): + Optional. Requested page size of the report. + The server might return fewer results than + requested. If unspecified, returns 20 reports. + The maximum value is 100. + page_token (str): + Optional. A token that specifies a page of results beyond + the first page. Obtained through + [ListReportsResponse.next_page_token][google.cloud.channel.v1.ListReportsResponse.next_page_token] + of the previous + [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports] + call. + language_code (str): + Optional. The BCP-47 language code, such as + "en-US". If specified, the response is + localized to the corresponding language code if + the original data sources support it. + Default is "en-US". + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + language_code = proto.Field( + proto.STRING, + number=4, + ) + + +class ListReportsResponse(proto.Message): + r"""Response message for + [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports]. + + Attributes: + reports (Sequence[google.cloud.channel_v1.types.Report]): + The reports available to the partner. + next_page_token (str): + Pass this token to + [FetchReportResultsRequest.page_token][google.cloud.channel.v1.FetchReportResultsRequest.page_token] + to retrieve the next page of results. + """ + + @property + def raw_page(self): + return self + + reports = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='Report', + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class ReportJob(proto.Message): + r"""The result of a [RunReportJob][] operation. Contains the name to use + in + [FetchReportResultsRequest.report_job][google.cloud.channel.v1.FetchReportResultsRequest.report_job] + and the status of the operation. + + Attributes: + name (str): + Required. The resource name of a report job. Name uses the + format: ``accounts/{account_id}/reportJobs/{report_job_id}`` + report_status (google.cloud.channel_v1.types.ReportStatus): + The current status of report generation. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + report_status = proto.Field( + proto.MESSAGE, + number=2, + message='ReportStatus', + ) + + +class ReportResultsMetadata(proto.Message): + r"""The features describing the data. Returned by + [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob] + and + [CloudChannelReportsService.FetchReportResults][google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults]. + + Attributes: + report (google.cloud.channel_v1.types.Report): + Details of the completed report. + row_count (int): + The total number of rows of data in the final + report. + date_range (google.cloud.channel_v1.types.DateRange): + The date range of reported usage. + preceding_date_range (google.cloud.channel_v1.types.DateRange): + The usage dates immediately preceding ``date_range`` with + the same duration. Use this to calculate trending usage and + costs. This is only populated if you request trending data. + + For example, if ``date_range`` is July 1-15, + ``preceding_date_range`` will be June 16-30. + """ + + report = proto.Field( + proto.MESSAGE, + number=1, + message='Report', + ) + row_count = proto.Field( + proto.INT64, + number=2, + ) + date_range = proto.Field( + proto.MESSAGE, + number=3, + message='DateRange', + ) + preceding_date_range = proto.Field( + proto.MESSAGE, + number=4, + message='DateRange', + ) + + +class Column(proto.Message): + r"""The definition of a report column. Specifies the data + properties in the corresponding position of the report rows. + + Attributes: + column_id (str): + The unique name of the column (for example, customer_domain, + channel_partner, customer_cost). You can use column IDs in + [RunReportJobRequest.filter][google.cloud.channel.v1.RunReportJobRequest.filter]. + To see all reports and their columns, call + [CloudChannelReportsService.ListReports][google.cloud.channel.v1.CloudChannelReportsService.ListReports]. + display_name (str): + The column's display name. + data_type (google.cloud.channel_v1.types.Column.DataType): + The type of the values for this column. + """ + class DataType(proto.Enum): + r"""Available data types for columns. Corresponds to the fields in the + ReportValue ``oneof`` field. + """ + DATA_TYPE_UNSPECIFIED = 0 + STRING = 1 + INT = 2 + DECIMAL = 3 + MONEY = 4 + DATE = 5 + DATE_TIME = 6 + + column_id = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + data_type = proto.Field( + proto.ENUM, + number=3, + enum=DataType, + ) + + +class DateRange(proto.Message): + r"""A representation of usage or invoice date ranges. + + Attributes: + usage_start_date_time (google.type.datetime_pb2.DateTime): + The earliest usage date time (inclusive). + + If you use time groupings (daily, weekly, etc), each group + uses midnight to midnight (Pacific time). The usage start + date is rounded down to include all usage from the specified + date. We recommend that clients pass + ``usage_start_date_time`` in Pacific time. + usage_end_date_time (google.type.datetime_pb2.DateTime): + The latest usage date time (exclusive). + + If you use time groupings (daily, weekly, etc), each group + uses midnight to midnight (Pacific time). The usage end date + is rounded down to include all usage from the specified + date. We recommend that clients pass + ``usage_start_date_time`` in Pacific time. + invoice_start_date (google.type.date_pb2.Date): + The earliest invoice date (inclusive). + If your product uses monthly invoices, and this + value is not the beginning of a month, this will + adjust the date to the first day of the given + month. + invoice_end_date (google.type.date_pb2.Date): + The latest invoice date (exclusive). + If your product uses monthly invoices, and this + value is not the beginning of a month, this will + adjust the date to the first day of the + following month. + """ + + usage_start_date_time = proto.Field( + proto.MESSAGE, + number=1, + message=datetime_pb2.DateTime, + ) + usage_end_date_time = proto.Field( + proto.MESSAGE, + number=2, + message=datetime_pb2.DateTime, + ) + invoice_start_date = proto.Field( + proto.MESSAGE, + number=3, + message=date_pb2.Date, + ) + invoice_end_date = proto.Field( + proto.MESSAGE, + number=4, + message=date_pb2.Date, + ) + + +class Row(proto.Message): + r"""A row of report values. + + Attributes: + values (Sequence[google.cloud.channel_v1.types.ReportValue]): + The list of values in the row. + """ + + values = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='ReportValue', + ) + + +class ReportValue(proto.Message): + r"""A single report value. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + string_value (str): + A value of type ``string``. + + This field is a member of `oneof`_ ``value``. + int_value (int): + A value of type ``int``. + + This field is a member of `oneof`_ ``value``. + decimal_value (google.type.decimal_pb2.Decimal): + A value of type ``google.type.Decimal``, representing + non-integer numeric values. + + This field is a member of `oneof`_ ``value``. + money_value (google.type.money_pb2.Money): + A value of type ``google.type.Money`` (currency code, whole + units, decimal units). + + This field is a member of `oneof`_ ``value``. + date_value (google.type.date_pb2.Date): + A value of type ``google.type.Date`` (year, month, day). + + This field is a member of `oneof`_ ``value``. + date_time_value (google.type.datetime_pb2.DateTime): + A value of type ``google.type.DateTime`` (year, month, day, + hour, minute, second, and UTC offset or timezone.) + + This field is a member of `oneof`_ ``value``. + """ + + string_value = proto.Field( + proto.STRING, + number=1, + oneof='value', + ) + int_value = proto.Field( + proto.INT64, + number=2, + oneof='value', + ) + decimal_value = proto.Field( + proto.MESSAGE, + number=3, + oneof='value', + message=decimal_pb2.Decimal, + ) + money_value = proto.Field( + proto.MESSAGE, + number=4, + oneof='value', + message=money_pb2.Money, + ) + date_value = proto.Field( + proto.MESSAGE, + number=5, + oneof='value', + message=date_pb2.Date, + ) + date_time_value = proto.Field( + proto.MESSAGE, + number=6, + oneof='value', + message=datetime_pb2.DateTime, + ) + + +class ReportStatus(proto.Message): + r"""Status of a report generation process. + + Attributes: + state (google.cloud.channel_v1.types.ReportStatus.State): + The current state of the report generation + process. + start_time (google.protobuf.timestamp_pb2.Timestamp): + The report generation's start time. + end_time (google.protobuf.timestamp_pb2.Timestamp): + The report generation's completion time. + """ + class State(proto.Enum): + r"""Available states of report generation.""" + STATE_UNSPECIFIED = 0 + STARTED = 1 + WRITING = 2 + AVAILABLE = 3 + FAILED = 4 + + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + start_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + + +class Report(proto.Message): + r"""The ID and description of a report that was used to generate + report data. For example, "GCP Daily Spend", "Google Workspace + License Activity", etc. + + Attributes: + name (str): + Required. The report's resource name. Specifies the account + and report used to generate report data. The report_id + identifier is a UID (for example, ``613bf59q``). + + Name uses the format: + accounts/{account_id}/reports/{report_id} + display_name (str): + A human-readable name for this report. + columns (Sequence[google.cloud.channel_v1.types.Column]): + The list of columns included in the report. + This defines the schema of the report results. + description (str): + A description of other aspects of the report, + such as the products it supports. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + columns = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='Column', + ) + description = proto.Field( + proto.STRING, + number=4, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/repricing.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/repricing.py new file mode 100644 index 0000000..66758cd --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/repricing.py @@ -0,0 +1,247 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import date_pb2 # type: ignore +from google.type import decimal_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'RebillingBasis', + 'CustomerRepricingConfig', + 'ChannelPartnerRepricingConfig', + 'RepricingConfig', + 'RepricingAdjustment', + 'PercentageAdjustment', + }, +) + + +class RebillingBasis(proto.Enum): + r"""Specifies the different costs that the modified bill can be + based on. + """ + REBILLING_BASIS_UNSPECIFIED = 0 + COST_AT_LIST = 1 + DIRECT_CUSTOMER_COST = 2 + + +class CustomerRepricingConfig(proto.Message): + r"""Configuration for how a reseller will reprice a Customer. + + Attributes: + name (str): + Output only. Resource name of the CustomerRepricingConfig. + Format: + accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. + repricing_config (google.cloud.channel_v1.types.RepricingConfig): + Required. The configuration for bill + modifications made by a reseller before sending + it to customers. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Timestamp of an update to the repricing rule. + If ``update_time`` is after + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + then it indicates this was set mid-month. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + repricing_config = proto.Field( + proto.MESSAGE, + number=2, + message='RepricingConfig', + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + + +class ChannelPartnerRepricingConfig(proto.Message): + r"""Configuration for how a distributor will rebill a channel + partner (also known as a distributor-authorized reseller). + + Attributes: + name (str): + Output only. Resource name of the + ChannelPartnerRepricingConfig. Format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}. + repricing_config (google.cloud.channel_v1.types.RepricingConfig): + Required. The configuration for bill + modifications made by a reseller before sending + it to ChannelPartner. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Timestamp of an update to the repricing rule. + If ``update_time`` is after + [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] + then it indicates this was set mid-month. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + repricing_config = proto.Field( + proto.MESSAGE, + number=2, + message='RepricingConfig', + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + + +class RepricingConfig(proto.Message): + r"""Configuration for repricing a Google bill over a period of + time. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + entitlement_granularity (google.cloud.channel_v1.types.RepricingConfig.EntitlementGranularity): + Applies the repricing configuration at the + entitlement level. This is the only supported + value for CustomerRepricingConfig. + + This field is a member of `oneof`_ ``granularity``. + channel_partner_granularity (google.cloud.channel_v1.types.RepricingConfig.ChannelPartnerGranularity): + Applies the repricing configuration at the + channel partner level. This is the only + supported value for + ChannelPartnerRepricingConfig. + + This field is a member of `oneof`_ ``granularity``. + effective_invoice_month (google.type.date_pb2.Date): + Required. The YearMonth when these + adjustments activate. The Day field needs to be + "0" since we only accept YearMonth repricing + boundaries. + adjustment (google.cloud.channel_v1.types.RepricingAdjustment): + Required. Information about the adjustment. + rebilling_basis (google.cloud.channel_v1.types.RebillingBasis): + Required. The + [RebillingBasis][google.cloud.channel.v1.RebillingBasis] to + use for this bill. Specifies the relative cost based on + repricing costs you will apply. + """ + + class EntitlementGranularity(proto.Message): + r"""Applies the repricing configuration at the entitlement level. + + Attributes: + entitlement (str): + Resource name of the entitlement. Format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + """ + + entitlement = proto.Field( + proto.STRING, + number=1, + ) + + class ChannelPartnerGranularity(proto.Message): + r"""Applies the repricing configuration at the channel partner + level. The channel partner value is derived from the resource + name. Takes an empty json object. + + """ + + entitlement_granularity = proto.Field( + proto.MESSAGE, + number=4, + oneof='granularity', + message=EntitlementGranularity, + ) + channel_partner_granularity = proto.Field( + proto.MESSAGE, + number=5, + oneof='granularity', + message=ChannelPartnerGranularity, + ) + effective_invoice_month = proto.Field( + proto.MESSAGE, + number=1, + message=date_pb2.Date, + ) + adjustment = proto.Field( + proto.MESSAGE, + number=2, + message='RepricingAdjustment', + ) + rebilling_basis = proto.Field( + proto.ENUM, + number=3, + enum='RebillingBasis', + ) + + +class RepricingAdjustment(proto.Message): + r"""A type that represents the various adjustments you can apply + to a bill. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + percentage_adjustment (google.cloud.channel_v1.types.PercentageAdjustment): + Flat markup or markdown on an entire bill. + + This field is a member of `oneof`_ ``adjustment``. + """ + + percentage_adjustment = proto.Field( + proto.MESSAGE, + number=2, + oneof='adjustment', + message='PercentageAdjustment', + ) + + +class PercentageAdjustment(proto.Message): + r"""An adjustment that applies a flat markup or markdown to an + entire bill. + + Attributes: + percentage (google.type.decimal_pb2.Decimal): + The percentage of the bill to adjust. + For example: + Mark down by 1% => "-1.00" + Mark up by 1% => "1.00" + Pass-Through => "0.00". + """ + + percentage = proto.Field( + proto.MESSAGE, + number=2, + message=decimal_pb2.Decimal, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/service.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/service.py new file mode 100644 index 0000000..4d07ae8 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/service.py @@ -0,0 +1,2391 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + +from google.cloud.channel_v1.types import channel_partner_links as gcc_channel_partner_links +from google.cloud.channel_v1.types import common +from google.cloud.channel_v1.types import customers as gcc_customers +from google.cloud.channel_v1.types import entitlements as gcc_entitlements +from google.cloud.channel_v1.types import offers as gcc_offers +from google.cloud.channel_v1.types import products as gcc_products +from google.cloud.channel_v1.types import repricing +from google.protobuf import field_mask_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'CheckCloudIdentityAccountsExistRequest', + 'CloudIdentityCustomerAccount', + 'CheckCloudIdentityAccountsExistResponse', + 'ListCustomersRequest', + 'ListCustomersResponse', + 'GetCustomerRequest', + 'CreateCustomerRequest', + 'UpdateCustomerRequest', + 'DeleteCustomerRequest', + 'ImportCustomerRequest', + 'ProvisionCloudIdentityRequest', + 'ListEntitlementsRequest', + 'ListEntitlementsResponse', + 'ListTransferableSkusRequest', + 'ListTransferableSkusResponse', + 'ListTransferableOffersRequest', + 'ListTransferableOffersResponse', + 'TransferableOffer', + 'GetEntitlementRequest', + 'ListChannelPartnerLinksRequest', + 'ListChannelPartnerLinksResponse', + 'GetChannelPartnerLinkRequest', + 'CreateChannelPartnerLinkRequest', + 'UpdateChannelPartnerLinkRequest', + 'GetCustomerRepricingConfigRequest', + 'ListCustomerRepricingConfigsRequest', + 'ListCustomerRepricingConfigsResponse', + 'CreateCustomerRepricingConfigRequest', + 'UpdateCustomerRepricingConfigRequest', + 'DeleteCustomerRepricingConfigRequest', + 'GetChannelPartnerRepricingConfigRequest', + 'ListChannelPartnerRepricingConfigsRequest', + 'ListChannelPartnerRepricingConfigsResponse', + 'CreateChannelPartnerRepricingConfigRequest', + 'UpdateChannelPartnerRepricingConfigRequest', + 'DeleteChannelPartnerRepricingConfigRequest', + 'CreateEntitlementRequest', + 'TransferEntitlementsRequest', + 'TransferEntitlementsResponse', + 'TransferEntitlementsToGoogleRequest', + 'ChangeParametersRequest', + 'ChangeRenewalSettingsRequest', + 'ChangeOfferRequest', + 'StartPaidServiceRequest', + 'CancelEntitlementRequest', + 'SuspendEntitlementRequest', + 'ActivateEntitlementRequest', + 'LookupOfferRequest', + 'ListProductsRequest', + 'ListProductsResponse', + 'ListSkusRequest', + 'ListSkusResponse', + 'ListOffersRequest', + 'ListOffersResponse', + 'ListPurchasableSkusRequest', + 'ListPurchasableSkusResponse', + 'PurchasableSku', + 'ListPurchasableOffersRequest', + 'ListPurchasableOffersResponse', + 'PurchasableOffer', + 'RegisterSubscriberRequest', + 'RegisterSubscriberResponse', + 'UnregisterSubscriberRequest', + 'UnregisterSubscriberResponse', + 'ListSubscribersRequest', + 'ListSubscribersResponse', + }, +) + + +class CheckCloudIdentityAccountsExistRequest(proto.Message): + r"""Request message for + [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. + + Attributes: + parent (str): + Required. The reseller account's resource name. Parent uses + the format: accounts/{account_id} + domain (str): + Required. Domain to fetch for Cloud Identity + account customer. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + domain = proto.Field( + proto.STRING, + number=2, + ) + + +class CloudIdentityCustomerAccount(proto.Message): + r"""Entity representing a Cloud Identity account that may be + associated with a Channel Services API partner. + + Attributes: + existing (bool): + Returns true if a Cloud Identity account + exists for a specific domain. + owned (bool): + Returns true if the Cloud Identity account is + associated with a customer of the Channel + Services partner. + customer_name (str): + If owned = true, the name of the customer that owns the + Cloud Identity account. Customer_name uses the format: + accounts/{account_id}/customers/{customer_id} + customer_cloud_identity_id (str): + If existing = true, the Cloud Identity ID of + the customer. + """ + + existing = proto.Field( + proto.BOOL, + number=1, + ) + owned = proto.Field( + proto.BOOL, + number=2, + ) + customer_name = proto.Field( + proto.STRING, + number=3, + ) + customer_cloud_identity_id = proto.Field( + proto.STRING, + number=4, + ) + + +class CheckCloudIdentityAccountsExistResponse(proto.Message): + r"""Response message for + [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. + + Attributes: + cloud_identity_accounts (Sequence[google.cloud.channel_v1.types.CloudIdentityCustomerAccount]): + The Cloud Identity accounts associated with + the domain. + """ + + cloud_identity_accounts = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='CloudIdentityCustomerAccount', + ) + + +class ListCustomersRequest(proto.Message): + r"""Request message for + [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers] + + Attributes: + parent (str): + Required. The resource name of the reseller account to list + customers from. Parent uses the format: + accounts/{account_id}. + page_size (int): + Optional. The maximum number of customers to + return. The service may return fewer than this + value. If unspecified, returns at most 10 + customers. The maximum value is 50. + page_token (str): + Optional. A token identifying a page of results other than + the first page. Obtained through + [ListCustomersResponse.next_page_token][google.cloud.channel.v1.ListCustomersResponse.next_page_token] + of the previous + [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers] + call. + filter (str): + Optional. Filters applied to the + [CloudChannelService.ListCustomers] results. See + https://cloud.google.com/channel/docs/concepts/google-cloud/filter-customers + for more information. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + + +class ListCustomersResponse(proto.Message): + r"""Response message for + [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers]. + + Attributes: + customers (Sequence[google.cloud.channel_v1.types.Customer]): + The customers belonging to a reseller or + distributor. + next_page_token (str): + A token to retrieve the next page of results. Pass to + [ListCustomersRequest.page_token][google.cloud.channel.v1.ListCustomersRequest.page_token] + to obtain that page. + """ + + @property + def raw_page(self): + return self + + customers = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gcc_customers.Customer, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class GetCustomerRequest(proto.Message): + r"""Request message for + [CloudChannelService.GetCustomer][google.cloud.channel.v1.CloudChannelService.GetCustomer]. + + Attributes: + name (str): + Required. The resource name of the customer to retrieve. + Name uses the format: + accounts/{account_id}/customers/{customer_id} + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateCustomerRequest(proto.Message): + r"""Request message for + [CloudChannelService.CreateCustomer][google.cloud.channel.v1.CloudChannelService.CreateCustomer] + + Attributes: + parent (str): + Required. The resource name of reseller account in which to + create the customer. Parent uses the format: + accounts/{account_id} + customer (google.cloud.channel_v1.types.Customer): + Required. The customer to create. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + customer = proto.Field( + proto.MESSAGE, + number=2, + message=gcc_customers.Customer, + ) + + +class UpdateCustomerRequest(proto.Message): + r"""Request message for + [CloudChannelService.UpdateCustomer][google.cloud.channel.v1.CloudChannelService.UpdateCustomer]. + + Attributes: + customer (google.cloud.channel_v1.types.Customer): + Required. New contents of the customer. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + The update mask that applies to the resource. + Optional. + """ + + customer = proto.Field( + proto.MESSAGE, + number=2, + message=gcc_customers.Customer, + ) + update_mask = proto.Field( + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, + ) + + +class DeleteCustomerRequest(proto.Message): + r"""Request message for + [CloudChannelService.DeleteCustomer][google.cloud.channel.v1.CloudChannelService.DeleteCustomer]. + + Attributes: + name (str): + Required. The resource name of the customer + to delete. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class ImportCustomerRequest(proto.Message): + r"""Request message for + [CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer] + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + domain (str): + Required. Customer domain. + + This field is a member of `oneof`_ ``customer_identity``. + cloud_identity_id (str): + Required. Customer's Cloud Identity ID + + This field is a member of `oneof`_ ``customer_identity``. + parent (str): + Required. The resource name of the reseller's account. + Parent takes the format: accounts/{account_id} or + accounts/{account_id}/channelPartnerLinks/{channel_partner_id} + auth_token (str): + Optional. The super admin of the resold + customer generates this token to authorize a + reseller to access their Cloud Identity and + purchase entitlements on their behalf. You can + omit this token after authorization. See + https://support.google.com/a/answer/7643790 for + more details. + overwrite_if_exists (bool): + Required. Choose to overwrite an existing + customer if found. This must be set to true if + there is an existing customer with a conflicting + region code or domain. + channel_partner_id (str): + Optional. Cloud Identity ID of a channel + partner who will be the direct reseller for the + customer's order. This field is required for + 2-tier transfer scenarios and can be provided + via the request Parent binding as well. + customer (str): + Optional. Specifies the customer that will receive imported + Cloud Identity information. Format: + accounts/{account_id}/customers/{customer_id} + """ + + domain = proto.Field( + proto.STRING, + number=2, + oneof='customer_identity', + ) + cloud_identity_id = proto.Field( + proto.STRING, + number=3, + oneof='customer_identity', + ) + parent = proto.Field( + proto.STRING, + number=1, + ) + auth_token = proto.Field( + proto.STRING, + number=4, + ) + overwrite_if_exists = proto.Field( + proto.BOOL, + number=5, + ) + channel_partner_id = proto.Field( + proto.STRING, + number=6, + ) + customer = proto.Field( + proto.STRING, + number=7, + ) + + +class ProvisionCloudIdentityRequest(proto.Message): + r"""Request message for + [CloudChannelService.ProvisionCloudIdentity][google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity] + + Attributes: + customer (str): + Required. Resource name of the customer. Format: + accounts/{account_id}/customers/{customer_id} + cloud_identity_info (google.cloud.channel_v1.types.CloudIdentityInfo): + CloudIdentity-specific customer information. + user (google.cloud.channel_v1.types.AdminUser): + Admin user information. + validate_only (bool): + Validate the request and preview the review, + but do not post it. + """ + + customer = proto.Field( + proto.STRING, + number=1, + ) + cloud_identity_info = proto.Field( + proto.MESSAGE, + number=2, + message=common.CloudIdentityInfo, + ) + user = proto.Field( + proto.MESSAGE, + number=3, + message=common.AdminUser, + ) + validate_only = proto.Field( + proto.BOOL, + number=4, + ) + + +class ListEntitlementsRequest(proto.Message): + r"""Request message for + [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements] + + Attributes: + parent (str): + Required. The resource name of the reseller's customer + account to list entitlements for. Parent uses the format: + accounts/{account_id}/customers/{customer_id} + page_size (int): + Optional. Requested page size. Server might + return fewer results than requested. If + unspecified, return at most 50 entitlements. The + maximum value is 100; the server will coerce + values above 100. + page_token (str): + Optional. A token for a page of results other than the first + page. Obtained using + [ListEntitlementsResponse.next_page_token][google.cloud.channel.v1.ListEntitlementsResponse.next_page_token] + of the previous + [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements] + call. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + + +class ListEntitlementsResponse(proto.Message): + r"""Response message for + [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements]. + + Attributes: + entitlements (Sequence[google.cloud.channel_v1.types.Entitlement]): + The reseller customer's entitlements. + next_page_token (str): + A token to list the next page of results. Pass to + [ListEntitlementsRequest.page_token][google.cloud.channel.v1.ListEntitlementsRequest.page_token] + to obtain that page. + """ + + @property + def raw_page(self): + return self + + entitlements = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gcc_entitlements.Entitlement, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class ListTransferableSkusRequest(proto.Message): + r"""Request message for + [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus] + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + cloud_identity_id (str): + Customer's Cloud Identity ID + + This field is a member of `oneof`_ ``transferred_customer_identity``. + customer_name (str): + A reseller is required to create a customer and use the + resource name of the created customer here. Customer_name + uses the format: + accounts/{account_id}/customers/{customer_id} + + This field is a member of `oneof`_ ``transferred_customer_identity``. + parent (str): + Required. The reseller account's resource name. Parent uses + the format: accounts/{account_id} + page_size (int): + The requested page size. Server might return + fewer results than requested. If unspecified, + returns at most 100 SKUs. The maximum value is + 1000; the server will coerce values above 1000. + Optional. + page_token (str): + A token for a page of results other than the first page. + Obtained using + [ListTransferableSkusResponse.next_page_token][google.cloud.channel.v1.ListTransferableSkusResponse.next_page_token] + of the previous + [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus] + call. Optional. + auth_token (str): + Optional. The super admin of the resold + customer generates this token to authorize a + reseller to access their Cloud Identity and + purchase entitlements on their behalf. You can + omit this token after authorization. See + https://support.google.com/a/answer/7643790 for + more details. + language_code (str): + The BCP-47 language code. For example, + "en-US". The response will localize in the + corresponding language code, if specified. The + default value is "en-US". + Optional. + """ + + cloud_identity_id = proto.Field( + proto.STRING, + number=4, + oneof='transferred_customer_identity', + ) + customer_name = proto.Field( + proto.STRING, + number=7, + oneof='transferred_customer_identity', + ) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + auth_token = proto.Field( + proto.STRING, + number=5, + ) + language_code = proto.Field( + proto.STRING, + number=6, + ) + + +class ListTransferableSkusResponse(proto.Message): + r"""Response message for + [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus]. + + Attributes: + transferable_skus (Sequence[google.cloud.channel_v1.types.TransferableSku]): + Information about existing SKUs for a + customer that needs a transfer. + next_page_token (str): + A token to retrieve the next page of results. Pass to + [ListTransferableSkusRequest.page_token][google.cloud.channel.v1.ListTransferableSkusRequest.page_token] + to obtain that page. + """ + + @property + def raw_page(self): + return self + + transferable_skus = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gcc_entitlements.TransferableSku, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class ListTransferableOffersRequest(proto.Message): + r"""Request message for + [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers] + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + cloud_identity_id (str): + Customer's Cloud Identity ID + + This field is a member of `oneof`_ ``transferred_customer_identity``. + customer_name (str): + A reseller should create a customer and use + the resource name of that customer here. + + This field is a member of `oneof`_ ``transferred_customer_identity``. + parent (str): + Required. The resource name of the reseller's + account. + page_size (int): + Requested page size. Server might return + fewer results than requested. If unspecified, + returns at most 100 offers. The maximum value is + 1000; the server will coerce values above 1000. + page_token (str): + A token for a page of results other than the first page. + Obtained using + [ListTransferableOffersResponse.next_page_token][google.cloud.channel.v1.ListTransferableOffersResponse.next_page_token] + of the previous + [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers] + call. + sku (str): + Required. The SKU to look up Offers for. + language_code (str): + Optional. The BCP-47 language code. For + example, "en-US". The response will localize in + the corresponding language code, if specified. + The default value is "en-US". + """ + + cloud_identity_id = proto.Field( + proto.STRING, + number=4, + oneof='transferred_customer_identity', + ) + customer_name = proto.Field( + proto.STRING, + number=5, + oneof='transferred_customer_identity', + ) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + sku = proto.Field( + proto.STRING, + number=6, + ) + language_code = proto.Field( + proto.STRING, + number=7, + ) + + +class ListTransferableOffersResponse(proto.Message): + r"""Response message for + [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers]. + + Attributes: + transferable_offers (Sequence[google.cloud.channel_v1.types.TransferableOffer]): + Information about Offers for a customer that + can be used for transfer. + next_page_token (str): + A token to retrieve the next page of results. Pass to + [ListTransferableOffersRequest.page_token][google.cloud.channel.v1.ListTransferableOffersRequest.page_token] + to obtain that page. + """ + + @property + def raw_page(self): + return self + + transferable_offers = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='TransferableOffer', + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class TransferableOffer(proto.Message): + r"""TransferableOffer represents an Offer that can be used in + Transfer. Read-only. + + Attributes: + offer (google.cloud.channel_v1.types.Offer): + Offer with parameter constraints updated to + allow the Transfer. + """ + + offer = proto.Field( + proto.MESSAGE, + number=1, + message=gcc_offers.Offer, + ) + + +class GetEntitlementRequest(proto.Message): + r"""Request message for + [CloudChannelService.GetEntitlement][google.cloud.channel.v1.CloudChannelService.GetEntitlement]. + + Attributes: + name (str): + Required. The resource name of the entitlement to retrieve. + Name uses the format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class ListChannelPartnerLinksRequest(proto.Message): + r"""Request message for + [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks] + + Attributes: + parent (str): + Required. The resource name of the reseller account for + listing channel partner links. Parent uses the format: + accounts/{account_id} + page_size (int): + Optional. Requested page size. Server might + return fewer results than requested. If + unspecified, server will pick a default size + (25). The maximum value is 200; the server will + coerce values above 200. + page_token (str): + Optional. A token for a page of results other than the first + page. Obtained using + [ListChannelPartnerLinksResponse.next_page_token][google.cloud.channel.v1.ListChannelPartnerLinksResponse.next_page_token] + of the previous + [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks] + call. + view (google.cloud.channel_v1.types.ChannelPartnerLinkView): + Optional. The level of granularity the + ChannelPartnerLink will display. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + view = proto.Field( + proto.ENUM, + number=4, + enum=gcc_channel_partner_links.ChannelPartnerLinkView, + ) + + +class ListChannelPartnerLinksResponse(proto.Message): + r"""Response message for + [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks]. + + Attributes: + channel_partner_links (Sequence[google.cloud.channel_v1.types.ChannelPartnerLink]): + The Channel partner links for a reseller. + next_page_token (str): + A token to retrieve the next page of results. Pass to + [ListChannelPartnerLinksRequest.page_token][google.cloud.channel.v1.ListChannelPartnerLinksRequest.page_token] + to obtain that page. + """ + + @property + def raw_page(self): + return self + + channel_partner_links = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gcc_channel_partner_links.ChannelPartnerLink, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class GetChannelPartnerLinkRequest(proto.Message): + r"""Request message for + [CloudChannelService.GetChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink]. + + Attributes: + name (str): + Required. The resource name of the channel partner link to + retrieve. Name uses the format: + accounts/{account_id}/channelPartnerLinks/{id} where {id} is + the Cloud Identity ID of the partner. + view (google.cloud.channel_v1.types.ChannelPartnerLinkView): + Optional. The level of granularity the + ChannelPartnerLink will display. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum=gcc_channel_partner_links.ChannelPartnerLinkView, + ) + + +class CreateChannelPartnerLinkRequest(proto.Message): + r"""Request message for + [CloudChannelService.CreateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink] + + Attributes: + parent (str): + Required. Create a channel partner link for the provided + reseller account's resource name. Parent uses the format: + accounts/{account_id} + channel_partner_link (google.cloud.channel_v1.types.ChannelPartnerLink): + Required. The channel partner link to create. Either + channel_partner_link.reseller_cloud_identity_id or domain + can be used to create a link. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + channel_partner_link = proto.Field( + proto.MESSAGE, + number=2, + message=gcc_channel_partner_links.ChannelPartnerLink, + ) + + +class UpdateChannelPartnerLinkRequest(proto.Message): + r"""Request message for + [CloudChannelService.UpdateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink] + + Attributes: + name (str): + Required. The resource name of the channel partner link to + cancel. Name uses the format: + accounts/{account_id}/channelPartnerLinks/{id} where {id} is + the Cloud Identity ID of the partner. + channel_partner_link (google.cloud.channel_v1.types.ChannelPartnerLink): + Required. The channel partner link to update. Only + channel_partner_link.link_state is allowed for updates. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The update mask that applies to the resource. The + only allowable value for an update mask is + channel_partner_link.link_state. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + channel_partner_link = proto.Field( + proto.MESSAGE, + number=2, + message=gcc_channel_partner_links.ChannelPartnerLink, + ) + update_mask = proto.Field( + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, + ) + + +class GetCustomerRepricingConfigRequest(proto.Message): + r"""Request message for + [CloudChannelService.GetCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig]. + + Attributes: + name (str): + Required. The resource name of the CustomerRepricingConfig. + Format: + accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class ListCustomerRepricingConfigsRequest(proto.Message): + r"""Request message for + [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. + + Attributes: + parent (str): + Required. The resource name of the customer. Parent uses the + format: accounts/{account_id}/customers/{customer_id}. + Supports accounts/{account_id}/customers/- to retrieve + configs for all customers. + page_size (int): + Optional. The maximum number of repricing + configs to return. The service may return fewer + than this value. If unspecified, returns a + maximum of 50 rules. The maximum value is 100; + values above 100 will be coerced to 100. + page_token (str): + Optional. A token identifying a page of results beyond the + first page. Obtained through + [ListCustomerRepricingConfigsResponse.next_page_token][google.cloud.channel.v1.ListCustomerRepricingConfigsResponse.next_page_token] + of the previous + [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs] + call. + filter (str): + Optional. A filter for + [CloudChannelService.ListCustomerRepricingConfigs] results + (customer only). You can use this filter when you support a + BatchGet-like query. To use the filter, you must set + ``parent=accounts/{account_id}/customers/-``. + + Example: customer = accounts/account_id/customers/c1 OR + customer = accounts/account_id/customers/c2. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + + +class ListCustomerRepricingConfigsResponse(proto.Message): + r"""Response message for + [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. + + Attributes: + customer_repricing_configs (Sequence[google.cloud.channel_v1.types.CustomerRepricingConfig]): + The repricing configs for this channel + partner. + next_page_token (str): + A token to retrieve the next page of results. Pass to + [ListCustomerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListCustomerRepricingConfigsRequest.page_token] + to obtain that page. + """ + + @property + def raw_page(self): + return self + + customer_repricing_configs = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=repricing.CustomerRepricingConfig, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class CreateCustomerRepricingConfigRequest(proto.Message): + r"""Request message for + [CloudChannelService.CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig]. + + Attributes: + parent (str): + Required. The resource name of the customer that will + receive this repricing config. Parent uses the format: + accounts/{account_id}/customers/{customer_id} + customer_repricing_config (google.cloud.channel_v1.types.CustomerRepricingConfig): + Required. The CustomerRepricingConfig object + to update. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + customer_repricing_config = proto.Field( + proto.MESSAGE, + number=2, + message=repricing.CustomerRepricingConfig, + ) + + +class UpdateCustomerRepricingConfigRequest(proto.Message): + r"""Request message for + [CloudChannelService.UpdateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig]. + + Attributes: + customer_repricing_config (google.cloud.channel_v1.types.CustomerRepricingConfig): + Required. The CustomerRepricingConfig object + to update. + """ + + customer_repricing_config = proto.Field( + proto.MESSAGE, + number=1, + message=repricing.CustomerRepricingConfig, + ) + + +class DeleteCustomerRepricingConfigRequest(proto.Message): + r"""Request message for + [CloudChannelService.DeleteCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig]. + + Attributes: + name (str): + Required. The resource name of the customer repricing config + rule to delete. Format: + accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class GetChannelPartnerRepricingConfigRequest(proto.Message): + r"""Request message for + [CloudChannelService.GetChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig] + + Attributes: + name (str): + Required. The resource name of the + ChannelPartnerRepricingConfig Format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class ListChannelPartnerRepricingConfigsRequest(proto.Message): + r"""Request message for + [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. + + Attributes: + parent (str): + Required. The resource name of the account's + [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]. + Parent uses the format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id}. + Supports accounts/{account_id}/channelPartnerLinks/- to + retrieve configs for all channel partners. + page_size (int): + Optional. The maximum number of repricing + configs to return. The service may return fewer + than this value. If unspecified, returns a + maximum of 50 rules. The maximum value is 100; + values above 100 will be coerced to 100. + page_token (str): + Optional. A token identifying a page of results beyond the + first page. Obtained through + [ListChannelPartnerRepricingConfigsResponse.next_page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse.next_page_token] + of the previous + [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs] + call. + filter (str): + Optional. A filter for + [CloudChannelService.ListChannelPartnerRepricingConfigs] + results (channel_partner_link only). You can use this filter + when you support a BatchGet-like query. To use the filter, + you must set + ``parent=accounts/{account_id}/channelPartnerLinks/-``. + + Example: + ``channel_partner_link = accounts/account_id/channelPartnerLinks/c1`` + OR + ``channel_partner_link = accounts/account_id/channelPartnerLinks/c2``. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + + +class ListChannelPartnerRepricingConfigsResponse(proto.Message): + r"""Response message for + [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. + + Attributes: + channel_partner_repricing_configs (Sequence[google.cloud.channel_v1.types.ChannelPartnerRepricingConfig]): + The repricing configs for this channel + partner. + next_page_token (str): + A token to retrieve the next page of results. Pass to + [ListChannelPartnerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest.page_token] + to obtain that page. + """ + + @property + def raw_page(self): + return self + + channel_partner_repricing_configs = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=repricing.ChannelPartnerRepricingConfig, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class CreateChannelPartnerRepricingConfigRequest(proto.Message): + r"""Request message for + [CloudChannelService.CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig]. + + Attributes: + parent (str): + Required. The resource name of the ChannelPartner that will + receive the repricing config. Parent uses the format: + accounts/{account_id}/channelPartnerLinks/{channel_partner_id} + channel_partner_repricing_config (google.cloud.channel_v1.types.ChannelPartnerRepricingConfig): + Required. The ChannelPartnerRepricingConfig + object to update. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + channel_partner_repricing_config = proto.Field( + proto.MESSAGE, + number=2, + message=repricing.ChannelPartnerRepricingConfig, + ) + + +class UpdateChannelPartnerRepricingConfigRequest(proto.Message): + r"""Request message for + [CloudChannelService.UpdateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig]. + + Attributes: + channel_partner_repricing_config (google.cloud.channel_v1.types.ChannelPartnerRepricingConfig): + Required. The ChannelPartnerRepricingConfig + object to update. + """ + + channel_partner_repricing_config = proto.Field( + proto.MESSAGE, + number=1, + message=repricing.ChannelPartnerRepricingConfig, + ) + + +class DeleteChannelPartnerRepricingConfigRequest(proto.Message): + r"""Request message for DeleteChannelPartnerRepricingConfig. + + Attributes: + name (str): + Required. The resource name of the channel + partner repricing config rule to delete. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateEntitlementRequest(proto.Message): + r"""Request message for + [CloudChannelService.CreateEntitlement][google.cloud.channel.v1.CloudChannelService.CreateEntitlement] + + Attributes: + parent (str): + Required. The resource name of the reseller's customer + account in which to create the entitlement. Parent uses the + format: accounts/{account_id}/customers/{customer_id} + entitlement (google.cloud.channel_v1.types.Entitlement): + Required. The entitlement to create. + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + entitlement = proto.Field( + proto.MESSAGE, + number=2, + message=gcc_entitlements.Entitlement, + ) + request_id = proto.Field( + proto.STRING, + number=5, + ) + + +class TransferEntitlementsRequest(proto.Message): + r"""Request message for + [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. + + Attributes: + parent (str): + Required. The resource name of the reseller's customer + account that will receive transferred entitlements. Parent + uses the format: + accounts/{account_id}/customers/{customer_id} + entitlements (Sequence[google.cloud.channel_v1.types.Entitlement]): + Required. The new entitlements to create or + transfer. + auth_token (str): + The super admin of the resold customer + generates this token to authorize a reseller to + access their Cloud Identity and purchase + entitlements on their behalf. You can omit this + token after authorization. See + https://support.google.com/a/answer/7643790 for + more details. + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + entitlements = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=gcc_entitlements.Entitlement, + ) + auth_token = proto.Field( + proto.STRING, + number=4, + ) + request_id = proto.Field( + proto.STRING, + number=6, + ) + + +class TransferEntitlementsResponse(proto.Message): + r"""Response message for + [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. + This is put in the response field of google.longrunning.Operation. + + Attributes: + entitlements (Sequence[google.cloud.channel_v1.types.Entitlement]): + The transferred entitlements. + """ + + entitlements = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gcc_entitlements.Entitlement, + ) + + +class TransferEntitlementsToGoogleRequest(proto.Message): + r"""Request message for + [CloudChannelService.TransferEntitlementsToGoogle][google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle]. + + Attributes: + parent (str): + Required. The resource name of the reseller's customer + account where the entitlements transfer from. Parent uses + the format: accounts/{account_id}/customers/{customer_id} + entitlements (Sequence[google.cloud.channel_v1.types.Entitlement]): + Required. The entitlements to transfer to + Google. + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + entitlements = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=gcc_entitlements.Entitlement, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + + +class ChangeParametersRequest(proto.Message): + r"""Request message for [CloudChannelService.ChangeParametersRequest][]. + + Attributes: + name (str): + Required. The name of the entitlement to update. Name uses + the format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + parameters (Sequence[google.cloud.channel_v1.types.Parameter]): + Required. Entitlement parameters to update. You can only + change editable parameters. + + To view the available Parameters for a request, refer to the + [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions] + from the desired offer. + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + purchase_order_id (str): + Optional. Purchase order ID provided by the + reseller. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + parameters = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=gcc_entitlements.Parameter, + ) + request_id = proto.Field( + proto.STRING, + number=4, + ) + purchase_order_id = proto.Field( + proto.STRING, + number=5, + ) + + +class ChangeRenewalSettingsRequest(proto.Message): + r"""Request message for + [CloudChannelService.ChangeRenewalSettings][google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings]. + + Attributes: + name (str): + Required. The name of the entitlement to update. Name uses + the format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + renewal_settings (google.cloud.channel_v1.types.RenewalSettings): + Required. New renewal settings. + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + renewal_settings = proto.Field( + proto.MESSAGE, + number=4, + message=gcc_entitlements.RenewalSettings, + ) + request_id = proto.Field( + proto.STRING, + number=5, + ) + + +class ChangeOfferRequest(proto.Message): + r"""Request message for + [CloudChannelService.ChangeOffer][google.cloud.channel.v1.CloudChannelService.ChangeOffer]. + + Attributes: + name (str): + Required. The resource name of the entitlement to update. + Name uses the format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + offer (str): + Required. New Offer. Format: + accounts/{account_id}/offers/{offer_id}. + parameters (Sequence[google.cloud.channel_v1.types.Parameter]): + Optional. Parameters needed to purchase the Offer. To view + the available Parameters refer to the + [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions] + from the desired offer. + purchase_order_id (str): + Optional. Purchase order id provided by the + reseller. + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + offer = proto.Field( + proto.STRING, + number=2, + ) + parameters = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=gcc_entitlements.Parameter, + ) + purchase_order_id = proto.Field( + proto.STRING, + number=5, + ) + request_id = proto.Field( + proto.STRING, + number=6, + ) + + +class StartPaidServiceRequest(proto.Message): + r"""Request message for + [CloudChannelService.StartPaidService][google.cloud.channel.v1.CloudChannelService.StartPaidService]. + + Attributes: + name (str): + Required. The name of the entitlement to start a paid + service for. Name uses the format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + + +class CancelEntitlementRequest(proto.Message): + r"""Request message for + [CloudChannelService.CancelEntitlement][google.cloud.channel.v1.CloudChannelService.CancelEntitlement]. + + Attributes: + name (str): + Required. The resource name of the entitlement to cancel. + Name uses the format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + + +class SuspendEntitlementRequest(proto.Message): + r"""Request message for + [CloudChannelService.SuspendEntitlement][google.cloud.channel.v1.CloudChannelService.SuspendEntitlement]. + + Attributes: + name (str): + Required. The resource name of the entitlement to suspend. + Name uses the format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + + +class ActivateEntitlementRequest(proto.Message): + r"""Request message for + [CloudChannelService.ActivateEntitlement][google.cloud.channel.v1.CloudChannelService.ActivateEntitlement]. + + Attributes: + name (str): + Required. The resource name of the entitlement to activate. + Name uses the format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + request_id (str): + Optional. You can specify an optional unique request ID, and + if you need to retry your request, the server will know to + ignore the request if it's complete. + + For example, you make an initial request and the request + times out. If you make the request again with the same + request ID, the server can check if it received the original + operation with the same request ID. If it did, it will + ignore the second request. + + The request ID must be a valid + `UUID `__ with the + exception that zero UUID is not supported + (``00000000-0000-0000-0000-000000000000``). + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + request_id = proto.Field( + proto.STRING, + number=3, + ) + + +class LookupOfferRequest(proto.Message): + r"""Request message for LookupOffer. + + Attributes: + entitlement (str): + Required. The resource name of the entitlement to retrieve + the Offer. Entitlement uses the format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + """ + + entitlement = proto.Field( + proto.STRING, + number=1, + ) + + +class ListProductsRequest(proto.Message): + r"""Request message for ListProducts. + + Attributes: + account (str): + Required. The resource name of the reseller account. Format: + accounts/{account_id}. + page_size (int): + Optional. Requested page size. Server might + return fewer results than requested. If + unspecified, returns at most 100 Products. The + maximum value is 1000; the server will coerce + values above 1000. + page_token (str): + Optional. A token for a page of results other + than the first page. + language_code (str): + Optional. The BCP-47 language code. For + example, "en-US". The response will localize in + the corresponding language code, if specified. + The default value is "en-US". + """ + + account = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + language_code = proto.Field( + proto.STRING, + number=4, + ) + + +class ListProductsResponse(proto.Message): + r"""Response message for ListProducts. + + Attributes: + products (Sequence[google.cloud.channel_v1.types.Product]): + List of Products requested. + next_page_token (str): + A token to retrieve the next page of results. + """ + + @property + def raw_page(self): + return self + + products = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gcc_products.Product, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class ListSkusRequest(proto.Message): + r"""Request message for ListSkus. + + Attributes: + parent (str): + Required. The resource name of the Product to list SKUs for. + Parent uses the format: products/{product_id}. Supports + products/- to retrieve SKUs for all products. + account (str): + Required. Resource name of the reseller. Format: + accounts/{account_id}. + page_size (int): + Optional. Requested page size. Server might + return fewer results than requested. If + unspecified, returns at most 100 SKUs. The + maximum value is 1000; the server will coerce + values above 1000. + page_token (str): + Optional. A token for a page of results other + than the first page. Optional. + language_code (str): + Optional. The BCP-47 language code. For + example, "en-US". The response will localize in + the corresponding language code, if specified. + The default value is "en-US". + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + account = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) + language_code = proto.Field( + proto.STRING, + number=5, + ) + + +class ListSkusResponse(proto.Message): + r"""Response message for ListSkus. + + Attributes: + skus (Sequence[google.cloud.channel_v1.types.Sku]): + The list of SKUs requested. + next_page_token (str): + A token to retrieve the next page of results. + """ + + @property + def raw_page(self): + return self + + skus = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gcc_products.Sku, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class ListOffersRequest(proto.Message): + r"""Request message for ListOffers. + + Attributes: + parent (str): + Required. The resource name of the reseller account from + which to list Offers. Parent uses the format: + accounts/{account_id}. + page_size (int): + Optional. Requested page size. Server might + return fewer results than requested. If + unspecified, returns at most 500 Offers. The + maximum value is 1000; the server will coerce + values above 1000. + page_token (str): + Optional. A token for a page of results other + than the first page. + filter (str): + Optional. The expression to filter results by + name (name of the Offer), sku.name (name of the + SKU), or sku.product.name (name of the Product). + Example 1: sku.product.name=products/p1 AND + sku.name!=products/p1/skus/s1 Example 2: + name=accounts/a1/offers/o1 + language_code (str): + Optional. The BCP-47 language code. For + example, "en-US". The response will localize in + the corresponding language code, if specified. + The default value is "en-US". + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + language_code = proto.Field( + proto.STRING, + number=5, + ) + + +class ListOffersResponse(proto.Message): + r"""Response message for ListOffers. + + Attributes: + offers (Sequence[google.cloud.channel_v1.types.Offer]): + The list of Offers requested. + next_page_token (str): + A token to retrieve the next page of results. + """ + + @property + def raw_page(self): + return self + + offers = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gcc_offers.Offer, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class ListPurchasableSkusRequest(proto.Message): + r"""Request message for ListPurchasableSkus. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + create_entitlement_purchase (google.cloud.channel_v1.types.ListPurchasableSkusRequest.CreateEntitlementPurchase): + List SKUs for CreateEntitlement purchase. + + This field is a member of `oneof`_ ``purchase_option``. + change_offer_purchase (google.cloud.channel_v1.types.ListPurchasableSkusRequest.ChangeOfferPurchase): + List SKUs for ChangeOffer purchase with a new + SKU. + + This field is a member of `oneof`_ ``purchase_option``. + customer (str): + Required. The resource name of the customer to list SKUs + for. Format: accounts/{account_id}/customers/{customer_id}. + page_size (int): + Optional. Requested page size. Server might + return fewer results than requested. If + unspecified, returns at most 100 SKUs. The + maximum value is 1000; the server will coerce + values above 1000. + page_token (str): + Optional. A token for a page of results other + than the first page. + language_code (str): + Optional. The BCP-47 language code. For + example, "en-US". The response will localize in + the corresponding language code, if specified. + The default value is "en-US". + """ + + class CreateEntitlementPurchase(proto.Message): + r"""List SKUs for a new entitlement. Make the purchase using + [CloudChannelService.CreateEntitlement][google.cloud.channel.v1.CloudChannelService.CreateEntitlement]. + + Attributes: + product (str): + Required. List SKUs belonging to this Product. Format: + products/{product_id}. Supports products/- to retrieve SKUs + for all products. + """ + + product = proto.Field( + proto.STRING, + number=1, + ) + + class ChangeOfferPurchase(proto.Message): + r"""List SKUs for upgrading or downgrading an entitlement. Make the + purchase using + [CloudChannelService.ChangeOffer][google.cloud.channel.v1.CloudChannelService.ChangeOffer]. + + Attributes: + entitlement (str): + Required. Resource name of the entitlement. Format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + change_type (google.cloud.channel_v1.types.ListPurchasableSkusRequest.ChangeOfferPurchase.ChangeType): + Required. Change Type for the entitlement. + """ + class ChangeType(proto.Enum): + r"""Change Type enum.""" + CHANGE_TYPE_UNSPECIFIED = 0 + UPGRADE = 1 + DOWNGRADE = 2 + + entitlement = proto.Field( + proto.STRING, + number=1, + ) + change_type = proto.Field( + proto.ENUM, + number=2, + enum='ListPurchasableSkusRequest.ChangeOfferPurchase.ChangeType', + ) + + create_entitlement_purchase = proto.Field( + proto.MESSAGE, + number=2, + oneof='purchase_option', + message=CreateEntitlementPurchase, + ) + change_offer_purchase = proto.Field( + proto.MESSAGE, + number=3, + oneof='purchase_option', + message=ChangeOfferPurchase, + ) + customer = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=4, + ) + page_token = proto.Field( + proto.STRING, + number=5, + ) + language_code = proto.Field( + proto.STRING, + number=6, + ) + + +class ListPurchasableSkusResponse(proto.Message): + r"""Response message for ListPurchasableSkus. + + Attributes: + purchasable_skus (Sequence[google.cloud.channel_v1.types.PurchasableSku]): + The list of SKUs requested. + next_page_token (str): + A token to retrieve the next page of results. + """ + + @property + def raw_page(self): + return self + + purchasable_skus = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='PurchasableSku', + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class PurchasableSku(proto.Message): + r"""SKU that you can purchase. This is used in ListPurchasableSku + API response. + + Attributes: + sku (google.cloud.channel_v1.types.Sku): + SKU + """ + + sku = proto.Field( + proto.MESSAGE, + number=1, + message=gcc_products.Sku, + ) + + +class ListPurchasableOffersRequest(proto.Message): + r"""Request message for ListPurchasableOffers. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + create_entitlement_purchase (google.cloud.channel_v1.types.ListPurchasableOffersRequest.CreateEntitlementPurchase): + List Offers for CreateEntitlement purchase. + + This field is a member of `oneof`_ ``purchase_option``. + change_offer_purchase (google.cloud.channel_v1.types.ListPurchasableOffersRequest.ChangeOfferPurchase): + List Offers for ChangeOffer purchase. + + This field is a member of `oneof`_ ``purchase_option``. + customer (str): + Required. The resource name of the customer to list Offers + for. Format: accounts/{account_id}/customers/{customer_id}. + page_size (int): + Optional. Requested page size. Server might + return fewer results than requested. If + unspecified, returns at most 100 Offers. The + maximum value is 1000; the server will coerce + values above 1000. + page_token (str): + Optional. A token for a page of results other + than the first page. + language_code (str): + Optional. The BCP-47 language code. For + example, "en-US". The response will localize in + the corresponding language code, if specified. + The default value is "en-US". + """ + + class CreateEntitlementPurchase(proto.Message): + r"""List Offers for CreateEntitlement purchase. + + Attributes: + sku (str): + Required. SKU that the result should be restricted to. + Format: products/{product_id}/skus/{sku_id}. + """ + + sku = proto.Field( + proto.STRING, + number=1, + ) + + class ChangeOfferPurchase(proto.Message): + r"""List Offers for ChangeOffer purchase. + + Attributes: + entitlement (str): + Required. Resource name of the entitlement. Format: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + new_sku (str): + Optional. Resource name of the new target SKU. Provide this + SKU when upgrading or downgrading an entitlement. Format: + products/{product_id}/skus/{sku_id} + """ + + entitlement = proto.Field( + proto.STRING, + number=1, + ) + new_sku = proto.Field( + proto.STRING, + number=2, + ) + + create_entitlement_purchase = proto.Field( + proto.MESSAGE, + number=2, + oneof='purchase_option', + message=CreateEntitlementPurchase, + ) + change_offer_purchase = proto.Field( + proto.MESSAGE, + number=3, + oneof='purchase_option', + message=ChangeOfferPurchase, + ) + customer = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=4, + ) + page_token = proto.Field( + proto.STRING, + number=5, + ) + language_code = proto.Field( + proto.STRING, + number=6, + ) + + +class ListPurchasableOffersResponse(proto.Message): + r"""Response message for ListPurchasableOffers. + + Attributes: + purchasable_offers (Sequence[google.cloud.channel_v1.types.PurchasableOffer]): + The list of Offers requested. + next_page_token (str): + A token to retrieve the next page of results. + """ + + @property + def raw_page(self): + return self + + purchasable_offers = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='PurchasableOffer', + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class PurchasableOffer(proto.Message): + r"""Offer that you can purchase for a customer. This is used in + the ListPurchasableOffer API response. + + Attributes: + offer (google.cloud.channel_v1.types.Offer): + Offer. + """ + + offer = proto.Field( + proto.MESSAGE, + number=1, + message=gcc_offers.Offer, + ) + + +class RegisterSubscriberRequest(proto.Message): + r"""Request Message for RegisterSubscriber. + + Attributes: + account (str): + Required. Resource name of the account. + service_account (str): + Required. Service account that provides + subscriber access to the registered topic. + """ + + account = proto.Field( + proto.STRING, + number=1, + ) + service_account = proto.Field( + proto.STRING, + number=2, + ) + + +class RegisterSubscriberResponse(proto.Message): + r"""Response Message for RegisterSubscriber. + + Attributes: + topic (str): + Name of the topic the subscriber will listen + to. + """ + + topic = proto.Field( + proto.STRING, + number=1, + ) + + +class UnregisterSubscriberRequest(proto.Message): + r"""Request Message for UnregisterSubscriber. + + Attributes: + account (str): + Required. Resource name of the account. + service_account (str): + Required. Service account to unregister from + subscriber access to the topic. + """ + + account = proto.Field( + proto.STRING, + number=1, + ) + service_account = proto.Field( + proto.STRING, + number=2, + ) + + +class UnregisterSubscriberResponse(proto.Message): + r"""Response Message for UnregisterSubscriber. + + Attributes: + topic (str): + Name of the topic the service account + subscriber access was removed from. + """ + + topic = proto.Field( + proto.STRING, + number=1, + ) + + +class ListSubscribersRequest(proto.Message): + r"""Request Message for ListSubscribers. + + Attributes: + account (str): + Required. Resource name of the account. + page_size (int): + Optional. The maximum number of service + accounts to return. The service may return fewer + than this value. If unspecified, returns at most + 100 service accounts. The maximum value is 1000; + the server will coerce values above 1000. + page_token (str): + Optional. A page token, received from a previous + ``ListSubscribers`` call. Provide this to retrieve the + subsequent page. + + When paginating, all other parameters provided to + ``ListSubscribers`` must match the call that provided the + page token. + """ + + account = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + + +class ListSubscribersResponse(proto.Message): + r"""Response Message for ListSubscribers. + + Attributes: + topic (str): + Name of the topic registered with the + reseller. + service_accounts (Sequence[str]): + List of service accounts which have + subscriber access to the topic. + next_page_token (str): + A token that can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + """ + + @property + def raw_page(self): + return self + + topic = proto.Field( + proto.STRING, + number=1, + ) + service_accounts = proto.RepeatedField( + proto.STRING, + number=2, + ) + next_page_token = proto.Field( + proto.STRING, + number=3, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/subscriber_event.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/subscriber_event.py new file mode 100644 index 0000000..cb10195 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/channel_v1/types/subscriber_event.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import proto # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.channel.v1', + manifest={ + 'CustomerEvent', + 'EntitlementEvent', + 'SubscriberEvent', + }, +) + + +class CustomerEvent(proto.Message): + r"""Represents Pub/Sub message content describing customer + update. + + Attributes: + customer (str): + Resource name of the customer. Format: + accounts/{account_id}/customers/{customer_id} + event_type (google.cloud.channel_v1.types.CustomerEvent.Type): + Type of event which happened on the customer. + """ + class Type(proto.Enum): + r"""Type of customer event.""" + TYPE_UNSPECIFIED = 0 + PRIMARY_DOMAIN_CHANGED = 1 + PRIMARY_DOMAIN_VERIFIED = 2 + + customer = proto.Field( + proto.STRING, + number=1, + ) + event_type = proto.Field( + proto.ENUM, + number=2, + enum=Type, + ) + + +class EntitlementEvent(proto.Message): + r"""Represents Pub/Sub message content describing entitlement + update. + + Attributes: + entitlement (str): + Resource name of an entitlement of the form: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + event_type (google.cloud.channel_v1.types.EntitlementEvent.Type): + Type of event which happened on the + entitlement. + """ + class Type(proto.Enum): + r"""Type of entitlement event.""" + TYPE_UNSPECIFIED = 0 + CREATED = 1 + PRICE_PLAN_SWITCHED = 3 + COMMITMENT_CHANGED = 4 + RENEWED = 5 + SUSPENDED = 6 + ACTIVATED = 7 + CANCELLED = 8 + SKU_CHANGED = 9 + RENEWAL_SETTING_CHANGED = 10 + PAID_SERVICE_STARTED = 11 + LICENSE_ASSIGNMENT_CHANGED = 12 + LICENSE_CAP_CHANGED = 13 + + entitlement = proto.Field( + proto.STRING, + number=1, + ) + event_type = proto.Field( + proto.ENUM, + number=2, + enum=Type, + ) + + +class SubscriberEvent(proto.Message): + r"""Represents information which resellers will get as part of + notification from Pub/Sub. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + customer_event (google.cloud.channel_v1.types.CustomerEvent): + Customer event sent as part of Pub/Sub event + to partners. + + This field is a member of `oneof`_ ``event``. + entitlement_event (google.cloud.channel_v1.types.EntitlementEvent): + Entitlement event sent as part of Pub/Sub + event to partners. + + This field is a member of `oneof`_ ``event``. + """ + + customer_event = proto.Field( + proto.MESSAGE, + number=1, + oneof='event', + message='CustomerEvent', + ) + entitlement_event = proto.Field( + proto.MESSAGE, + number=2, + oneof='event', + message='EntitlementEvent', + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/mypy.ini b/owl-bot-staging/v1/mypy.ini new file mode 100644 index 0000000..574c5ae --- /dev/null +++ b/owl-bot-staging/v1/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.7 +namespace_packages = True diff --git a/owl-bot-staging/v1/noxfile.py b/owl-bot-staging/v1/noxfile.py new file mode 100644 index 0000000..5af5e43 --- /dev/null +++ b/owl-bot-staging/v1/noxfile.py @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +import pathlib +import shutil +import subprocess +import sys + + +import nox # type: ignore + +ALL_PYTHON = [ + "3.7", + "3.8", + "3.9", + "3.10", +] + +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") + +BLACK_VERSION = "black==22.3.0" +BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] +DEFAULT_PYTHON_VERSION = "3.10" + +nox.sessions = [ + "unit", + "cover", + "mypy", + "check_lower_bounds" + # exclude update_lower_bounds from default + "docs", + "blacken", + "lint", + "lint_setup_py", +] + +@nox.session(python=ALL_PYTHON) +def unit(session): + """Run the unit test suite.""" + + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + session.install('-e', '.') + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/channel_v1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)) + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def cover(session): + """Run the final coverage report. + This outputs the coverage report aggregating coverage from the unit + test runs (not system test runs), and then erases coverage data. + """ + session.install("coverage", "pytest-cov") + session.run("coverage", "report", "--show-missing", "--fail-under=100") + + session.run("coverage", "erase") + + +@nox.session(python=ALL_PYTHON) +def mypy(session): + """Run the type checker.""" + session.install('mypy', 'types-pkg_resources') + session.install('.') + session.run( + 'mypy', + '--explicit-package-bases', + 'google', + ) + + +@nox.session +def update_lower_bounds(session): + """Update lower bounds in constraints.txt to match setup.py""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'update', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + + +@nox.session +def check_lower_bounds(session): + """Check lower bounds in setup.py are reflected in constraints file""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'check', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def docs(session): + """Build the docs for this library.""" + + session.install("-e", ".") + session.install("sphinx==4.0.1", "alabaster", "recommonmark") + + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) + session.run( + "sphinx-build", + "-W", # warnings as errors + "-T", # show full traceback on exception + "-N", # no colors + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint(session): + """Run linters. + + Returns a failure if the linters find linting errors or sufficiently + serious code quality issues. + """ + session.install("flake8", BLACK_VERSION) + session.run( + "black", + "--check", + *BLACK_PATHS, + ) + session.run("flake8", "google", "tests", "samples") + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def blacken(session): + """Run black. Format code to uniform standard.""" + session.install(BLACK_VERSION) + session.run( + "black", + *BLACK_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint_setup_py(session): + """Verify that setup.py is valid (including RST check).""" + session.install("docutils", "pygments") + session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py new file mode 100644 index 0000000..c951243 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchReportResults +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_fetch_report_results(): + # Create a client + client = channel_v1.CloudChannelReportsServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.FetchReportResultsRequest( + report_job="report_job_value", + ) + + # Make the request + page_result = client.fetch_report_results(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py new file mode 100644 index 0000000..ee3906a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchReportResults +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_fetch_report_results(): + # Create a client + client = channel_v1.CloudChannelReportsServiceClient() + + # Initialize request argument(s) + request = channel_v1.FetchReportResultsRequest( + report_job="report_job_value", + ) + + # Make the request + page_result = client.fetch_report_results(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py new file mode 100644 index 0000000..6a86357 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListReports +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelReportsService_ListReports_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_reports(): + # Create a client + client = channel_v1.CloudChannelReportsServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListReportsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reports(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelReportsService_ListReports_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py new file mode 100644 index 0000000..321436e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListReports +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelReportsService_ListReports_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_reports(): + # Create a client + client = channel_v1.CloudChannelReportsServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListReportsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reports(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelReportsService_ListReports_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py new file mode 100644 index 0000000..77e08d0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RunReportJob +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_run_report_job(): + # Create a client + client = channel_v1.CloudChannelReportsServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.RunReportJobRequest( + name="name_value", + ) + + # Make the request + operation = client.run_report_job(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py new file mode 100644 index 0000000..0ccde93 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RunReportJob +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_run_report_job(): + # Create a client + client = channel_v1.CloudChannelReportsServiceClient() + + # Initialize request argument(s) + request = channel_v1.RunReportJobRequest( + name="name_value", + ) + + # Make the request + operation = client.run_report_job(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py new file mode 100644 index 0000000..e51fe9b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ActivateEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_activate_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ActivateEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.activate_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py new file mode 100644 index 0000000..ba7dacb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ActivateEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_activate_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ActivateEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.activate_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py new file mode 100644 index 0000000..9b58fcc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CancelEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_cancel_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.CancelEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.cancel_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py new file mode 100644 index 0000000..d8e3aed --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CancelEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_cancel_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.CancelEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.cancel_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py new file mode 100644 index 0000000..c30881b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ChangeOffer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ChangeOffer_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_change_offer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ChangeOfferRequest( + name="name_value", + offer="offer_value", + ) + + # Make the request + operation = client.change_offer(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ChangeOffer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py new file mode 100644 index 0000000..f155931 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ChangeOffer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ChangeOffer_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_change_offer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ChangeOfferRequest( + name="name_value", + offer="offer_value", + ) + + # Make the request + operation = client.change_offer(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ChangeOffer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py new file mode 100644 index 0000000..6227a9f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ChangeParameters +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ChangeParameters_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_change_parameters(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ChangeParametersRequest( + name="name_value", + ) + + # Make the request + operation = client.change_parameters(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ChangeParameters_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py new file mode 100644 index 0000000..d5943ca --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ChangeParameters +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ChangeParameters_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_change_parameters(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ChangeParametersRequest( + name="name_value", + ) + + # Make the request + operation = client.change_parameters(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ChangeParameters_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py new file mode 100644 index 0000000..a8117c6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ChangeRenewalSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_change_renewal_settings(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ChangeRenewalSettingsRequest( + name="name_value", + ) + + # Make the request + operation = client.change_renewal_settings(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py new file mode 100644 index 0000000..4e99a45 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ChangeRenewalSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_change_renewal_settings(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ChangeRenewalSettingsRequest( + name="name_value", + ) + + # Make the request + operation = client.change_renewal_settings(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py new file mode 100644 index 0000000..79b8402 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CheckCloudIdentityAccountsExist +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_check_cloud_identity_accounts_exist(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.CheckCloudIdentityAccountsExistRequest( + parent="parent_value", + domain="domain_value", + ) + + # Make the request + response = await client.check_cloud_identity_accounts_exist(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py new file mode 100644 index 0000000..205b5c3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CheckCloudIdentityAccountsExist +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_check_cloud_identity_accounts_exist(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.CheckCloudIdentityAccountsExistRequest( + parent="parent_value", + domain="domain_value", + ) + + # Make the request + response = client.check_cloud_identity_accounts_exist(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py new file mode 100644 index 0000000..0205857 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateChannelPartnerLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_create_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + channel_partner_link = channel_v1.ChannelPartnerLink() + channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" + channel_partner_link.link_state = "SUSPENDED" + + request = channel_v1.CreateChannelPartnerLinkRequest( + parent="parent_value", + channel_partner_link=channel_partner_link, + ) + + # Make the request + response = await client.create_channel_partner_link(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py new file mode 100644 index 0000000..019526d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateChannelPartnerLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_create_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + channel_partner_link = channel_v1.ChannelPartnerLink() + channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" + channel_partner_link.link_state = "SUSPENDED" + + request = channel_v1.CreateChannelPartnerLinkRequest( + parent="parent_value", + channel_partner_link=channel_partner_link, + ) + + # Make the request + response = client.create_channel_partner_link(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py new file mode 100644 index 0000000..b0e4e83 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateChannelPartnerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_create_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() + channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.CreateChannelPartnerRepricingConfigRequest( + parent="parent_value", + channel_partner_repricing_config=channel_partner_repricing_config, + ) + + # Make the request + response = await client.create_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py new file mode 100644 index 0000000..fd52745 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateChannelPartnerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_create_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() + channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.CreateChannelPartnerRepricingConfigRequest( + parent="parent_value", + channel_partner_repricing_config=channel_partner_repricing_config, + ) + + # Make the request + response = client.create_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py new file mode 100644 index 0000000..b48c8f4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateCustomer_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_create_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + customer = channel_v1.Customer() + customer.org_display_name = "org_display_name_value" + customer.domain = "domain_value" + + request = channel_v1.CreateCustomerRequest( + parent="parent_value", + customer=customer, + ) + + # Make the request + response = await client.create_customer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py new file mode 100644 index 0000000..fa85f43 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCustomerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_create_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + customer_repricing_config = channel_v1.CustomerRepricingConfig() + customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.CreateCustomerRepricingConfigRequest( + parent="parent_value", + customer_repricing_config=customer_repricing_config, + ) + + # Make the request + response = await client.create_customer_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py new file mode 100644 index 0000000..41507df --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCustomerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_create_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + customer_repricing_config = channel_v1.CustomerRepricingConfig() + customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.CreateCustomerRepricingConfigRequest( + parent="parent_value", + customer_repricing_config=customer_repricing_config, + ) + + # Make the request + response = client.create_customer_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py new file mode 100644 index 0000000..1627123 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateCustomer_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_create_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + customer = channel_v1.Customer() + customer.org_display_name = "org_display_name_value" + customer.domain = "domain_value" + + request = channel_v1.CreateCustomerRequest( + parent="parent_value", + customer=customer, + ) + + # Make the request + response = client.create_customer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py new file mode 100644 index 0000000..dee1522 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_create_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + entitlement = channel_v1.Entitlement() + entitlement.offer = "offer_value" + + request = channel_v1.CreateEntitlementRequest( + parent="parent_value", + entitlement=entitlement, + ) + + # Make the request + operation = client.create_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py new file mode 100644 index 0000000..39469aa --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_create_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + entitlement = channel_v1.Entitlement() + entitlement.offer = "offer_value" + + request = channel_v1.CreateEntitlementRequest( + parent="parent_value", + entitlement=entitlement, + ) + + # Make the request + operation = client.create_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py new file mode 100644 index 0000000..1de90da --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteChannelPartnerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_delete_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.DeleteChannelPartnerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + await client.delete_channel_partner_repricing_config(request=request) + + +# [END cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py new file mode 100644 index 0000000..2bf87ed --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteChannelPartnerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_delete_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.DeleteChannelPartnerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + client.delete_channel_partner_repricing_config(request=request) + + +# [END cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py new file mode 100644 index 0000000..350f212 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_delete_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.DeleteCustomerRequest( + name="name_value", + ) + + # Make the request + await client.delete_customer(request=request) + + +# [END cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py new file mode 100644 index 0000000..a74e37b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCustomerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_delete_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.DeleteCustomerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + await client.delete_customer_repricing_config(request=request) + + +# [END cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py new file mode 100644 index 0000000..ba4ce79 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCustomerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_delete_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.DeleteCustomerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + client.delete_customer_repricing_config(request=request) + + +# [END cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py new file mode 100644 index 0000000..cc3250a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_delete_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.DeleteCustomerRequest( + name="name_value", + ) + + # Make the request + client.delete_customer(request=request) + + +# [END cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py new file mode 100644 index 0000000..e5c97fb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetChannelPartnerLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_get_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetChannelPartnerLinkRequest( + name="name_value", + ) + + # Make the request + response = await client.get_channel_partner_link(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py new file mode 100644 index 0000000..2c31f56 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetChannelPartnerLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_get_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetChannelPartnerLinkRequest( + name="name_value", + ) + + # Make the request + response = client.get_channel_partner_link(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py new file mode 100644 index 0000000..27efc1e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetChannelPartnerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_get_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetChannelPartnerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + response = await client.get_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py new file mode 100644 index 0000000..079f538 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetChannelPartnerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_get_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetChannelPartnerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + response = client.get_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py new file mode 100644 index 0000000..74b3ac3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetCustomer_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_get_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetCustomerRequest( + name="name_value", + ) + + # Make the request + response = await client.get_customer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py new file mode 100644 index 0000000..fae377b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCustomerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_get_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetCustomerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + response = await client.get_customer_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py new file mode 100644 index 0000000..0b7d36e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCustomerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_get_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetCustomerRepricingConfigRequest( + name="name_value", + ) + + # Make the request + response = client.get_customer_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py new file mode 100644 index 0000000..ce75381 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetCustomer_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_get_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetCustomerRequest( + name="name_value", + ) + + # Make the request + response = client.get_customer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py new file mode 100644 index 0000000..db19cc9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetEntitlement_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_get_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.GetEntitlementRequest( + name="name_value", + ) + + # Make the request + response = await client.get_entitlement(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py new file mode 100644 index 0000000..e8b80c0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_GetEntitlement_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_get_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.GetEntitlementRequest( + name="name_value", + ) + + # Make the request + response = client.get_entitlement(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_GetEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py new file mode 100644 index 0000000..e9a6fe8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ImportCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ImportCustomer_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_import_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ImportCustomerRequest( + domain="domain_value", + parent="parent_value", + overwrite_if_exists=True, + ) + + # Make the request + response = await client.import_customer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ImportCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py new file mode 100644 index 0000000..79a50c6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ImportCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ImportCustomer_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_import_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ImportCustomerRequest( + domain="domain_value", + parent="parent_value", + overwrite_if_exists=True, + ) + + # Make the request + response = client.import_customer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ImportCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py new file mode 100644 index 0000000..30bbbc9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListChannelPartnerLinks +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_channel_partner_links(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListChannelPartnerLinksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_channel_partner_links(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py new file mode 100644 index 0000000..142d6ca --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListChannelPartnerLinks +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_channel_partner_links(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListChannelPartnerLinksRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_channel_partner_links(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py new file mode 100644 index 0000000..92364fb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListChannelPartnerRepricingConfigs +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_channel_partner_repricing_configs(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListChannelPartnerRepricingConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_channel_partner_repricing_configs(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py new file mode 100644 index 0000000..f5092d2 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListChannelPartnerRepricingConfigs +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_channel_partner_repricing_configs(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListChannelPartnerRepricingConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_channel_partner_repricing_configs(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py new file mode 100644 index 0000000..49a44a4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCustomerRepricingConfigs +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_customer_repricing_configs(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListCustomerRepricingConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_customer_repricing_configs(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py new file mode 100644 index 0000000..e8a8daf --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCustomerRepricingConfigs +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_customer_repricing_configs(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListCustomerRepricingConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_customer_repricing_configs(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py new file mode 100644 index 0000000..d5ec42d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCustomers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListCustomers_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_customers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListCustomersRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_customers(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListCustomers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py new file mode 100644 index 0000000..6e18d14 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCustomers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListCustomers_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_customers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListCustomersRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_customers(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListCustomers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py new file mode 100644 index 0000000..ea274f1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListEntitlements +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListEntitlements_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_entitlements(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListEntitlementsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_entitlements(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListEntitlements_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py new file mode 100644 index 0000000..f525909 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListEntitlements +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListEntitlements_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_entitlements(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListEntitlementsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_entitlements(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListEntitlements_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py new file mode 100644 index 0000000..46ab716 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListOffers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListOffers_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_offers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListOffersRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_offers(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListOffers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py new file mode 100644 index 0000000..5e6e0db --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListOffers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListOffers_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_offers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListOffersRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_offers(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListOffers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_async.py new file mode 100644 index 0000000..fae9356 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListProducts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListProducts_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_products(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListProductsRequest( + account="account_value", + ) + + # Make the request + page_result = client.list_products(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListProducts_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py new file mode 100644 index 0000000..1f5298e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListProducts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListProducts_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_products(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListProductsRequest( + account="account_value", + ) + + # Make the request + page_result = client.list_products(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListProducts_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py new file mode 100644 index 0000000..5866cd8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPurchasableOffers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_purchasable_offers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() + create_entitlement_purchase.sku = "sku_value" + + request = channel_v1.ListPurchasableOffersRequest( + create_entitlement_purchase=create_entitlement_purchase, + customer="customer_value", + ) + + # Make the request + page_result = client.list_purchasable_offers(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py new file mode 100644 index 0000000..dbae981 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPurchasableOffers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_purchasable_offers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() + create_entitlement_purchase.sku = "sku_value" + + request = channel_v1.ListPurchasableOffersRequest( + create_entitlement_purchase=create_entitlement_purchase, + customer="customer_value", + ) + + # Make the request + page_result = client.list_purchasable_offers(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py new file mode 100644 index 0000000..8c3088f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPurchasableSkus +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_purchasable_skus(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() + create_entitlement_purchase.product = "product_value" + + request = channel_v1.ListPurchasableSkusRequest( + create_entitlement_purchase=create_entitlement_purchase, + customer="customer_value", + ) + + # Make the request + page_result = client.list_purchasable_skus(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py new file mode 100644 index 0000000..0e6dd30 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPurchasableSkus +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_purchasable_skus(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() + create_entitlement_purchase.product = "product_value" + + request = channel_v1.ListPurchasableSkusRequest( + create_entitlement_purchase=create_entitlement_purchase, + customer="customer_value", + ) + + # Make the request + page_result = client.list_purchasable_skus(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py new file mode 100644 index 0000000..426f9bd --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListSkus +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListSkus_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_skus(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListSkusRequest( + parent="parent_value", + account="account_value", + ) + + # Make the request + page_result = client.list_skus(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListSkus_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py new file mode 100644 index 0000000..e24b741 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListSkus +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListSkus_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_skus(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListSkusRequest( + parent="parent_value", + account="account_value", + ) + + # Make the request + page_result = client.list_skus(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListSkus_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py new file mode 100644 index 0000000..0195bfb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListSubscribers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListSubscribers_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_subscribers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListSubscribersRequest( + account="account_value", + ) + + # Make the request + page_result = client.list_subscribers(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListSubscribers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py new file mode 100644 index 0000000..5348522 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListSubscribers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListSubscribers_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_subscribers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListSubscribersRequest( + account="account_value", + ) + + # Make the request + page_result = client.list_subscribers(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListSubscribers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py new file mode 100644 index 0000000..104aba7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTransferableOffers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_transferable_offers(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListTransferableOffersRequest( + cloud_identity_id="cloud_identity_id_value", + parent="parent_value", + sku="sku_value", + ) + + # Make the request + page_result = client.list_transferable_offers(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py new file mode 100644 index 0000000..a7b70b5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTransferableOffers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_transferable_offers(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListTransferableOffersRequest( + cloud_identity_id="cloud_identity_id_value", + parent="parent_value", + sku="sku_value", + ) + + # Make the request + page_result = client.list_transferable_offers(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py new file mode 100644 index 0000000..0427d3a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTransferableSkus +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_list_transferable_skus(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListTransferableSkusRequest( + cloud_identity_id="cloud_identity_id_value", + parent="parent_value", + ) + + # Make the request + page_result = client.list_transferable_skus(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py new file mode 100644 index 0000000..2255edb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTransferableSkus +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_list_transferable_skus(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListTransferableSkusRequest( + cloud_identity_id="cloud_identity_id_value", + parent="parent_value", + ) + + # Make the request + page_result = client.list_transferable_skus(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py new file mode 100644 index 0000000..936643e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for LookupOffer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_LookupOffer_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_lookup_offer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.LookupOfferRequest( + entitlement="entitlement_value", + ) + + # Make the request + response = await client.lookup_offer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_LookupOffer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py new file mode 100644 index 0000000..a0f5c74 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for LookupOffer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_LookupOffer_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_lookup_offer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.LookupOfferRequest( + entitlement="entitlement_value", + ) + + # Make the request + response = client.lookup_offer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_LookupOffer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py new file mode 100644 index 0000000..8ff3034 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ProvisionCloudIdentity +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_provision_cloud_identity(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ProvisionCloudIdentityRequest( + customer="customer_value", + ) + + # Make the request + operation = client.provision_cloud_identity(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py new file mode 100644 index 0000000..fe82de8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ProvisionCloudIdentity +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_provision_cloud_identity(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ProvisionCloudIdentityRequest( + customer="customer_value", + ) + + # Make the request + operation = client.provision_cloud_identity(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py new file mode 100644 index 0000000..d07471a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RegisterSubscriber +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_register_subscriber(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.RegisterSubscriberRequest( + account="account_value", + service_account="service_account_value", + ) + + # Make the request + response = await client.register_subscriber(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py new file mode 100644 index 0000000..ae53dfa --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RegisterSubscriber +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_register_subscriber(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.RegisterSubscriberRequest( + account="account_value", + service_account="service_account_value", + ) + + # Make the request + response = client.register_subscriber(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py new file mode 100644 index 0000000..7467019 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartPaidService +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_StartPaidService_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_start_paid_service(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.StartPaidServiceRequest( + name="name_value", + ) + + # Make the request + operation = client.start_paid_service(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_StartPaidService_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py new file mode 100644 index 0000000..d3f56f5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartPaidService +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_StartPaidService_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_start_paid_service(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.StartPaidServiceRequest( + name="name_value", + ) + + # Make the request + operation = client.start_paid_service(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_StartPaidService_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py new file mode 100644 index 0000000..260d7de --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for SuspendEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_suspend_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.SuspendEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.suspend_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py new file mode 100644 index 0000000..2b7683b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for SuspendEntitlement +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_suspend_entitlement(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.SuspendEntitlementRequest( + name="name_value", + ) + + # Make the request + operation = client.suspend_entitlement(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py new file mode 100644 index 0000000..ceada69 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TransferEntitlements +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_transfer_entitlements(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + entitlements = channel_v1.Entitlement() + entitlements.offer = "offer_value" + + request = channel_v1.TransferEntitlementsRequest( + parent="parent_value", + entitlements=entitlements, + ) + + # Make the request + operation = client.transfer_entitlements(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py new file mode 100644 index 0000000..5835e28 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TransferEntitlements +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_transfer_entitlements(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + entitlements = channel_v1.Entitlement() + entitlements.offer = "offer_value" + + request = channel_v1.TransferEntitlementsRequest( + parent="parent_value", + entitlements=entitlements, + ) + + # Make the request + operation = client.transfer_entitlements(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py new file mode 100644 index 0000000..87fee38 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TransferEntitlementsToGoogle +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_transfer_entitlements_to_google(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + entitlements = channel_v1.Entitlement() + entitlements.offer = "offer_value" + + request = channel_v1.TransferEntitlementsToGoogleRequest( + parent="parent_value", + entitlements=entitlements, + ) + + # Make the request + operation = client.transfer_entitlements_to_google(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py new file mode 100644 index 0000000..16e7853 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TransferEntitlementsToGoogle +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_transfer_entitlements_to_google(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + entitlements = channel_v1.Entitlement() + entitlements.offer = "offer_value" + + request = channel_v1.TransferEntitlementsToGoogleRequest( + parent="parent_value", + entitlements=entitlements, + ) + + # Make the request + operation = client.transfer_entitlements_to_google(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py new file mode 100644 index 0000000..5983d02 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UnregisterSubscriber +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_unregister_subscriber(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.UnregisterSubscriberRequest( + account="account_value", + service_account="service_account_value", + ) + + # Make the request + response = await client.unregister_subscriber(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py new file mode 100644 index 0000000..ab88607 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UnregisterSubscriber +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_unregister_subscriber(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.UnregisterSubscriberRequest( + account="account_value", + service_account="service_account_value", + ) + + # Make the request + response = client.unregister_subscriber(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py new file mode 100644 index 0000000..acbd021 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateChannelPartnerLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_update_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + channel_partner_link = channel_v1.ChannelPartnerLink() + channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" + channel_partner_link.link_state = "SUSPENDED" + + request = channel_v1.UpdateChannelPartnerLinkRequest( + name="name_value", + channel_partner_link=channel_partner_link, + ) + + # Make the request + response = await client.update_channel_partner_link(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py new file mode 100644 index 0000000..7b4aaad --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateChannelPartnerLink +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_update_channel_partner_link(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + channel_partner_link = channel_v1.ChannelPartnerLink() + channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" + channel_partner_link.link_state = "SUSPENDED" + + request = channel_v1.UpdateChannelPartnerLinkRequest( + name="name_value", + channel_partner_link=channel_partner_link, + ) + + # Make the request + response = client.update_channel_partner_link(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py new file mode 100644 index 0000000..8199bc2 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateChannelPartnerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_update_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() + channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.UpdateChannelPartnerRepricingConfigRequest( + channel_partner_repricing_config=channel_partner_repricing_config, + ) + + # Make the request + response = await client.update_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py new file mode 100644 index 0000000..94fed44 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateChannelPartnerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_update_channel_partner_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() + channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.UpdateChannelPartnerRepricingConfigRequest( + channel_partner_repricing_config=channel_partner_repricing_config, + ) + + # Make the request + response = client.update_channel_partner_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py new file mode 100644 index 0000000..3730dc8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_update_customer(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + customer = channel_v1.Customer() + customer.org_display_name = "org_display_name_value" + customer.domain = "domain_value" + + request = channel_v1.UpdateCustomerRequest( + customer=customer, + ) + + # Make the request + response = await client.update_customer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py new file mode 100644 index 0000000..28e86c9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCustomerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +async def sample_update_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + customer_repricing_config = channel_v1.CustomerRepricingConfig() + customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.UpdateCustomerRepricingConfigRequest( + customer_repricing_config=customer_repricing_config, + ) + + # Make the request + response = await client.update_customer_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py new file mode 100644 index 0000000..6f71c7c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCustomerRepricingConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_update_customer_repricing_config(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + customer_repricing_config = channel_v1.CustomerRepricingConfig() + customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" + + request = channel_v1.UpdateCustomerRepricingConfigRequest( + customer_repricing_config=customer_repricing_config, + ) + + # Make the request + response = client.update_customer_repricing_config(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py new file mode 100644 index 0000000..626c660 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCustomer +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-channel + + +# [START cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud import channel_v1 + + +def sample_update_customer(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + customer = channel_v1.Customer() + customer.org_display_name = "org_display_name_value" + customer.domain = "domain_value" + + request = channel_v1.UpdateCustomerRequest( + customer=customer, + ) + + # Make the request + response = client.update_customer(request=request) + + # Handle the response + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_channel_v1.json b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_channel_v1.json new file mode 100644 index 0000000..44fb553 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_channel_v1.json @@ -0,0 +1,7468 @@ +{ + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.channel.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-channel" + }, + "snippets": [ + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient", + "shortName": "CloudChannelReportsServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient.fetch_report_results", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "FetchReportResults" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.FetchReportResultsRequest" + }, + { + "name": "report_job", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.FetchReportResultsAsyncPager", + "shortName": "fetch_report_results" + }, + "description": "Sample for FetchReportResults", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient", + "shortName": "CloudChannelReportsServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient.fetch_report_results", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "FetchReportResults" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.FetchReportResultsRequest" + }, + { + "name": "report_job", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.FetchReportResultsPager", + "shortName": "fetch_report_results" + }, + "description": "Sample for FetchReportResults", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient", + "shortName": "CloudChannelReportsServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient.list_reports", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.ListReports", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "ListReports" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListReportsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.ListReportsAsyncPager", + "shortName": "list_reports" + }, + "description": "Sample for ListReports", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_ListReports_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient", + "shortName": "CloudChannelReportsServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient.list_reports", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.ListReports", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "ListReports" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListReportsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.ListReportsPager", + "shortName": "list_reports" + }, + "description": "Sample for ListReports", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_ListReports_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient", + "shortName": "CloudChannelReportsServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient.run_report_job", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.RunReportJob", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "RunReportJob" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.RunReportJobRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "run_report_job" + }, + "description": "Sample for RunReportJob", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient", + "shortName": "CloudChannelReportsServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient.run_report_job", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.RunReportJob", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "RunReportJob" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.RunReportJobRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "run_report_job" + }, + "description": "Sample for RunReportJob", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.activate_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ActivateEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ActivateEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ActivateEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "activate_entitlement" + }, + "description": "Sample for ActivateEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.activate_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ActivateEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ActivateEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ActivateEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "activate_entitlement" + }, + "description": "Sample for ActivateEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.cancel_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CancelEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CancelEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CancelEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "cancel_entitlement" + }, + "description": "Sample for CancelEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.cancel_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CancelEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CancelEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CancelEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "cancel_entitlement" + }, + "description": "Sample for CancelEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.change_offer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeOffer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ChangeOffer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ChangeOfferRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "change_offer" + }, + "description": "Sample for ChangeOffer", + "file": "cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeOffer_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.change_offer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeOffer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ChangeOffer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ChangeOfferRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "change_offer" + }, + "description": "Sample for ChangeOffer", + "file": "cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeOffer_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.change_parameters", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeParameters", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ChangeParameters" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ChangeParametersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "change_parameters" + }, + "description": "Sample for ChangeParameters", + "file": "cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeParameters_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.change_parameters", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeParameters", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ChangeParameters" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ChangeParametersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "change_parameters" + }, + "description": "Sample for ChangeParameters", + "file": "cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeParameters_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.change_renewal_settings", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ChangeRenewalSettings" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ChangeRenewalSettingsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "change_renewal_settings" + }, + "description": "Sample for ChangeRenewalSettings", + "file": "cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.change_renewal_settings", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ChangeRenewalSettings" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ChangeRenewalSettingsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "change_renewal_settings" + }, + "description": "Sample for ChangeRenewalSettings", + "file": "cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.check_cloud_identity_accounts_exist", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CheckCloudIdentityAccountsExist" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistResponse", + "shortName": "check_cloud_identity_accounts_exist" + }, + "description": "Sample for CheckCloudIdentityAccountsExist", + "file": "cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.check_cloud_identity_accounts_exist", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CheckCloudIdentityAccountsExist" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistResponse", + "shortName": "check_cloud_identity_accounts_exist" + }, + "description": "Sample for CheckCloudIdentityAccountsExist", + "file": "cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_channel_partner_link", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateChannelPartnerLink" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateChannelPartnerLinkRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", + "shortName": "create_channel_partner_link" + }, + "description": "Sample for CreateChannelPartnerLink", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_channel_partner_link", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateChannelPartnerLink" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateChannelPartnerLinkRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", + "shortName": "create_channel_partner_link" + }, + "description": "Sample for CreateChannelPartnerLink", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_channel_partner_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateChannelPartnerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateChannelPartnerRepricingConfigRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "channel_partner_repricing_config", + "type": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", + "shortName": "create_channel_partner_repricing_config" + }, + "description": "Sample for CreateChannelPartnerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_channel_partner_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateChannelPartnerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateChannelPartnerRepricingConfigRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "channel_partner_repricing_config", + "type": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", + "shortName": "create_channel_partner_repricing_config" + }, + "description": "Sample for CreateChannelPartnerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_customer_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateCustomerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateCustomerRepricingConfigRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "customer_repricing_config", + "type": "google.cloud.channel_v1.types.CustomerRepricingConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", + "shortName": "create_customer_repricing_config" + }, + "description": "Sample for CreateCustomerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_customer_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateCustomerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateCustomerRepricingConfigRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "customer_repricing_config", + "type": "google.cloud.channel_v1.types.CustomerRepricingConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", + "shortName": "create_customer_repricing_config" + }, + "description": "Sample for CreateCustomerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateCustomerRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Customer", + "shortName": "create_customer" + }, + "description": "Sample for CreateCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateCustomer_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateCustomerRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Customer", + "shortName": "create_customer" + }, + "description": "Sample for CreateCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateCustomer_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_entitlement" + }, + "description": "Sample for CreateEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_async", + "segments": [ + { + "end": 59, + "start": 27, + "type": "FULL" + }, + { + "end": 59, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 56, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 60, + "start": 57, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.CreateEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "CreateEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.CreateEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_entitlement" + }, + "description": "Sample for CreateEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_sync", + "segments": [ + { + "end": 59, + "start": 27, + "type": "FULL" + }, + { + "end": 59, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 56, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 60, + "start": 57, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.delete_channel_partner_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteChannelPartnerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "DeleteChannelPartnerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.DeleteChannelPartnerRepricingConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_channel_partner_repricing_config" + }, + "description": "Sample for DeleteChannelPartnerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.delete_channel_partner_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteChannelPartnerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "DeleteChannelPartnerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.DeleteChannelPartnerRepricingConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_channel_partner_repricing_config" + }, + "description": "Sample for DeleteChannelPartnerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.delete_customer_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "DeleteCustomerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.DeleteCustomerRepricingConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_customer_repricing_config" + }, + "description": "Sample for DeleteCustomerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.delete_customer_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "DeleteCustomerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.DeleteCustomerRepricingConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_customer_repricing_config" + }, + "description": "Sample for DeleteCustomerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.delete_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "DeleteCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.DeleteCustomerRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_customer" + }, + "description": "Sample for DeleteCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.delete_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "DeleteCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.DeleteCustomerRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_customer" + }, + "description": "Sample for DeleteCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_channel_partner_link", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetChannelPartnerLink" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetChannelPartnerLinkRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", + "shortName": "get_channel_partner_link" + }, + "description": "Sample for GetChannelPartnerLink", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_channel_partner_link", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetChannelPartnerLink" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetChannelPartnerLinkRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", + "shortName": "get_channel_partner_link" + }, + "description": "Sample for GetChannelPartnerLink", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_channel_partner_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetChannelPartnerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetChannelPartnerRepricingConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", + "shortName": "get_channel_partner_repricing_config" + }, + "description": "Sample for GetChannelPartnerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_channel_partner_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetChannelPartnerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetChannelPartnerRepricingConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", + "shortName": "get_channel_partner_repricing_config" + }, + "description": "Sample for GetChannelPartnerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_customer_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetCustomerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetCustomerRepricingConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", + "shortName": "get_customer_repricing_config" + }, + "description": "Sample for GetCustomerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_customer_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetCustomerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetCustomerRepricingConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", + "shortName": "get_customer_repricing_config" + }, + "description": "Sample for GetCustomerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetCustomerRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Customer", + "shortName": "get_customer" + }, + "description": "Sample for GetCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetCustomer_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetCustomerRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Customer", + "shortName": "get_customer" + }, + "description": "Sample for GetCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetCustomer_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Entitlement", + "shortName": "get_entitlement" + }, + "description": "Sample for GetEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetEntitlement_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.GetEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "GetEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.GetEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Entitlement", + "shortName": "get_entitlement" + }, + "description": "Sample for GetEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetEntitlement_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.import_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ImportCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ImportCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ImportCustomerRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Customer", + "shortName": "import_customer" + }, + "description": "Sample for ImportCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ImportCustomer_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.import_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ImportCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ImportCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ImportCustomerRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Customer", + "shortName": "import_customer" + }, + "description": "Sample for ImportCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ImportCustomer_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_channel_partner_links", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListChannelPartnerLinks" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListChannelPartnerLinksRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerLinksAsyncPager", + "shortName": "list_channel_partner_links" + }, + "description": "Sample for ListChannelPartnerLinks", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_channel_partner_links", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListChannelPartnerLinks" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListChannelPartnerLinksRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerLinksPager", + "shortName": "list_channel_partner_links" + }, + "description": "Sample for ListChannelPartnerLinks", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_channel_partner_repricing_configs", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListChannelPartnerRepricingConfigs" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerRepricingConfigsAsyncPager", + "shortName": "list_channel_partner_repricing_configs" + }, + "description": "Sample for ListChannelPartnerRepricingConfigs", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_channel_partner_repricing_configs", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListChannelPartnerRepricingConfigs" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerRepricingConfigsPager", + "shortName": "list_channel_partner_repricing_configs" + }, + "description": "Sample for ListChannelPartnerRepricingConfigs", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_customer_repricing_configs", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListCustomerRepricingConfigs" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomerRepricingConfigsAsyncPager", + "shortName": "list_customer_repricing_configs" + }, + "description": "Sample for ListCustomerRepricingConfigs", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_customer_repricing_configs", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListCustomerRepricingConfigs" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomerRepricingConfigsPager", + "shortName": "list_customer_repricing_configs" + }, + "description": "Sample for ListCustomerRepricingConfigs", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_customers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListCustomers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListCustomers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListCustomersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomersAsyncPager", + "shortName": "list_customers" + }, + "description": "Sample for ListCustomers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListCustomers_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_customers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListCustomers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListCustomers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListCustomersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomersPager", + "shortName": "list_customers" + }, + "description": "Sample for ListCustomers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListCustomers_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_entitlements", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListEntitlements", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListEntitlements" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListEntitlementsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListEntitlementsAsyncPager", + "shortName": "list_entitlements" + }, + "description": "Sample for ListEntitlements", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListEntitlements_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_entitlements", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListEntitlements", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListEntitlements" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListEntitlementsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListEntitlementsPager", + "shortName": "list_entitlements" + }, + "description": "Sample for ListEntitlements", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListEntitlements_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_offers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListOffers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListOffers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListOffersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListOffersAsyncPager", + "shortName": "list_offers" + }, + "description": "Sample for ListOffers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListOffers_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_offers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListOffers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListOffers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListOffersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListOffersPager", + "shortName": "list_offers" + }, + "description": "Sample for ListOffers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListOffers_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_products", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListProducts", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListProducts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListProductsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListProductsAsyncPager", + "shortName": "list_products" + }, + "description": "Sample for ListProducts", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_products_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListProducts_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_products_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_products", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListProducts", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListProducts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListProductsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListProductsPager", + "shortName": "list_products" + }, + "description": "Sample for ListProducts", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListProducts_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_purchasable_offers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListPurchasableOffers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListPurchasableOffers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListPurchasableOffersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableOffersAsyncPager", + "shortName": "list_purchasable_offers" + }, + "description": "Sample for ListPurchasableOffers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_purchasable_offers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListPurchasableOffers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListPurchasableOffers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListPurchasableOffersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableOffersPager", + "shortName": "list_purchasable_offers" + }, + "description": "Sample for ListPurchasableOffers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_purchasable_skus", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListPurchasableSkus", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListPurchasableSkus" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListPurchasableSkusRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableSkusAsyncPager", + "shortName": "list_purchasable_skus" + }, + "description": "Sample for ListPurchasableSkus", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_purchasable_skus", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListPurchasableSkus", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListPurchasableSkus" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListPurchasableSkusRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableSkusPager", + "shortName": "list_purchasable_skus" + }, + "description": "Sample for ListPurchasableSkus", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_skus", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListSkus", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListSkus" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListSkusRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSkusAsyncPager", + "shortName": "list_skus" + }, + "description": "Sample for ListSkus", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListSkus_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_skus", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListSkus", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListSkus" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListSkusRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSkusPager", + "shortName": "list_skus" + }, + "description": "Sample for ListSkus", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListSkus_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_subscribers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListSubscribers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListSubscribers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListSubscribersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSubscribersAsyncPager", + "shortName": "list_subscribers" + }, + "description": "Sample for ListSubscribers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListSubscribers_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_subscribers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListSubscribers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListSubscribers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListSubscribersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSubscribersPager", + "shortName": "list_subscribers" + }, + "description": "Sample for ListSubscribers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListSubscribers_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_transferable_offers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListTransferableOffers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListTransferableOffers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListTransferableOffersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableOffersAsyncPager", + "shortName": "list_transferable_offers" + }, + "description": "Sample for ListTransferableOffers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_transferable_offers", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListTransferableOffers", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListTransferableOffers" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListTransferableOffersRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableOffersPager", + "shortName": "list_transferable_offers" + }, + "description": "Sample for ListTransferableOffers", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 47, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 48, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_transferable_skus", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListTransferableSkus", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListTransferableSkus" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListTransferableSkusRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableSkusAsyncPager", + "shortName": "list_transferable_skus" + }, + "description": "Sample for ListTransferableSkus", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_transferable_skus", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListTransferableSkus", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListTransferableSkus" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListTransferableSkusRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableSkusPager", + "shortName": "list_transferable_skus" + }, + "description": "Sample for ListTransferableSkus", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.lookup_offer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.LookupOffer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "LookupOffer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.LookupOfferRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Offer", + "shortName": "lookup_offer" + }, + "description": "Sample for LookupOffer", + "file": "cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_LookupOffer_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.lookup_offer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.LookupOffer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "LookupOffer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.LookupOfferRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Offer", + "shortName": "lookup_offer" + }, + "description": "Sample for LookupOffer", + "file": "cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_LookupOffer_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.provision_cloud_identity", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ProvisionCloudIdentity" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ProvisionCloudIdentityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "provision_cloud_identity" + }, + "description": "Sample for ProvisionCloudIdentity", + "file": "cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.provision_cloud_identity", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ProvisionCloudIdentity" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ProvisionCloudIdentityRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "provision_cloud_identity" + }, + "description": "Sample for ProvisionCloudIdentity", + "file": "cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.register_subscriber", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.RegisterSubscriber", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "RegisterSubscriber" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.RegisterSubscriberRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.RegisterSubscriberResponse", + "shortName": "register_subscriber" + }, + "description": "Sample for RegisterSubscriber", + "file": "cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.register_subscriber", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.RegisterSubscriber", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "RegisterSubscriber" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.RegisterSubscriberRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.RegisterSubscriberResponse", + "shortName": "register_subscriber" + }, + "description": "Sample for RegisterSubscriber", + "file": "cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.start_paid_service", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.StartPaidService", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "StartPaidService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.StartPaidServiceRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "start_paid_service" + }, + "description": "Sample for StartPaidService", + "file": "cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_StartPaidService_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.start_paid_service", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.StartPaidService", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "StartPaidService" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.StartPaidServiceRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "start_paid_service" + }, + "description": "Sample for StartPaidService", + "file": "cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_StartPaidService_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.suspend_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.SuspendEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "SuspendEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.SuspendEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "suspend_entitlement" + }, + "description": "Sample for SuspendEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.suspend_entitlement", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.SuspendEntitlement", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "SuspendEntitlement" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.SuspendEntitlementRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "suspend_entitlement" + }, + "description": "Sample for SuspendEntitlement", + "file": "cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.transfer_entitlements_to_google", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "TransferEntitlementsToGoogle" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.TransferEntitlementsToGoogleRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "transfer_entitlements_to_google" + }, + "description": "Sample for TransferEntitlementsToGoogle", + "file": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_async", + "segments": [ + { + "end": 59, + "start": 27, + "type": "FULL" + }, + { + "end": 59, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 56, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 60, + "start": 57, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.transfer_entitlements_to_google", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "TransferEntitlementsToGoogle" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.TransferEntitlementsToGoogleRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "transfer_entitlements_to_google" + }, + "description": "Sample for TransferEntitlementsToGoogle", + "file": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_sync", + "segments": [ + { + "end": 59, + "start": 27, + "type": "FULL" + }, + { + "end": 59, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 56, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 60, + "start": 57, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.transfer_entitlements", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.TransferEntitlements", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "TransferEntitlements" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.TransferEntitlementsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "transfer_entitlements" + }, + "description": "Sample for TransferEntitlements", + "file": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_async", + "segments": [ + { + "end": 59, + "start": 27, + "type": "FULL" + }, + { + "end": 59, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 56, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 60, + "start": 57, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.transfer_entitlements", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.TransferEntitlements", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "TransferEntitlements" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.TransferEntitlementsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "transfer_entitlements" + }, + "description": "Sample for TransferEntitlements", + "file": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_sync", + "segments": [ + { + "end": 59, + "start": 27, + "type": "FULL" + }, + { + "end": 59, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 56, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 60, + "start": 57, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.unregister_subscriber", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UnregisterSubscriber", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UnregisterSubscriber" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UnregisterSubscriberRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.UnregisterSubscriberResponse", + "shortName": "unregister_subscriber" + }, + "description": "Sample for UnregisterSubscriber", + "file": "cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.unregister_subscriber", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UnregisterSubscriber", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UnregisterSubscriber" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UnregisterSubscriberRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.UnregisterSubscriberResponse", + "shortName": "unregister_subscriber" + }, + "description": "Sample for UnregisterSubscriber", + "file": "cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.update_channel_partner_link", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UpdateChannelPartnerLink" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UpdateChannelPartnerLinkRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", + "shortName": "update_channel_partner_link" + }, + "description": "Sample for UpdateChannelPartnerLink", + "file": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.update_channel_partner_link", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UpdateChannelPartnerLink" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UpdateChannelPartnerLinkRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", + "shortName": "update_channel_partner_link" + }, + "description": "Sample for UpdateChannelPartnerLink", + "file": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.update_channel_partner_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UpdateChannelPartnerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UpdateChannelPartnerRepricingConfigRequest" + }, + { + "name": "channel_partner_repricing_config", + "type": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", + "shortName": "update_channel_partner_repricing_config" + }, + "description": "Sample for UpdateChannelPartnerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.update_channel_partner_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UpdateChannelPartnerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UpdateChannelPartnerRepricingConfigRequest" + }, + { + "name": "channel_partner_repricing_config", + "type": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", + "shortName": "update_channel_partner_repricing_config" + }, + "description": "Sample for UpdateChannelPartnerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.update_customer_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UpdateCustomerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UpdateCustomerRepricingConfigRequest" + }, + { + "name": "customer_repricing_config", + "type": "google.cloud.channel_v1.types.CustomerRepricingConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", + "shortName": "update_customer_repricing_config" + }, + "description": "Sample for UpdateCustomerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.update_customer_repricing_config", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UpdateCustomerRepricingConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UpdateCustomerRepricingConfigRequest" + }, + { + "name": "customer_repricing_config", + "type": "google.cloud.channel_v1.types.CustomerRepricingConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", + "shortName": "update_customer_repricing_config" + }, + "description": "Sample for UpdateCustomerRepricingConfig", + "file": "cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", + "shortName": "CloudChannelServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.update_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UpdateCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UpdateCustomerRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Customer", + "shortName": "update_customer" + }, + "description": "Sample for UpdateCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.update_customer", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateCustomer", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "UpdateCustomer" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.UpdateCustomerRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.types.Customer", + "shortName": "update_customer" + }, + "description": "Sample for UpdateCustomer", + "file": "cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py" + } + ] +} diff --git a/owl-bot-staging/v1/scripts/fixup_channel_v1_keywords.py b/owl-bot-staging/v1/scripts/fixup_channel_v1_keywords.py new file mode 100644 index 0000000..643b44c --- /dev/null +++ b/owl-bot-staging/v1/scripts/fixup_channel_v1_keywords.py @@ -0,0 +1,223 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class channelCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'activate_entitlement': ('name', 'request_id', ), + 'cancel_entitlement': ('name', 'request_id', ), + 'change_offer': ('name', 'offer', 'parameters', 'purchase_order_id', 'request_id', ), + 'change_parameters': ('name', 'parameters', 'request_id', 'purchase_order_id', ), + 'change_renewal_settings': ('name', 'renewal_settings', 'request_id', ), + 'check_cloud_identity_accounts_exist': ('parent', 'domain', ), + 'create_channel_partner_link': ('parent', 'channel_partner_link', ), + 'create_channel_partner_repricing_config': ('parent', 'channel_partner_repricing_config', ), + 'create_customer': ('parent', 'customer', ), + 'create_customer_repricing_config': ('parent', 'customer_repricing_config', ), + 'create_entitlement': ('parent', 'entitlement', 'request_id', ), + 'delete_channel_partner_repricing_config': ('name', ), + 'delete_customer': ('name', ), + 'delete_customer_repricing_config': ('name', ), + 'fetch_report_results': ('report_job', 'page_size', 'page_token', ), + 'get_channel_partner_link': ('name', 'view', ), + 'get_channel_partner_repricing_config': ('name', ), + 'get_customer': ('name', ), + 'get_customer_repricing_config': ('name', ), + 'get_entitlement': ('name', ), + 'import_customer': ('domain', 'cloud_identity_id', 'parent', 'overwrite_if_exists', 'auth_token', 'channel_partner_id', 'customer', ), + 'list_channel_partner_links': ('parent', 'page_size', 'page_token', 'view', ), + 'list_channel_partner_repricing_configs': ('parent', 'page_size', 'page_token', 'filter', ), + 'list_customer_repricing_configs': ('parent', 'page_size', 'page_token', 'filter', ), + 'list_customers': ('parent', 'page_size', 'page_token', 'filter', ), + 'list_entitlements': ('parent', 'page_size', 'page_token', ), + 'list_offers': ('parent', 'page_size', 'page_token', 'filter', 'language_code', ), + 'list_products': ('account', 'page_size', 'page_token', 'language_code', ), + 'list_purchasable_offers': ('customer', 'create_entitlement_purchase', 'change_offer_purchase', 'page_size', 'page_token', 'language_code', ), + 'list_purchasable_skus': ('customer', 'create_entitlement_purchase', 'change_offer_purchase', 'page_size', 'page_token', 'language_code', ), + 'list_reports': ('parent', 'page_size', 'page_token', 'language_code', ), + 'list_skus': ('parent', 'account', 'page_size', 'page_token', 'language_code', ), + 'list_subscribers': ('account', 'page_size', 'page_token', ), + 'list_transferable_offers': ('parent', 'sku', 'cloud_identity_id', 'customer_name', 'page_size', 'page_token', 'language_code', ), + 'list_transferable_skus': ('parent', 'cloud_identity_id', 'customer_name', 'page_size', 'page_token', 'auth_token', 'language_code', ), + 'lookup_offer': ('entitlement', ), + 'provision_cloud_identity': ('customer', 'cloud_identity_info', 'user', 'validate_only', ), + 'register_subscriber': ('account', 'service_account', ), + 'run_report_job': ('name', 'date_range', 'filter', 'language_code', ), + 'start_paid_service': ('name', 'request_id', ), + 'suspend_entitlement': ('name', 'request_id', ), + 'transfer_entitlements': ('parent', 'entitlements', 'auth_token', 'request_id', ), + 'transfer_entitlements_to_google': ('parent', 'entitlements', 'request_id', ), + 'unregister_subscriber': ('account', 'service_account', ), + 'update_channel_partner_link': ('name', 'channel_partner_link', 'update_mask', ), + 'update_channel_partner_repricing_config': ('channel_partner_repricing_config', ), + 'update_customer': ('customer', 'update_mask', ), + 'update_customer_repricing_config': ('customer_repricing_config', ), + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=channelCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the channel client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1/setup.py b/owl-bot-staging/v1/setup.py new file mode 100644 index 0000000..508f3d4 --- /dev/null +++ b/owl-bot-staging/v1/setup.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import io +import os +import setuptools # type: ignore + +version = '0.1.0' + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, 'README.rst') +with io.open(readme_filename, encoding='utf-8') as readme_file: + readme = readme_file.read() + +setuptools.setup( + name='google-cloud-channel', + author="Google LLC", + author_email="googleapis-packages@google.com", + url="https://github.com/googleapis/python-google-cloud-channel", + version=version, + long_description=readme, + packages=setuptools.PEP420PackageFinder.find(), + namespace_packages=('google', 'google.cloud'), + platforms='Posix; MacOS X; Windows', + include_package_data=True, + install_requires=( + 'google-api-core[grpc] >= 2.10.0, < 3.0.0dev', + 'libcst >= 0.2.5', + 'googleapis-common-protos >= 1.55.0, <2.0.0dev', + 'proto-plus >= 1.19.7', + ), + python_requires='>=3.7', + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Topic :: Internet', + 'Topic :: Software Development :: Libraries :: Python Modules', + ], + zip_safe=False, +) diff --git a/owl-bot-staging/v1/tests/__init__.py b/owl-bot-staging/v1/tests/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/__init__.py b/owl-bot-staging/v1/tests/unit/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/channel_v1/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/channel_v1/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/channel_v1/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py b/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py new file mode 100644 index 0000000..e06dae9 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py @@ -0,0 +1,2733 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER + import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers + +from google.api_core import client_options +from google.api_core import exceptions as core_exceptions +from google.api_core import future +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.api_core import operation +from google.api_core import operation_async # type: ignore +from google.api_core import operations_v1 +from google.api_core import path_template +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.channel_v1.services.cloud_channel_reports_service import CloudChannelReportsServiceAsyncClient +from google.cloud.channel_v1.services.cloud_channel_reports_service import CloudChannelReportsServiceClient +from google.cloud.channel_v1.services.cloud_channel_reports_service import pagers +from google.cloud.channel_v1.services.cloud_channel_reports_service import transports +from google.cloud.channel_v1.types import operations +from google.cloud.channel_v1.types import reports_service +from google.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore +from google.type import date_pb2 # type: ignore +from google.type import datetime_pb2 # type: ignore +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(None) is None + assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint + assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint + assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint + assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CloudChannelReportsServiceClient, "grpc"), + (CloudChannelReportsServiceAsyncClient, "grpc_asyncio"), +]) +def test_cloud_channel_reports_service_client_from_service_account_info(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'cloudchannel.googleapis.com:443' + ) + + +@pytest.mark.parametrize("transport_class,transport_name", [ + (transports.CloudChannelReportsServiceGrpcTransport, "grpc"), + (transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_cloud_channel_reports_service_client_service_account_always_use_jwt(transport_class, transport_name): + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CloudChannelReportsServiceClient, "grpc"), + (CloudChannelReportsServiceAsyncClient, "grpc_asyncio"), +]) +def test_cloud_channel_reports_service_client_from_service_account_file(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'cloudchannel.googleapis.com:443' + ) + + +def test_cloud_channel_reports_service_client_get_transport_class(): + transport = CloudChannelReportsServiceClient.get_transport_class() + available_transports = [ + transports.CloudChannelReportsServiceGrpcTransport, + ] + assert transport in available_transports + + transport = CloudChannelReportsServiceClient.get_transport_class("grpc") + assert transport == transports.CloudChannelReportsServiceGrpcTransport + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc"), + (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +@mock.patch.object(CloudChannelReportsServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceClient)) +@mock.patch.object(CloudChannelReportsServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceAsyncClient)) +def test_cloud_channel_reports_service_client_client_options(client_class, transport_class, transport_name): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(CloudChannelReportsServiceClient, 'get_transport_class') as gtc: + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(CloudChannelReportsServiceClient, 'get_transport_class') as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions(api_audience="https://language.googleapis.com") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com" + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ + (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc", "true"), + (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio", "true"), + (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc", "false"), + (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio", "false"), +]) +@mock.patch.object(CloudChannelReportsServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceClient)) +@mock.patch.object(CloudChannelReportsServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceAsyncClient)) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_cloud_channel_reports_service_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class", [ + CloudChannelReportsServiceClient, CloudChannelReportsServiceAsyncClient +]) +@mock.patch.object(CloudChannelReportsServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceClient)) +@mock.patch.object(CloudChannelReportsServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceAsyncClient)) +def test_cloud_channel_reports_service_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc"), + (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_cloud_channel_reports_service_client_client_options_scopes(client_class, transport_class, transport_name): + # Check the case scopes are provided. + options = client_options.ClientOptions( + scopes=["1", "2"], + ) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc", grpc_helpers), + (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_cloud_channel_reports_service_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +def test_cloud_channel_reports_service_client_client_options_from_dict(): + with mock.patch('google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceGrpcTransport.__init__') as grpc_transport: + grpc_transport.return_value = None + client = CloudChannelReportsServiceClient( + client_options={'api_endpoint': 'squid.clam.whelk'} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc", grpc_helpers), + (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_cloud_channel_reports_service_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "cloudchannel.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + 'https://www.googleapis.com/auth/apps.reports.usage.readonly', +), + scopes=None, + default_host="cloudchannel.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("request_type", [ + reports_service.RunReportJobRequest, + dict, +]) +def test_run_report_job(request_type, transport: str = 'grpc'): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.run_report_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.run_report_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == reports_service.RunReportJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_run_report_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.run_report_job), + '__call__') as call: + client.run_report_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == reports_service.RunReportJobRequest() + +@pytest.mark.asyncio +async def test_run_report_job_async(transport: str = 'grpc_asyncio', request_type=reports_service.RunReportJobRequest): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.run_report_job), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.run_report_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == reports_service.RunReportJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_run_report_job_async_from_dict(): + await test_run_report_job_async(request_type=dict) + + +def test_run_report_job_field_headers(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = reports_service.RunReportJobRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.run_report_job), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.run_report_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_run_report_job_field_headers_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = reports_service.RunReportJobRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.run_report_job), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.run_report_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + reports_service.FetchReportResultsRequest, + dict, +]) +def test_fetch_report_results(request_type, transport: str = 'grpc'): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = reports_service.FetchReportResultsResponse( + next_page_token='next_page_token_value', + ) + response = client.fetch_report_results(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == reports_service.FetchReportResultsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.FetchReportResultsPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_fetch_report_results_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__') as call: + client.fetch_report_results() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == reports_service.FetchReportResultsRequest() + +@pytest.mark.asyncio +async def test_fetch_report_results_async(transport: str = 'grpc_asyncio', request_type=reports_service.FetchReportResultsRequest): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(reports_service.FetchReportResultsResponse( + next_page_token='next_page_token_value', + )) + response = await client.fetch_report_results(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == reports_service.FetchReportResultsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.FetchReportResultsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_fetch_report_results_async_from_dict(): + await test_fetch_report_results_async(request_type=dict) + + +def test_fetch_report_results_field_headers(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = reports_service.FetchReportResultsRequest() + + request.report_job = 'report_job_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__') as call: + call.return_value = reports_service.FetchReportResultsResponse() + client.fetch_report_results(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'report_job=report_job_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_fetch_report_results_field_headers_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = reports_service.FetchReportResultsRequest() + + request.report_job = 'report_job_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(reports_service.FetchReportResultsResponse()) + await client.fetch_report_results(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'report_job=report_job_value', + ) in kw['metadata'] + + +def test_fetch_report_results_flattened(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = reports_service.FetchReportResultsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.fetch_report_results( + report_job='report_job_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].report_job + mock_val = 'report_job_value' + assert arg == mock_val + + +def test_fetch_report_results_flattened_error(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.fetch_report_results( + reports_service.FetchReportResultsRequest(), + report_job='report_job_value', + ) + +@pytest.mark.asyncio +async def test_fetch_report_results_flattened_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = reports_service.FetchReportResultsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(reports_service.FetchReportResultsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.fetch_report_results( + report_job='report_job_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].report_job + mock_val = 'report_job_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_fetch_report_results_flattened_error_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.fetch_report_results( + reports_service.FetchReportResultsRequest(), + report_job='report_job_value', + ) + + +def test_fetch_report_results_pager(transport_name: str = "grpc"): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + reports_service.Row(), + reports_service.Row(), + ], + next_page_token='abc', + ), + reports_service.FetchReportResultsResponse( + rows=[], + next_page_token='def', + ), + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + ], + next_page_token='ghi', + ), + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + reports_service.Row(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('report_job', ''), + )), + ) + pager = client.fetch_report_results(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, reports_service.Row) + for i in results) +def test_fetch_report_results_pages(transport_name: str = "grpc"): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + reports_service.Row(), + reports_service.Row(), + ], + next_page_token='abc', + ), + reports_service.FetchReportResultsResponse( + rows=[], + next_page_token='def', + ), + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + ], + next_page_token='ghi', + ), + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + reports_service.Row(), + ], + ), + RuntimeError, + ) + pages = list(client.fetch_report_results(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_fetch_report_results_async_pager(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + reports_service.Row(), + reports_service.Row(), + ], + next_page_token='abc', + ), + reports_service.FetchReportResultsResponse( + rows=[], + next_page_token='def', + ), + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + ], + next_page_token='ghi', + ), + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + reports_service.Row(), + ], + ), + RuntimeError, + ) + async_pager = await client.fetch_report_results(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, reports_service.Row) + for i in responses) + + +@pytest.mark.asyncio +async def test_fetch_report_results_async_pages(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_report_results), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + reports_service.Row(), + reports_service.Row(), + ], + next_page_token='abc', + ), + reports_service.FetchReportResultsResponse( + rows=[], + next_page_token='def', + ), + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + ], + next_page_token='ghi', + ), + reports_service.FetchReportResultsResponse( + rows=[ + reports_service.Row(), + reports_service.Row(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.fetch_report_results(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + reports_service.ListReportsRequest, + dict, +]) +def test_list_reports(request_type, transport: str = 'grpc'): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = reports_service.ListReportsResponse( + next_page_token='next_page_token_value', + ) + response = client.list_reports(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == reports_service.ListReportsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListReportsPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_reports_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__') as call: + client.list_reports() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == reports_service.ListReportsRequest() + +@pytest.mark.asyncio +async def test_list_reports_async(transport: str = 'grpc_asyncio', request_type=reports_service.ListReportsRequest): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(reports_service.ListReportsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_reports(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == reports_service.ListReportsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListReportsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_reports_async_from_dict(): + await test_list_reports_async(request_type=dict) + + +def test_list_reports_field_headers(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = reports_service.ListReportsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__') as call: + call.return_value = reports_service.ListReportsResponse() + client.list_reports(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_reports_field_headers_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = reports_service.ListReportsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(reports_service.ListReportsResponse()) + await client.list_reports(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_reports_flattened(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = reports_service.ListReportsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_reports( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_reports_flattened_error(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_reports( + reports_service.ListReportsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_reports_flattened_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = reports_service.ListReportsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(reports_service.ListReportsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_reports( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_reports_flattened_error_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_reports( + reports_service.ListReportsRequest(), + parent='parent_value', + ) + + +def test_list_reports_pager(transport_name: str = "grpc"): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + reports_service.Report(), + reports_service.Report(), + ], + next_page_token='abc', + ), + reports_service.ListReportsResponse( + reports=[], + next_page_token='def', + ), + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + ], + next_page_token='ghi', + ), + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + reports_service.Report(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_reports(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, reports_service.Report) + for i in results) +def test_list_reports_pages(transport_name: str = "grpc"): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + reports_service.Report(), + reports_service.Report(), + ], + next_page_token='abc', + ), + reports_service.ListReportsResponse( + reports=[], + next_page_token='def', + ), + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + ], + next_page_token='ghi', + ), + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + reports_service.Report(), + ], + ), + RuntimeError, + ) + pages = list(client.list_reports(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_reports_async_pager(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + reports_service.Report(), + reports_service.Report(), + ], + next_page_token='abc', + ), + reports_service.ListReportsResponse( + reports=[], + next_page_token='def', + ), + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + ], + next_page_token='ghi', + ), + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + reports_service.Report(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_reports(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, reports_service.Report) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_reports_async_pages(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reports), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + reports_service.Report(), + reports_service.Report(), + ], + next_page_token='abc', + ), + reports_service.ListReportsResponse( + reports=[], + next_page_token='def', + ), + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + ], + next_page_token='ghi', + ), + reports_service.ListReportsResponse( + reports=[ + reports_service.Report(), + reports_service.Report(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_reports(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.CloudChannelReportsServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.CloudChannelReportsServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudChannelReportsServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.CloudChannelReportsServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CloudChannelReportsServiceClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CloudChannelReportsServiceClient( + client_options=options, + credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.CloudChannelReportsServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudChannelReportsServiceClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.CloudChannelReportsServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = CloudChannelReportsServiceClient(transport=transport) + assert client.transport is transport + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.CloudChannelReportsServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.CloudChannelReportsServiceGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + +@pytest.mark.parametrize("transport_class", [ + transports.CloudChannelReportsServiceGrpcTransport, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, +]) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class() + adc.assert_called_once() + +@pytest.mark.parametrize("transport_name", [ + "grpc", +]) +def test_transport_kind(transport_name): + transport = CloudChannelReportsServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.CloudChannelReportsServiceGrpcTransport, + ) + +def test_cloud_channel_reports_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.CloudChannelReportsServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json" + ) + + +def test_cloud_channel_reports_service_base_transport(): + # Instantiate the base transport. + with mock.patch('google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceTransport.__init__') as Transport: + Transport.return_value = None + transport = transports.CloudChannelReportsServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + 'run_report_job', + 'fetch_report_results', + 'list_reports', + 'get_operation', + 'cancel_operation', + 'delete_operation', + 'list_operations', + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + with pytest.raises(NotImplementedError): + transport.operations_client + + # Catch all for all remaining methods and properties + remainder = [ + 'kind', + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + + +def test_cloud_channel_reports_service_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CloudChannelReportsServiceTransport( + credentials_file="credentials.json", + quota_project_id="octopus", + ) + load_creds.assert_called_once_with("credentials.json", + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/apps.reports.usage.readonly', +), + quota_project_id="octopus", + ) + + +def test_cloud_channel_reports_service_base_transport_with_adc(): + # Test the default credentials are used if credentials and credentials_file are None. + with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CloudChannelReportsServiceTransport() + adc.assert_called_once() + + +def test_cloud_channel_reports_service_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + CloudChannelReportsServiceClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/apps.reports.usage.readonly', +), + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudChannelReportsServiceGrpcTransport, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + ], +) +def test_cloud_channel_reports_service_transport_auth_adc(transport_class): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + adc.assert_called_once_with( + scopes=["1", "2"], + default_scopes=( 'https://www.googleapis.com/auth/apps.reports.usage.readonly',), + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudChannelReportsServiceGrpcTransport, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + ], +) +def test_cloud_channel_reports_service_transport_auth_gdch_credentials(transport_class): + host = 'https://language.com' + api_audience_tests = [None, 'https://language2.com'] + api_audience_expect = [host, 'https://language2.com'] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with( + e + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CloudChannelReportsServiceGrpcTransport, grpc_helpers), + (transports.CloudChannelReportsServiceGrpcAsyncIOTransport, grpc_helpers_async) + ], +) +def test_cloud_channel_reports_service_transport_create_channel(transport_class, grpc_helpers): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + transport_class( + quota_project_id="octopus", + scopes=["1", "2"] + ) + + create_channel.assert_called_with( + "cloudchannel.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + default_scopes=( + 'https://www.googleapis.com/auth/apps.reports.usage.readonly', +), + scopes=["1", "2"], + default_host="cloudchannel.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("transport_class", [transports.CloudChannelReportsServiceGrpcTransport, transports.CloudChannelReportsServiceGrpcAsyncIOTransport]) +def test_cloud_channel_reports_service_grpc_transport_client_cert_source_for_mtls( + transport_class +): + cred = ga_credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, + private_key=expected_key + ) + + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_cloud_channel_reports_service_host_no_port(transport_name): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='cloudchannel.googleapis.com'), + transport=transport_name, + ) + assert client.transport._host == ( + 'cloudchannel.googleapis.com:443' + ) + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_cloud_channel_reports_service_host_with_port(transport_name): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='cloudchannel.googleapis.com:8000'), + transport=transport_name, + ) + assert client.transport._host == ( + 'cloudchannel.googleapis.com:8000' + ) + +def test_cloud_channel_reports_service_grpc_transport_channel(): + channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CloudChannelReportsServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +def test_cloud_channel_reports_service_grpc_asyncio_transport_channel(): + channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CloudChannelReportsServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CloudChannelReportsServiceGrpcTransport, transports.CloudChannelReportsServiceGrpcAsyncIOTransport]) +def test_cloud_channel_reports_service_transport_channel_mtls_with_client_cert_source( + transport_class +): + with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + cred = ga_credentials.AnonymousCredentials() + with pytest.warns(DeprecationWarning): + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (cred, None) + transport = transport_class( + host="squid.clam.whelk", + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + adc.assert_called_once() + + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + assert transport._ssl_channel_credentials == mock_ssl_cred + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CloudChannelReportsServiceGrpcTransport, transports.CloudChannelReportsServiceGrpcAsyncIOTransport]) +def test_cloud_channel_reports_service_transport_channel_mtls_with_adc( + transport_class +): + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + mock_cred = mock.Mock() + + with pytest.warns(DeprecationWarning): + transport = transport_class( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=None, + ) + + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_cloud_channel_reports_service_grpc_lro_client(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_cloud_channel_reports_service_grpc_lro_async_client(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_report_path(): + account = "squid" + report = "clam" + expected = "accounts/{account}/reports/{report}".format(account=account, report=report, ) + actual = CloudChannelReportsServiceClient.report_path(account, report) + assert expected == actual + + +def test_parse_report_path(): + expected = { + "account": "whelk", + "report": "octopus", + } + path = CloudChannelReportsServiceClient.report_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelReportsServiceClient.parse_report_path(path) + assert expected == actual + +def test_report_job_path(): + account = "oyster" + report_job = "nudibranch" + expected = "accounts/{account}/reportJobs/{report_job}".format(account=account, report_job=report_job, ) + actual = CloudChannelReportsServiceClient.report_job_path(account, report_job) + assert expected == actual + + +def test_parse_report_job_path(): + expected = { + "account": "cuttlefish", + "report_job": "mussel", + } + path = CloudChannelReportsServiceClient.report_job_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelReportsServiceClient.parse_report_job_path(path) + assert expected == actual + +def test_common_billing_account_path(): + billing_account = "winkle" + expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + actual = CloudChannelReportsServiceClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "nautilus", + } + path = CloudChannelReportsServiceClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelReportsServiceClient.parse_common_billing_account_path(path) + assert expected == actual + +def test_common_folder_path(): + folder = "scallop" + expected = "folders/{folder}".format(folder=folder, ) + actual = CloudChannelReportsServiceClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "abalone", + } + path = CloudChannelReportsServiceClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelReportsServiceClient.parse_common_folder_path(path) + assert expected == actual + +def test_common_organization_path(): + organization = "squid" + expected = "organizations/{organization}".format(organization=organization, ) + actual = CloudChannelReportsServiceClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "clam", + } + path = CloudChannelReportsServiceClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelReportsServiceClient.parse_common_organization_path(path) + assert expected == actual + +def test_common_project_path(): + project = "whelk" + expected = "projects/{project}".format(project=project, ) + actual = CloudChannelReportsServiceClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "octopus", + } + path = CloudChannelReportsServiceClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelReportsServiceClient.parse_common_project_path(path) + assert expected == actual + +def test_common_location_path(): + project = "oyster" + location = "nudibranch" + expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) + actual = CloudChannelReportsServiceClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "cuttlefish", + "location": "mussel", + } + path = CloudChannelReportsServiceClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelReportsServiceClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object(transports.CloudChannelReportsServiceTransport, '_prep_wrapped_messages') as prep: + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object(transports.CloudChannelReportsServiceTransport, '_prep_wrapped_messages') as prep: + transport_class = CloudChannelReportsServiceClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", + ) + with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_delete_operation(transport: str = "grpc"): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.DeleteOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None +@pytest.mark.asyncio +async def test_delete_operation_async(transport: str = "grpc"): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.DeleteOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + +def test_delete_operation_field_headers(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.DeleteOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + call.return_value = None + + client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_delete_operation_field_headers_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.DeleteOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + await client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_delete_operation_from_dict(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_delete_operation_from_dict_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.delete_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_cancel_operation(transport: str = "grpc"): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.CancelOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None +@pytest.mark.asyncio +async def test_cancel_operation_async(transport: str = "grpc"): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.CancelOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + +def test_cancel_operation_field_headers(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.CancelOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + call.return_value = None + + client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_cancel_operation_field_headers_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.CancelOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + await client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_cancel_operation_from_dict(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.cancel_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_cancel_operation_from_dict_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.cancel_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_get_operation(transport: str = "grpc"): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.GetOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + response = client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) +@pytest.mark.asyncio +async def test_get_operation_async(transport: str = "grpc"): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.GetOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + response = await client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) + +def test_get_operation_field_headers(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.GetOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + call.return_value = operations_pb2.Operation() + + client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_get_operation_field_headers_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.GetOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_get_operation_from_dict(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + response = client.get_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_get_operation_from_dict_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + response = await client.get_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_list_operations(transport: str = "grpc"): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.ListOperationsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.ListOperationsResponse() + response = client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) +@pytest.mark.asyncio +async def test_list_operations_async(transport: str = "grpc"): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.ListOperationsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + response = await client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) + +def test_list_operations_field_headers(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.ListOperationsRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + call.return_value = operations_pb2.ListOperationsResponse() + + client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_list_operations_field_headers_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.ListOperationsRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + await client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_list_operations_from_dict(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.ListOperationsResponse() + + response = client.list_operations( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_list_operations_from_dict_async(): + client = CloudChannelReportsServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + response = await client.list_operations( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + +def test_client_ctx(): + transports = [ + 'grpc', + ] + for transport in transports: + client = CloudChannelReportsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + +@pytest.mark.parametrize("client_class,transport_class", [ + (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport), + (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport), +]) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) diff --git a/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_service.py b/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_service.py new file mode 100644 index 0000000..3e356cf --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_service.py @@ -0,0 +1,12149 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER + import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers + +from google.api_core import client_options +from google.api_core import exceptions as core_exceptions +from google.api_core import future +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.api_core import operation +from google.api_core import operation_async # type: ignore +from google.api_core import operations_v1 +from google.api_core import path_template +from google.auth import credentials as ga_credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.channel_v1.services.cloud_channel_service import CloudChannelServiceAsyncClient +from google.cloud.channel_v1.services.cloud_channel_service import CloudChannelServiceClient +from google.cloud.channel_v1.services.cloud_channel_service import pagers +from google.cloud.channel_v1.services.cloud_channel_service import transports +from google.cloud.channel_v1.types import channel_partner_links +from google.cloud.channel_v1.types import common +from google.cloud.channel_v1.types import customers +from google.cloud.channel_v1.types import entitlements +from google.cloud.channel_v1.types import offers +from google.cloud.channel_v1.types import operations +from google.cloud.channel_v1.types import products +from google.cloud.channel_v1.types import repricing +from google.cloud.channel_v1.types import service +from google.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import any_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import date_pb2 # type: ignore +from google.type import decimal_pb2 # type: ignore +from google.type import postal_address_pb2 # type: ignore +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert CloudChannelServiceClient._get_default_mtls_endpoint(None) is None + assert CloudChannelServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + assert CloudChannelServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint + assert CloudChannelServiceClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint + assert CloudChannelServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint + assert CloudChannelServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CloudChannelServiceClient, "grpc"), + (CloudChannelServiceAsyncClient, "grpc_asyncio"), +]) +def test_cloud_channel_service_client_from_service_account_info(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'cloudchannel.googleapis.com:443' + ) + + +@pytest.mark.parametrize("transport_class,transport_name", [ + (transports.CloudChannelServiceGrpcTransport, "grpc"), + (transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_cloud_channel_service_client_service_account_always_use_jwt(transport_class, transport_name): + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CloudChannelServiceClient, "grpc"), + (CloudChannelServiceAsyncClient, "grpc_asyncio"), +]) +def test_cloud_channel_service_client_from_service_account_file(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'cloudchannel.googleapis.com:443' + ) + + +def test_cloud_channel_service_client_get_transport_class(): + transport = CloudChannelServiceClient.get_transport_class() + available_transports = [ + transports.CloudChannelServiceGrpcTransport, + ] + assert transport in available_transports + + transport = CloudChannelServiceClient.get_transport_class("grpc") + assert transport == transports.CloudChannelServiceGrpcTransport + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc"), + (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +@mock.patch.object(CloudChannelServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceClient)) +@mock.patch.object(CloudChannelServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceAsyncClient)) +def test_cloud_channel_service_client_client_options(client_class, transport_class, transport_name): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(CloudChannelServiceClient, 'get_transport_class') as gtc: + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(CloudChannelServiceClient, 'get_transport_class') as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions(api_audience="https://language.googleapis.com") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com" + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ + (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc", "true"), + (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio", "true"), + (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc", "false"), + (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio", "false"), +]) +@mock.patch.object(CloudChannelServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceClient)) +@mock.patch.object(CloudChannelServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceAsyncClient)) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_cloud_channel_service_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class", [ + CloudChannelServiceClient, CloudChannelServiceAsyncClient +]) +@mock.patch.object(CloudChannelServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceClient)) +@mock.patch.object(CloudChannelServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceAsyncClient)) +def test_cloud_channel_service_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc"), + (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_cloud_channel_service_client_client_options_scopes(client_class, transport_class, transport_name): + # Check the case scopes are provided. + options = client_options.ClientOptions( + scopes=["1", "2"], + ) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc", grpc_helpers), + (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_cloud_channel_service_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +def test_cloud_channel_service_client_client_options_from_dict(): + with mock.patch('google.cloud.channel_v1.services.cloud_channel_service.transports.CloudChannelServiceGrpcTransport.__init__') as grpc_transport: + grpc_transport.return_value = None + client = CloudChannelServiceClient( + client_options={'api_endpoint': 'squid.clam.whelk'} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc", grpc_helpers), + (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_cloud_channel_service_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "cloudchannel.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + 'https://www.googleapis.com/auth/apps.order', +), + scopes=None, + default_host="cloudchannel.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCustomersRequest, + dict, +]) +def test_list_customers(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCustomersResponse( + next_page_token='next_page_token_value', + ) + response = client.list_customers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCustomersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCustomersPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_customers_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customers), + '__call__') as call: + client.list_customers() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCustomersRequest() + +@pytest.mark.asyncio +async def test_list_customers_async(transport: str = 'grpc_asyncio', request_type=service.ListCustomersRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomersResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_customers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCustomersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCustomersAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_customers_async_from_dict(): + await test_list_customers_async(request_type=dict) + + +def test_list_customers_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListCustomersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customers), + '__call__') as call: + call.return_value = service.ListCustomersResponse() + client.list_customers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_customers_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListCustomersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customers), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomersResponse()) + await client.list_customers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_customers_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCustomersResponse( + customers=[ + customers.Customer(), + customers.Customer(), + customers.Customer(), + ], + next_page_token='abc', + ), + service.ListCustomersResponse( + customers=[], + next_page_token='def', + ), + service.ListCustomersResponse( + customers=[ + customers.Customer(), + ], + next_page_token='ghi', + ), + service.ListCustomersResponse( + customers=[ + customers.Customer(), + customers.Customer(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_customers(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, customers.Customer) + for i in results) +def test_list_customers_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCustomersResponse( + customers=[ + customers.Customer(), + customers.Customer(), + customers.Customer(), + ], + next_page_token='abc', + ), + service.ListCustomersResponse( + customers=[], + next_page_token='def', + ), + service.ListCustomersResponse( + customers=[ + customers.Customer(), + ], + next_page_token='ghi', + ), + service.ListCustomersResponse( + customers=[ + customers.Customer(), + customers.Customer(), + ], + ), + RuntimeError, + ) + pages = list(client.list_customers(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_customers_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCustomersResponse( + customers=[ + customers.Customer(), + customers.Customer(), + customers.Customer(), + ], + next_page_token='abc', + ), + service.ListCustomersResponse( + customers=[], + next_page_token='def', + ), + service.ListCustomersResponse( + customers=[ + customers.Customer(), + ], + next_page_token='ghi', + ), + service.ListCustomersResponse( + customers=[ + customers.Customer(), + customers.Customer(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_customers(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, customers.Customer) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_customers_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCustomersResponse( + customers=[ + customers.Customer(), + customers.Customer(), + customers.Customer(), + ], + next_page_token='abc', + ), + service.ListCustomersResponse( + customers=[], + next_page_token='def', + ), + service.ListCustomersResponse( + customers=[ + customers.Customer(), + ], + next_page_token='ghi', + ), + service.ListCustomersResponse( + customers=[ + customers.Customer(), + customers.Customer(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_customers(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.GetCustomerRequest, + dict, +]) +def test_get_customer(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = customers.Customer( + name='name_value', + org_display_name='org_display_name_value', + alternate_email='alternate_email_value', + domain='domain_value', + cloud_identity_id='cloud_identity_id_value', + language_code='language_code_value', + channel_partner_id='channel_partner_id_value', + ) + response = client.get_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCustomerRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, customers.Customer) + assert response.name == 'name_value' + assert response.org_display_name == 'org_display_name_value' + assert response.alternate_email == 'alternate_email_value' + assert response.domain == 'domain_value' + assert response.cloud_identity_id == 'cloud_identity_id_value' + assert response.language_code == 'language_code_value' + assert response.channel_partner_id == 'channel_partner_id_value' + + +def test_get_customer_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer), + '__call__') as call: + client.get_customer() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCustomerRequest() + +@pytest.mark.asyncio +async def test_get_customer_async(transport: str = 'grpc_asyncio', request_type=service.GetCustomerRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer( + name='name_value', + org_display_name='org_display_name_value', + alternate_email='alternate_email_value', + domain='domain_value', + cloud_identity_id='cloud_identity_id_value', + language_code='language_code_value', + channel_partner_id='channel_partner_id_value', + )) + response = await client.get_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCustomerRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, customers.Customer) + assert response.name == 'name_value' + assert response.org_display_name == 'org_display_name_value' + assert response.alternate_email == 'alternate_email_value' + assert response.domain == 'domain_value' + assert response.cloud_identity_id == 'cloud_identity_id_value' + assert response.language_code == 'language_code_value' + assert response.channel_partner_id == 'channel_partner_id_value' + + +@pytest.mark.asyncio +async def test_get_customer_async_from_dict(): + await test_get_customer_async(request_type=dict) + + +def test_get_customer_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetCustomerRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer), + '__call__') as call: + call.return_value = customers.Customer() + client.get_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_customer_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetCustomerRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) + await client.get_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_customer_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = customers.Customer() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_customer( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_customer_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_customer( + service.GetCustomerRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_customer_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = customers.Customer() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_customer( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_customer_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_customer( + service.GetCustomerRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.CheckCloudIdentityAccountsExistRequest, + dict, +]) +def test_check_cloud_identity_accounts_exist(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_cloud_identity_accounts_exist), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.CheckCloudIdentityAccountsExistResponse( + ) + response = client.check_cloud_identity_accounts_exist(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.CheckCloudIdentityAccountsExistRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, service.CheckCloudIdentityAccountsExistResponse) + + +def test_check_cloud_identity_accounts_exist_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_cloud_identity_accounts_exist), + '__call__') as call: + client.check_cloud_identity_accounts_exist() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CheckCloudIdentityAccountsExistRequest() + +@pytest.mark.asyncio +async def test_check_cloud_identity_accounts_exist_async(transport: str = 'grpc_asyncio', request_type=service.CheckCloudIdentityAccountsExistRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_cloud_identity_accounts_exist), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.CheckCloudIdentityAccountsExistResponse( + )) + response = await client.check_cloud_identity_accounts_exist(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.CheckCloudIdentityAccountsExistRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, service.CheckCloudIdentityAccountsExistResponse) + + +@pytest.mark.asyncio +async def test_check_cloud_identity_accounts_exist_async_from_dict(): + await test_check_cloud_identity_accounts_exist_async(request_type=dict) + + +def test_check_cloud_identity_accounts_exist_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CheckCloudIdentityAccountsExistRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_cloud_identity_accounts_exist), + '__call__') as call: + call.return_value = service.CheckCloudIdentityAccountsExistResponse() + client.check_cloud_identity_accounts_exist(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_check_cloud_identity_accounts_exist_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CheckCloudIdentityAccountsExistRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.check_cloud_identity_accounts_exist), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.CheckCloudIdentityAccountsExistResponse()) + await client.check_cloud_identity_accounts_exist(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.CreateCustomerRequest, + dict, +]) +def test_create_customer(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = customers.Customer( + name='name_value', + org_display_name='org_display_name_value', + alternate_email='alternate_email_value', + domain='domain_value', + cloud_identity_id='cloud_identity_id_value', + language_code='language_code_value', + channel_partner_id='channel_partner_id_value', + ) + response = client.create_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCustomerRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, customers.Customer) + assert response.name == 'name_value' + assert response.org_display_name == 'org_display_name_value' + assert response.alternate_email == 'alternate_email_value' + assert response.domain == 'domain_value' + assert response.cloud_identity_id == 'cloud_identity_id_value' + assert response.language_code == 'language_code_value' + assert response.channel_partner_id == 'channel_partner_id_value' + + +def test_create_customer_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer), + '__call__') as call: + client.create_customer() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCustomerRequest() + +@pytest.mark.asyncio +async def test_create_customer_async(transport: str = 'grpc_asyncio', request_type=service.CreateCustomerRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer( + name='name_value', + org_display_name='org_display_name_value', + alternate_email='alternate_email_value', + domain='domain_value', + cloud_identity_id='cloud_identity_id_value', + language_code='language_code_value', + channel_partner_id='channel_partner_id_value', + )) + response = await client.create_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCustomerRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, customers.Customer) + assert response.name == 'name_value' + assert response.org_display_name == 'org_display_name_value' + assert response.alternate_email == 'alternate_email_value' + assert response.domain == 'domain_value' + assert response.cloud_identity_id == 'cloud_identity_id_value' + assert response.language_code == 'language_code_value' + assert response.channel_partner_id == 'channel_partner_id_value' + + +@pytest.mark.asyncio +async def test_create_customer_async_from_dict(): + await test_create_customer_async(request_type=dict) + + +def test_create_customer_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateCustomerRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer), + '__call__') as call: + call.return_value = customers.Customer() + client.create_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_customer_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateCustomerRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) + await client.create_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.UpdateCustomerRequest, + dict, +]) +def test_update_customer(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = customers.Customer( + name='name_value', + org_display_name='org_display_name_value', + alternate_email='alternate_email_value', + domain='domain_value', + cloud_identity_id='cloud_identity_id_value', + language_code='language_code_value', + channel_partner_id='channel_partner_id_value', + ) + response = client.update_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCustomerRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, customers.Customer) + assert response.name == 'name_value' + assert response.org_display_name == 'org_display_name_value' + assert response.alternate_email == 'alternate_email_value' + assert response.domain == 'domain_value' + assert response.cloud_identity_id == 'cloud_identity_id_value' + assert response.language_code == 'language_code_value' + assert response.channel_partner_id == 'channel_partner_id_value' + + +def test_update_customer_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer), + '__call__') as call: + client.update_customer() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCustomerRequest() + +@pytest.mark.asyncio +async def test_update_customer_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCustomerRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer( + name='name_value', + org_display_name='org_display_name_value', + alternate_email='alternate_email_value', + domain='domain_value', + cloud_identity_id='cloud_identity_id_value', + language_code='language_code_value', + channel_partner_id='channel_partner_id_value', + )) + response = await client.update_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCustomerRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, customers.Customer) + assert response.name == 'name_value' + assert response.org_display_name == 'org_display_name_value' + assert response.alternate_email == 'alternate_email_value' + assert response.domain == 'domain_value' + assert response.cloud_identity_id == 'cloud_identity_id_value' + assert response.language_code == 'language_code_value' + assert response.channel_partner_id == 'channel_partner_id_value' + + +@pytest.mark.asyncio +async def test_update_customer_async_from_dict(): + await test_update_customer_async(request_type=dict) + + +def test_update_customer_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UpdateCustomerRequest() + + request.customer.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer), + '__call__') as call: + call.return_value = customers.Customer() + client.update_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_customer_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UpdateCustomerRequest() + + request.customer.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) + await client.update_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.DeleteCustomerRequest, + dict, +]) +def test_delete_customer(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteCustomerRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_customer_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer), + '__call__') as call: + client.delete_customer() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteCustomerRequest() + +@pytest.mark.asyncio +async def test_delete_customer_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCustomerRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteCustomerRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_delete_customer_async_from_dict(): + await test_delete_customer_async(request_type=dict) + + +def test_delete_customer_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.DeleteCustomerRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer), + '__call__') as call: + call.return_value = None + client.delete_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_delete_customer_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.DeleteCustomerRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_customer_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_customer( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_customer_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_customer( + service.DeleteCustomerRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_customer_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_customer( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_customer_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_customer( + service.DeleteCustomerRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ImportCustomerRequest, + dict, +]) +def test_import_customer(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = customers.Customer( + name='name_value', + org_display_name='org_display_name_value', + alternate_email='alternate_email_value', + domain='domain_value', + cloud_identity_id='cloud_identity_id_value', + language_code='language_code_value', + channel_partner_id='channel_partner_id_value', + ) + response = client.import_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ImportCustomerRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, customers.Customer) + assert response.name == 'name_value' + assert response.org_display_name == 'org_display_name_value' + assert response.alternate_email == 'alternate_email_value' + assert response.domain == 'domain_value' + assert response.cloud_identity_id == 'cloud_identity_id_value' + assert response.language_code == 'language_code_value' + assert response.channel_partner_id == 'channel_partner_id_value' + + +def test_import_customer_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_customer), + '__call__') as call: + client.import_customer() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ImportCustomerRequest() + +@pytest.mark.asyncio +async def test_import_customer_async(transport: str = 'grpc_asyncio', request_type=service.ImportCustomerRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_customer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer( + name='name_value', + org_display_name='org_display_name_value', + alternate_email='alternate_email_value', + domain='domain_value', + cloud_identity_id='cloud_identity_id_value', + language_code='language_code_value', + channel_partner_id='channel_partner_id_value', + )) + response = await client.import_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ImportCustomerRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, customers.Customer) + assert response.name == 'name_value' + assert response.org_display_name == 'org_display_name_value' + assert response.alternate_email == 'alternate_email_value' + assert response.domain == 'domain_value' + assert response.cloud_identity_id == 'cloud_identity_id_value' + assert response.language_code == 'language_code_value' + assert response.channel_partner_id == 'channel_partner_id_value' + + +@pytest.mark.asyncio +async def test_import_customer_async_from_dict(): + await test_import_customer_async(request_type=dict) + + +def test_import_customer_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ImportCustomerRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_customer), + '__call__') as call: + call.return_value = customers.Customer() + client.import_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_import_customer_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ImportCustomerRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_customer), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) + await client.import_customer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.ProvisionCloudIdentityRequest, + dict, +]) +def test_provision_cloud_identity(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.provision_cloud_identity), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.provision_cloud_identity(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ProvisionCloudIdentityRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_provision_cloud_identity_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.provision_cloud_identity), + '__call__') as call: + client.provision_cloud_identity() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ProvisionCloudIdentityRequest() + +@pytest.mark.asyncio +async def test_provision_cloud_identity_async(transport: str = 'grpc_asyncio', request_type=service.ProvisionCloudIdentityRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.provision_cloud_identity), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.provision_cloud_identity(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ProvisionCloudIdentityRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_provision_cloud_identity_async_from_dict(): + await test_provision_cloud_identity_async(request_type=dict) + + +def test_provision_cloud_identity_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ProvisionCloudIdentityRequest() + + request.customer = 'customer_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.provision_cloud_identity), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.provision_cloud_identity(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer=customer_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_provision_cloud_identity_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ProvisionCloudIdentityRequest() + + request.customer = 'customer_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.provision_cloud_identity), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.provision_cloud_identity(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer=customer_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.ListEntitlementsRequest, + dict, +]) +def test_list_entitlements(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlements), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListEntitlementsResponse( + next_page_token='next_page_token_value', + ) + response = client.list_entitlements(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListEntitlementsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListEntitlementsPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_entitlements_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlements), + '__call__') as call: + client.list_entitlements() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListEntitlementsRequest() + +@pytest.mark.asyncio +async def test_list_entitlements_async(transport: str = 'grpc_asyncio', request_type=service.ListEntitlementsRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlements), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListEntitlementsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_entitlements(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListEntitlementsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListEntitlementsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_entitlements_async_from_dict(): + await test_list_entitlements_async(request_type=dict) + + +def test_list_entitlements_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListEntitlementsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlements), + '__call__') as call: + call.return_value = service.ListEntitlementsResponse() + client.list_entitlements(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_entitlements_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListEntitlementsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlements), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListEntitlementsResponse()) + await client.list_entitlements(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_entitlements_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlements), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + entitlements.Entitlement(), + entitlements.Entitlement(), + ], + next_page_token='abc', + ), + service.ListEntitlementsResponse( + entitlements=[], + next_page_token='def', + ), + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + ], + next_page_token='ghi', + ), + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + entitlements.Entitlement(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_entitlements(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, entitlements.Entitlement) + for i in results) +def test_list_entitlements_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlements), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + entitlements.Entitlement(), + entitlements.Entitlement(), + ], + next_page_token='abc', + ), + service.ListEntitlementsResponse( + entitlements=[], + next_page_token='def', + ), + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + ], + next_page_token='ghi', + ), + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + entitlements.Entitlement(), + ], + ), + RuntimeError, + ) + pages = list(client.list_entitlements(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_entitlements_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlements), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + entitlements.Entitlement(), + entitlements.Entitlement(), + ], + next_page_token='abc', + ), + service.ListEntitlementsResponse( + entitlements=[], + next_page_token='def', + ), + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + ], + next_page_token='ghi', + ), + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + entitlements.Entitlement(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_entitlements(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, entitlements.Entitlement) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_entitlements_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlements), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + entitlements.Entitlement(), + entitlements.Entitlement(), + ], + next_page_token='abc', + ), + service.ListEntitlementsResponse( + entitlements=[], + next_page_token='def', + ), + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + ], + next_page_token='ghi', + ), + service.ListEntitlementsResponse( + entitlements=[ + entitlements.Entitlement(), + entitlements.Entitlement(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_entitlements(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.ListTransferableSkusRequest, + dict, +]) +def test_list_transferable_skus(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_skus), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListTransferableSkusResponse( + next_page_token='next_page_token_value', + ) + response = client.list_transferable_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListTransferableSkusRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTransferableSkusPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_transferable_skus_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_skus), + '__call__') as call: + client.list_transferable_skus() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListTransferableSkusRequest() + +@pytest.mark.asyncio +async def test_list_transferable_skus_async(transport: str = 'grpc_asyncio', request_type=service.ListTransferableSkusRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_skus), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListTransferableSkusResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_transferable_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListTransferableSkusRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTransferableSkusAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_transferable_skus_async_from_dict(): + await test_list_transferable_skus_async(request_type=dict) + + +def test_list_transferable_skus_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListTransferableSkusRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_skus), + '__call__') as call: + call.return_value = service.ListTransferableSkusResponse() + client.list_transferable_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_transferable_skus_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListTransferableSkusRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_skus), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListTransferableSkusResponse()) + await client.list_transferable_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_transferable_skus_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_skus), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + entitlements.TransferableSku(), + entitlements.TransferableSku(), + ], + next_page_token='abc', + ), + service.ListTransferableSkusResponse( + transferable_skus=[], + next_page_token='def', + ), + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + ], + next_page_token='ghi', + ), + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + entitlements.TransferableSku(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_transferable_skus(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, entitlements.TransferableSku) + for i in results) +def test_list_transferable_skus_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_skus), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + entitlements.TransferableSku(), + entitlements.TransferableSku(), + ], + next_page_token='abc', + ), + service.ListTransferableSkusResponse( + transferable_skus=[], + next_page_token='def', + ), + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + ], + next_page_token='ghi', + ), + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + entitlements.TransferableSku(), + ], + ), + RuntimeError, + ) + pages = list(client.list_transferable_skus(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_transferable_skus_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_skus), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + entitlements.TransferableSku(), + entitlements.TransferableSku(), + ], + next_page_token='abc', + ), + service.ListTransferableSkusResponse( + transferable_skus=[], + next_page_token='def', + ), + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + ], + next_page_token='ghi', + ), + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + entitlements.TransferableSku(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_transferable_skus(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, entitlements.TransferableSku) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_transferable_skus_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_skus), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + entitlements.TransferableSku(), + entitlements.TransferableSku(), + ], + next_page_token='abc', + ), + service.ListTransferableSkusResponse( + transferable_skus=[], + next_page_token='def', + ), + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + ], + next_page_token='ghi', + ), + service.ListTransferableSkusResponse( + transferable_skus=[ + entitlements.TransferableSku(), + entitlements.TransferableSku(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_transferable_skus(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.ListTransferableOffersRequest, + dict, +]) +def test_list_transferable_offers(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_offers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListTransferableOffersResponse( + next_page_token='next_page_token_value', + ) + response = client.list_transferable_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListTransferableOffersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTransferableOffersPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_transferable_offers_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_offers), + '__call__') as call: + client.list_transferable_offers() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListTransferableOffersRequest() + +@pytest.mark.asyncio +async def test_list_transferable_offers_async(transport: str = 'grpc_asyncio', request_type=service.ListTransferableOffersRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_offers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListTransferableOffersResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_transferable_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListTransferableOffersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTransferableOffersAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_transferable_offers_async_from_dict(): + await test_list_transferable_offers_async(request_type=dict) + + +def test_list_transferable_offers_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListTransferableOffersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_offers), + '__call__') as call: + call.return_value = service.ListTransferableOffersResponse() + client.list_transferable_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_transferable_offers_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListTransferableOffersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_offers), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListTransferableOffersResponse()) + await client.list_transferable_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_transferable_offers_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_offers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + service.TransferableOffer(), + service.TransferableOffer(), + ], + next_page_token='abc', + ), + service.ListTransferableOffersResponse( + transferable_offers=[], + next_page_token='def', + ), + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + ], + next_page_token='ghi', + ), + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + service.TransferableOffer(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_transferable_offers(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, service.TransferableOffer) + for i in results) +def test_list_transferable_offers_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_offers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + service.TransferableOffer(), + service.TransferableOffer(), + ], + next_page_token='abc', + ), + service.ListTransferableOffersResponse( + transferable_offers=[], + next_page_token='def', + ), + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + ], + next_page_token='ghi', + ), + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + service.TransferableOffer(), + ], + ), + RuntimeError, + ) + pages = list(client.list_transferable_offers(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_transferable_offers_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_offers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + service.TransferableOffer(), + service.TransferableOffer(), + ], + next_page_token='abc', + ), + service.ListTransferableOffersResponse( + transferable_offers=[], + next_page_token='def', + ), + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + ], + next_page_token='ghi', + ), + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + service.TransferableOffer(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_transferable_offers(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, service.TransferableOffer) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_transferable_offers_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_transferable_offers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + service.TransferableOffer(), + service.TransferableOffer(), + ], + next_page_token='abc', + ), + service.ListTransferableOffersResponse( + transferable_offers=[], + next_page_token='def', + ), + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + ], + next_page_token='ghi', + ), + service.ListTransferableOffersResponse( + transferable_offers=[ + service.TransferableOffer(), + service.TransferableOffer(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_transferable_offers(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.GetEntitlementRequest, + dict, +]) +def test_get_entitlement(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = entitlements.Entitlement( + name='name_value', + offer='offer_value', + provisioning_state=entitlements.Entitlement.ProvisioningState.ACTIVE, + suspension_reasons=[entitlements.Entitlement.SuspensionReason.RESELLER_INITIATED], + purchase_order_id='purchase_order_id_value', + ) + response = client.get_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, entitlements.Entitlement) + assert response.name == 'name_value' + assert response.offer == 'offer_value' + assert response.provisioning_state == entitlements.Entitlement.ProvisioningState.ACTIVE + assert response.suspension_reasons == [entitlements.Entitlement.SuspensionReason.RESELLER_INITIATED] + assert response.purchase_order_id == 'purchase_order_id_value' + + +def test_get_entitlement_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_entitlement), + '__call__') as call: + client.get_entitlement() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetEntitlementRequest() + +@pytest.mark.asyncio +async def test_get_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.GetEntitlementRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(entitlements.Entitlement( + name='name_value', + offer='offer_value', + provisioning_state=entitlements.Entitlement.ProvisioningState.ACTIVE, + suspension_reasons=[entitlements.Entitlement.SuspensionReason.RESELLER_INITIATED], + purchase_order_id='purchase_order_id_value', + )) + response = await client.get_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, entitlements.Entitlement) + assert response.name == 'name_value' + assert response.offer == 'offer_value' + assert response.provisioning_state == entitlements.Entitlement.ProvisioningState.ACTIVE + assert response.suspension_reasons == [entitlements.Entitlement.SuspensionReason.RESELLER_INITIATED] + assert response.purchase_order_id == 'purchase_order_id_value' + + +@pytest.mark.asyncio +async def test_get_entitlement_async_from_dict(): + await test_get_entitlement_async(request_type=dict) + + +def test_get_entitlement_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetEntitlementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_entitlement), + '__call__') as call: + call.return_value = entitlements.Entitlement() + client.get_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_entitlement_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetEntitlementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_entitlement), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(entitlements.Entitlement()) + await client.get_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.CreateEntitlementRequest, + dict, +]) +def test_create_entitlement(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.create_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_create_entitlement_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_entitlement), + '__call__') as call: + client.create_entitlement() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateEntitlementRequest() + +@pytest.mark.asyncio +async def test_create_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.CreateEntitlementRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_entitlement_async_from_dict(): + await test_create_entitlement_async(request_type=dict) + + +def test_create_entitlement_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateEntitlementRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_entitlement), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.create_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_entitlement_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateEntitlementRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_entitlement), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.create_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.ChangeParametersRequest, + dict, +]) +def test_change_parameters(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_parameters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.change_parameters(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ChangeParametersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_change_parameters_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_parameters), + '__call__') as call: + client.change_parameters() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ChangeParametersRequest() + +@pytest.mark.asyncio +async def test_change_parameters_async(transport: str = 'grpc_asyncio', request_type=service.ChangeParametersRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_parameters), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.change_parameters(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ChangeParametersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_change_parameters_async_from_dict(): + await test_change_parameters_async(request_type=dict) + + +def test_change_parameters_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ChangeParametersRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_parameters), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.change_parameters(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_change_parameters_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ChangeParametersRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_parameters), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.change_parameters(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.ChangeRenewalSettingsRequest, + dict, +]) +def test_change_renewal_settings(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_renewal_settings), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.change_renewal_settings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ChangeRenewalSettingsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_change_renewal_settings_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_renewal_settings), + '__call__') as call: + client.change_renewal_settings() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ChangeRenewalSettingsRequest() + +@pytest.mark.asyncio +async def test_change_renewal_settings_async(transport: str = 'grpc_asyncio', request_type=service.ChangeRenewalSettingsRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_renewal_settings), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.change_renewal_settings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ChangeRenewalSettingsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_change_renewal_settings_async_from_dict(): + await test_change_renewal_settings_async(request_type=dict) + + +def test_change_renewal_settings_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ChangeRenewalSettingsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_renewal_settings), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.change_renewal_settings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_change_renewal_settings_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ChangeRenewalSettingsRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_renewal_settings), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.change_renewal_settings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.ChangeOfferRequest, + dict, +]) +def test_change_offer(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_offer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.change_offer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ChangeOfferRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_change_offer_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_offer), + '__call__') as call: + client.change_offer() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ChangeOfferRequest() + +@pytest.mark.asyncio +async def test_change_offer_async(transport: str = 'grpc_asyncio', request_type=service.ChangeOfferRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_offer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.change_offer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ChangeOfferRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_change_offer_async_from_dict(): + await test_change_offer_async(request_type=dict) + + +def test_change_offer_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ChangeOfferRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_offer), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.change_offer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_change_offer_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ChangeOfferRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.change_offer), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.change_offer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.StartPaidServiceRequest, + dict, +]) +def test_start_paid_service(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_paid_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.start_paid_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.StartPaidServiceRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_start_paid_service_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_paid_service), + '__call__') as call: + client.start_paid_service() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.StartPaidServiceRequest() + +@pytest.mark.asyncio +async def test_start_paid_service_async(transport: str = 'grpc_asyncio', request_type=service.StartPaidServiceRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_paid_service), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.start_paid_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.StartPaidServiceRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_start_paid_service_async_from_dict(): + await test_start_paid_service_async(request_type=dict) + + +def test_start_paid_service_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.StartPaidServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_paid_service), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.start_paid_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_start_paid_service_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.StartPaidServiceRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_paid_service), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.start_paid_service(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.SuspendEntitlementRequest, + dict, +]) +def test_suspend_entitlement(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.suspend_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.suspend_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.SuspendEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_suspend_entitlement_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.suspend_entitlement), + '__call__') as call: + client.suspend_entitlement() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.SuspendEntitlementRequest() + +@pytest.mark.asyncio +async def test_suspend_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.SuspendEntitlementRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.suspend_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.suspend_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.SuspendEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_suspend_entitlement_async_from_dict(): + await test_suspend_entitlement_async(request_type=dict) + + +def test_suspend_entitlement_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.SuspendEntitlementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.suspend_entitlement), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.suspend_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_suspend_entitlement_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.SuspendEntitlementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.suspend_entitlement), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.suspend_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.CancelEntitlementRequest, + dict, +]) +def test_cancel_entitlement(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.cancel_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.CancelEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_cancel_entitlement_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_entitlement), + '__call__') as call: + client.cancel_entitlement() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CancelEntitlementRequest() + +@pytest.mark.asyncio +async def test_cancel_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.CancelEntitlementRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.cancel_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.CancelEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_cancel_entitlement_async_from_dict(): + await test_cancel_entitlement_async(request_type=dict) + + +def test_cancel_entitlement_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CancelEntitlementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_entitlement), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.cancel_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_cancel_entitlement_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CancelEntitlementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_entitlement), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.cancel_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.ActivateEntitlementRequest, + dict, +]) +def test_activate_entitlement(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.activate_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ActivateEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_activate_entitlement_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_entitlement), + '__call__') as call: + client.activate_entitlement() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ActivateEntitlementRequest() + +@pytest.mark.asyncio +async def test_activate_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.ActivateEntitlementRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_entitlement), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.activate_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ActivateEntitlementRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_activate_entitlement_async_from_dict(): + await test_activate_entitlement_async(request_type=dict) + + +def test_activate_entitlement_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ActivateEntitlementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_entitlement), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.activate_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_activate_entitlement_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ActivateEntitlementRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_entitlement), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.activate_entitlement(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.TransferEntitlementsRequest, + dict, +]) +def test_transfer_entitlements(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.transfer_entitlements(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.TransferEntitlementsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_transfer_entitlements_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements), + '__call__') as call: + client.transfer_entitlements() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.TransferEntitlementsRequest() + +@pytest.mark.asyncio +async def test_transfer_entitlements_async(transport: str = 'grpc_asyncio', request_type=service.TransferEntitlementsRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.transfer_entitlements(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.TransferEntitlementsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_transfer_entitlements_async_from_dict(): + await test_transfer_entitlements_async(request_type=dict) + + +def test_transfer_entitlements_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.TransferEntitlementsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.transfer_entitlements(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_transfer_entitlements_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.TransferEntitlementsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.transfer_entitlements(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.TransferEntitlementsToGoogleRequest, + dict, +]) +def test_transfer_entitlements_to_google(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements_to_google), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/spam') + response = client.transfer_entitlements_to_google(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.TransferEntitlementsToGoogleRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_transfer_entitlements_to_google_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements_to_google), + '__call__') as call: + client.transfer_entitlements_to_google() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.TransferEntitlementsToGoogleRequest() + +@pytest.mark.asyncio +async def test_transfer_entitlements_to_google_async(transport: str = 'grpc_asyncio', request_type=service.TransferEntitlementsToGoogleRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements_to_google), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.transfer_entitlements_to_google(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.TransferEntitlementsToGoogleRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_transfer_entitlements_to_google_async_from_dict(): + await test_transfer_entitlements_to_google_async(request_type=dict) + + +def test_transfer_entitlements_to_google_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.TransferEntitlementsToGoogleRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements_to_google), + '__call__') as call: + call.return_value = operations_pb2.Operation(name='operations/op') + client.transfer_entitlements_to_google(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_transfer_entitlements_to_google_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.TransferEntitlementsToGoogleRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.transfer_entitlements_to_google), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + await client.transfer_entitlements_to_google(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.ListChannelPartnerLinksRequest, + dict, +]) +def test_list_channel_partner_links(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_links), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListChannelPartnerLinksResponse( + next_page_token='next_page_token_value', + ) + response = client.list_channel_partner_links(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListChannelPartnerLinksRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListChannelPartnerLinksPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_channel_partner_links_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_links), + '__call__') as call: + client.list_channel_partner_links() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListChannelPartnerLinksRequest() + +@pytest.mark.asyncio +async def test_list_channel_partner_links_async(transport: str = 'grpc_asyncio', request_type=service.ListChannelPartnerLinksRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_links), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerLinksResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_channel_partner_links(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListChannelPartnerLinksRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListChannelPartnerLinksAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_channel_partner_links_async_from_dict(): + await test_list_channel_partner_links_async(request_type=dict) + + +def test_list_channel_partner_links_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListChannelPartnerLinksRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_links), + '__call__') as call: + call.return_value = service.ListChannelPartnerLinksResponse() + client.list_channel_partner_links(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_channel_partner_links_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListChannelPartnerLinksRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_links), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerLinksResponse()) + await client.list_channel_partner_links(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_channel_partner_links_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_links), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + ], + next_page_token='abc', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[], + next_page_token='def', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + ], + next_page_token='ghi', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_channel_partner_links(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, channel_partner_links.ChannelPartnerLink) + for i in results) +def test_list_channel_partner_links_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_links), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + ], + next_page_token='abc', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[], + next_page_token='def', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + ], + next_page_token='ghi', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + ], + ), + RuntimeError, + ) + pages = list(client.list_channel_partner_links(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_channel_partner_links_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_links), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + ], + next_page_token='abc', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[], + next_page_token='def', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + ], + next_page_token='ghi', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_channel_partner_links(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, channel_partner_links.ChannelPartnerLink) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_channel_partner_links_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_links), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + ], + next_page_token='abc', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[], + next_page_token='def', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + ], + next_page_token='ghi', + ), + service.ListChannelPartnerLinksResponse( + channel_partner_links=[ + channel_partner_links.ChannelPartnerLink(), + channel_partner_links.ChannelPartnerLink(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_channel_partner_links(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.GetChannelPartnerLinkRequest, + dict, +]) +def test_get_channel_partner_link(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_link), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = channel_partner_links.ChannelPartnerLink( + name='name_value', + reseller_cloud_identity_id='reseller_cloud_identity_id_value', + link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, + invite_link_uri='invite_link_uri_value', + public_id='public_id_value', + ) + response = client.get_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetChannelPartnerLinkRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, channel_partner_links.ChannelPartnerLink) + assert response.name == 'name_value' + assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' + assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED + assert response.invite_link_uri == 'invite_link_uri_value' + assert response.public_id == 'public_id_value' + + +def test_get_channel_partner_link_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_link), + '__call__') as call: + client.get_channel_partner_link() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetChannelPartnerLinkRequest() + +@pytest.mark.asyncio +async def test_get_channel_partner_link_async(transport: str = 'grpc_asyncio', request_type=service.GetChannelPartnerLinkRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_link), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink( + name='name_value', + reseller_cloud_identity_id='reseller_cloud_identity_id_value', + link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, + invite_link_uri='invite_link_uri_value', + public_id='public_id_value', + )) + response = await client.get_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetChannelPartnerLinkRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, channel_partner_links.ChannelPartnerLink) + assert response.name == 'name_value' + assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' + assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED + assert response.invite_link_uri == 'invite_link_uri_value' + assert response.public_id == 'public_id_value' + + +@pytest.mark.asyncio +async def test_get_channel_partner_link_async_from_dict(): + await test_get_channel_partner_link_async(request_type=dict) + + +def test_get_channel_partner_link_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetChannelPartnerLinkRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_link), + '__call__') as call: + call.return_value = channel_partner_links.ChannelPartnerLink() + client.get_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_channel_partner_link_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetChannelPartnerLinkRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_link), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink()) + await client.get_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.CreateChannelPartnerLinkRequest, + dict, +]) +def test_create_channel_partner_link(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_link), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = channel_partner_links.ChannelPartnerLink( + name='name_value', + reseller_cloud_identity_id='reseller_cloud_identity_id_value', + link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, + invite_link_uri='invite_link_uri_value', + public_id='public_id_value', + ) + response = client.create_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateChannelPartnerLinkRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, channel_partner_links.ChannelPartnerLink) + assert response.name == 'name_value' + assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' + assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED + assert response.invite_link_uri == 'invite_link_uri_value' + assert response.public_id == 'public_id_value' + + +def test_create_channel_partner_link_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_link), + '__call__') as call: + client.create_channel_partner_link() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateChannelPartnerLinkRequest() + +@pytest.mark.asyncio +async def test_create_channel_partner_link_async(transport: str = 'grpc_asyncio', request_type=service.CreateChannelPartnerLinkRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_link), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink( + name='name_value', + reseller_cloud_identity_id='reseller_cloud_identity_id_value', + link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, + invite_link_uri='invite_link_uri_value', + public_id='public_id_value', + )) + response = await client.create_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateChannelPartnerLinkRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, channel_partner_links.ChannelPartnerLink) + assert response.name == 'name_value' + assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' + assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED + assert response.invite_link_uri == 'invite_link_uri_value' + assert response.public_id == 'public_id_value' + + +@pytest.mark.asyncio +async def test_create_channel_partner_link_async_from_dict(): + await test_create_channel_partner_link_async(request_type=dict) + + +def test_create_channel_partner_link_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateChannelPartnerLinkRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_link), + '__call__') as call: + call.return_value = channel_partner_links.ChannelPartnerLink() + client.create_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_channel_partner_link_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateChannelPartnerLinkRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_link), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink()) + await client.create_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.UpdateChannelPartnerLinkRequest, + dict, +]) +def test_update_channel_partner_link(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_link), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = channel_partner_links.ChannelPartnerLink( + name='name_value', + reseller_cloud_identity_id='reseller_cloud_identity_id_value', + link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, + invite_link_uri='invite_link_uri_value', + public_id='public_id_value', + ) + response = client.update_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateChannelPartnerLinkRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, channel_partner_links.ChannelPartnerLink) + assert response.name == 'name_value' + assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' + assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED + assert response.invite_link_uri == 'invite_link_uri_value' + assert response.public_id == 'public_id_value' + + +def test_update_channel_partner_link_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_link), + '__call__') as call: + client.update_channel_partner_link() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateChannelPartnerLinkRequest() + +@pytest.mark.asyncio +async def test_update_channel_partner_link_async(transport: str = 'grpc_asyncio', request_type=service.UpdateChannelPartnerLinkRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_link), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink( + name='name_value', + reseller_cloud_identity_id='reseller_cloud_identity_id_value', + link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, + invite_link_uri='invite_link_uri_value', + public_id='public_id_value', + )) + response = await client.update_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateChannelPartnerLinkRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, channel_partner_links.ChannelPartnerLink) + assert response.name == 'name_value' + assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' + assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED + assert response.invite_link_uri == 'invite_link_uri_value' + assert response.public_id == 'public_id_value' + + +@pytest.mark.asyncio +async def test_update_channel_partner_link_async_from_dict(): + await test_update_channel_partner_link_async(request_type=dict) + + +def test_update_channel_partner_link_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UpdateChannelPartnerLinkRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_link), + '__call__') as call: + call.return_value = channel_partner_links.ChannelPartnerLink() + client.update_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_channel_partner_link_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UpdateChannelPartnerLinkRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_link), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink()) + await client.update_channel_partner_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.GetCustomerRepricingConfigRequest, + dict, +]) +def test_get_customer_repricing_config(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.CustomerRepricingConfig( + name='name_value', + ) + response = client.get_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCustomerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.CustomerRepricingConfig) + assert response.name == 'name_value' + + +def test_get_customer_repricing_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer_repricing_config), + '__call__') as call: + client.get_customer_repricing_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCustomerRepricingConfigRequest() + +@pytest.mark.asyncio +async def test_get_customer_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.GetCustomerRepricingConfigRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig( + name='name_value', + )) + response = await client.get_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCustomerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.CustomerRepricingConfig) + assert response.name == 'name_value' + + +@pytest.mark.asyncio +async def test_get_customer_repricing_config_async_from_dict(): + await test_get_customer_repricing_config_async(request_type=dict) + + +def test_get_customer_repricing_config_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetCustomerRepricingConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer_repricing_config), + '__call__') as call: + call.return_value = repricing.CustomerRepricingConfig() + client.get_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_customer_repricing_config_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetCustomerRepricingConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer_repricing_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) + await client.get_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_customer_repricing_config_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.CustomerRepricingConfig() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_customer_repricing_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_customer_repricing_config_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_customer_repricing_config( + service.GetCustomerRepricingConfigRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_customer_repricing_config_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.CustomerRepricingConfig() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_customer_repricing_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_customer_repricing_config_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_customer_repricing_config( + service.GetCustomerRepricingConfigRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCustomerRepricingConfigsRequest, + dict, +]) +def test_list_customer_repricing_configs(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCustomerRepricingConfigsResponse( + next_page_token='next_page_token_value', + ) + response = client.list_customer_repricing_configs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCustomerRepricingConfigsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCustomerRepricingConfigsPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_customer_repricing_configs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__') as call: + client.list_customer_repricing_configs() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCustomerRepricingConfigsRequest() + +@pytest.mark.asyncio +async def test_list_customer_repricing_configs_async(transport: str = 'grpc_asyncio', request_type=service.ListCustomerRepricingConfigsRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomerRepricingConfigsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_customer_repricing_configs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCustomerRepricingConfigsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCustomerRepricingConfigsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_customer_repricing_configs_async_from_dict(): + await test_list_customer_repricing_configs_async(request_type=dict) + + +def test_list_customer_repricing_configs_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListCustomerRepricingConfigsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__') as call: + call.return_value = service.ListCustomerRepricingConfigsResponse() + client.list_customer_repricing_configs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_customer_repricing_configs_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListCustomerRepricingConfigsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomerRepricingConfigsResponse()) + await client.list_customer_repricing_configs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_customer_repricing_configs_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCustomerRepricingConfigsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_customer_repricing_configs( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_customer_repricing_configs_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_customer_repricing_configs( + service.ListCustomerRepricingConfigsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_customer_repricing_configs_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCustomerRepricingConfigsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomerRepricingConfigsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_customer_repricing_configs( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_customer_repricing_configs_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_customer_repricing_configs( + service.ListCustomerRepricingConfigsRequest(), + parent='parent_value', + ) + + +def test_list_customer_repricing_configs_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + ], + next_page_token='abc', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[], + next_page_token='def', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + ], + next_page_token='ghi', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_customer_repricing_configs(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, repricing.CustomerRepricingConfig) + for i in results) +def test_list_customer_repricing_configs_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + ], + next_page_token='abc', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[], + next_page_token='def', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + ], + next_page_token='ghi', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + ], + ), + RuntimeError, + ) + pages = list(client.list_customer_repricing_configs(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_customer_repricing_configs_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + ], + next_page_token='abc', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[], + next_page_token='def', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + ], + next_page_token='ghi', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_customer_repricing_configs(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, repricing.CustomerRepricingConfig) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_customer_repricing_configs_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_customer_repricing_configs), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + ], + next_page_token='abc', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[], + next_page_token='def', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + ], + next_page_token='ghi', + ), + service.ListCustomerRepricingConfigsResponse( + customer_repricing_configs=[ + repricing.CustomerRepricingConfig(), + repricing.CustomerRepricingConfig(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_customer_repricing_configs(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.CreateCustomerRepricingConfigRequest, + dict, +]) +def test_create_customer_repricing_config(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.CustomerRepricingConfig( + name='name_value', + ) + response = client.create_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCustomerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.CustomerRepricingConfig) + assert response.name == 'name_value' + + +def test_create_customer_repricing_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer_repricing_config), + '__call__') as call: + client.create_customer_repricing_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCustomerRepricingConfigRequest() + +@pytest.mark.asyncio +async def test_create_customer_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.CreateCustomerRepricingConfigRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig( + name='name_value', + )) + response = await client.create_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCustomerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.CustomerRepricingConfig) + assert response.name == 'name_value' + + +@pytest.mark.asyncio +async def test_create_customer_repricing_config_async_from_dict(): + await test_create_customer_repricing_config_async(request_type=dict) + + +def test_create_customer_repricing_config_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateCustomerRepricingConfigRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer_repricing_config), + '__call__') as call: + call.return_value = repricing.CustomerRepricingConfig() + client.create_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_customer_repricing_config_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateCustomerRepricingConfigRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer_repricing_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) + await client.create_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_customer_repricing_config_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.CustomerRepricingConfig() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_customer_repricing_config( + parent='parent_value', + customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].customer_repricing_config + mock_val = repricing.CustomerRepricingConfig(name='name_value') + assert arg == mock_val + + +def test_create_customer_repricing_config_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_customer_repricing_config( + service.CreateCustomerRepricingConfigRequest(), + parent='parent_value', + customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), + ) + +@pytest.mark.asyncio +async def test_create_customer_repricing_config_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.CustomerRepricingConfig() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_customer_repricing_config( + parent='parent_value', + customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].customer_repricing_config + mock_val = repricing.CustomerRepricingConfig(name='name_value') + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_customer_repricing_config_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_customer_repricing_config( + service.CreateCustomerRepricingConfigRequest(), + parent='parent_value', + customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), + ) + + +@pytest.mark.parametrize("request_type", [ + service.UpdateCustomerRepricingConfigRequest, + dict, +]) +def test_update_customer_repricing_config(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.CustomerRepricingConfig( + name='name_value', + ) + response = client.update_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCustomerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.CustomerRepricingConfig) + assert response.name == 'name_value' + + +def test_update_customer_repricing_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer_repricing_config), + '__call__') as call: + client.update_customer_repricing_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCustomerRepricingConfigRequest() + +@pytest.mark.asyncio +async def test_update_customer_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCustomerRepricingConfigRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig( + name='name_value', + )) + response = await client.update_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCustomerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.CustomerRepricingConfig) + assert response.name == 'name_value' + + +@pytest.mark.asyncio +async def test_update_customer_repricing_config_async_from_dict(): + await test_update_customer_repricing_config_async(request_type=dict) + + +def test_update_customer_repricing_config_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UpdateCustomerRepricingConfigRequest() + + request.customer_repricing_config.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer_repricing_config), + '__call__') as call: + call.return_value = repricing.CustomerRepricingConfig() + client.update_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer_repricing_config.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_customer_repricing_config_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UpdateCustomerRepricingConfigRequest() + + request.customer_repricing_config.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer_repricing_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) + await client.update_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer_repricing_config.name=name_value', + ) in kw['metadata'] + + +def test_update_customer_repricing_config_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.CustomerRepricingConfig() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_customer_repricing_config( + customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].customer_repricing_config + mock_val = repricing.CustomerRepricingConfig(name='name_value') + assert arg == mock_val + + +def test_update_customer_repricing_config_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_customer_repricing_config( + service.UpdateCustomerRepricingConfigRequest(), + customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), + ) + +@pytest.mark.asyncio +async def test_update_customer_repricing_config_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.CustomerRepricingConfig() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_customer_repricing_config( + customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].customer_repricing_config + mock_val = repricing.CustomerRepricingConfig(name='name_value') + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_customer_repricing_config_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_customer_repricing_config( + service.UpdateCustomerRepricingConfigRequest(), + customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), + ) + + +@pytest.mark.parametrize("request_type", [ + service.DeleteCustomerRepricingConfigRequest, + dict, +]) +def test_delete_customer_repricing_config(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteCustomerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_customer_repricing_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer_repricing_config), + '__call__') as call: + client.delete_customer_repricing_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteCustomerRepricingConfigRequest() + +@pytest.mark.asyncio +async def test_delete_customer_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCustomerRepricingConfigRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteCustomerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_delete_customer_repricing_config_async_from_dict(): + await test_delete_customer_repricing_config_async(request_type=dict) + + +def test_delete_customer_repricing_config_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.DeleteCustomerRepricingConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer_repricing_config), + '__call__') as call: + call.return_value = None + client.delete_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_delete_customer_repricing_config_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.DeleteCustomerRepricingConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer_repricing_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_customer_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_customer_repricing_config_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_customer_repricing_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_customer_repricing_config_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_customer_repricing_config( + service.DeleteCustomerRepricingConfigRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_customer_repricing_config_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_customer_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_customer_repricing_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_customer_repricing_config_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_customer_repricing_config( + service.DeleteCustomerRepricingConfigRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetChannelPartnerRepricingConfigRequest, + dict, +]) +def test_get_channel_partner_repricing_config(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.ChannelPartnerRepricingConfig( + name='name_value', + ) + response = client.get_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetChannelPartnerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.ChannelPartnerRepricingConfig) + assert response.name == 'name_value' + + +def test_get_channel_partner_repricing_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_repricing_config), + '__call__') as call: + client.get_channel_partner_repricing_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetChannelPartnerRepricingConfigRequest() + +@pytest.mark.asyncio +async def test_get_channel_partner_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.GetChannelPartnerRepricingConfigRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig( + name='name_value', + )) + response = await client.get_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetChannelPartnerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.ChannelPartnerRepricingConfig) + assert response.name == 'name_value' + + +@pytest.mark.asyncio +async def test_get_channel_partner_repricing_config_async_from_dict(): + await test_get_channel_partner_repricing_config_async(request_type=dict) + + +def test_get_channel_partner_repricing_config_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetChannelPartnerRepricingConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_repricing_config), + '__call__') as call: + call.return_value = repricing.ChannelPartnerRepricingConfig() + client.get_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_channel_partner_repricing_config_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.GetChannelPartnerRepricingConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_repricing_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) + await client.get_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_channel_partner_repricing_config_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.ChannelPartnerRepricingConfig() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_channel_partner_repricing_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_channel_partner_repricing_config_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_channel_partner_repricing_config( + service.GetChannelPartnerRepricingConfigRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_channel_partner_repricing_config_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.ChannelPartnerRepricingConfig() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_channel_partner_repricing_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_channel_partner_repricing_config_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_channel_partner_repricing_config( + service.GetChannelPartnerRepricingConfigRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListChannelPartnerRepricingConfigsRequest, + dict, +]) +def test_list_channel_partner_repricing_configs(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListChannelPartnerRepricingConfigsResponse( + next_page_token='next_page_token_value', + ) + response = client.list_channel_partner_repricing_configs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListChannelPartnerRepricingConfigsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListChannelPartnerRepricingConfigsPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_channel_partner_repricing_configs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__') as call: + client.list_channel_partner_repricing_configs() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListChannelPartnerRepricingConfigsRequest() + +@pytest.mark.asyncio +async def test_list_channel_partner_repricing_configs_async(transport: str = 'grpc_asyncio', request_type=service.ListChannelPartnerRepricingConfigsRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerRepricingConfigsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_channel_partner_repricing_configs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListChannelPartnerRepricingConfigsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListChannelPartnerRepricingConfigsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_channel_partner_repricing_configs_async_from_dict(): + await test_list_channel_partner_repricing_configs_async(request_type=dict) + + +def test_list_channel_partner_repricing_configs_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListChannelPartnerRepricingConfigsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__') as call: + call.return_value = service.ListChannelPartnerRepricingConfigsResponse() + client.list_channel_partner_repricing_configs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_channel_partner_repricing_configs_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListChannelPartnerRepricingConfigsRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerRepricingConfigsResponse()) + await client.list_channel_partner_repricing_configs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_channel_partner_repricing_configs_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListChannelPartnerRepricingConfigsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_channel_partner_repricing_configs( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_channel_partner_repricing_configs_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_channel_partner_repricing_configs( + service.ListChannelPartnerRepricingConfigsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_channel_partner_repricing_configs_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListChannelPartnerRepricingConfigsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerRepricingConfigsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_channel_partner_repricing_configs( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_channel_partner_repricing_configs_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_channel_partner_repricing_configs( + service.ListChannelPartnerRepricingConfigsRequest(), + parent='parent_value', + ) + + +def test_list_channel_partner_repricing_configs_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + ], + next_page_token='abc', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[], + next_page_token='def', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + ], + next_page_token='ghi', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_channel_partner_repricing_configs(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, repricing.ChannelPartnerRepricingConfig) + for i in results) +def test_list_channel_partner_repricing_configs_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + ], + next_page_token='abc', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[], + next_page_token='def', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + ], + next_page_token='ghi', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + ], + ), + RuntimeError, + ) + pages = list(client.list_channel_partner_repricing_configs(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_channel_partner_repricing_configs_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + ], + next_page_token='abc', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[], + next_page_token='def', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + ], + next_page_token='ghi', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_channel_partner_repricing_configs(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, repricing.ChannelPartnerRepricingConfig) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_channel_partner_repricing_configs_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_partner_repricing_configs), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + ], + next_page_token='abc', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[], + next_page_token='def', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + ], + next_page_token='ghi', + ), + service.ListChannelPartnerRepricingConfigsResponse( + channel_partner_repricing_configs=[ + repricing.ChannelPartnerRepricingConfig(), + repricing.ChannelPartnerRepricingConfig(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_channel_partner_repricing_configs(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.CreateChannelPartnerRepricingConfigRequest, + dict, +]) +def test_create_channel_partner_repricing_config(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.ChannelPartnerRepricingConfig( + name='name_value', + ) + response = client.create_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateChannelPartnerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.ChannelPartnerRepricingConfig) + assert response.name == 'name_value' + + +def test_create_channel_partner_repricing_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_repricing_config), + '__call__') as call: + client.create_channel_partner_repricing_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateChannelPartnerRepricingConfigRequest() + +@pytest.mark.asyncio +async def test_create_channel_partner_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.CreateChannelPartnerRepricingConfigRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig( + name='name_value', + )) + response = await client.create_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateChannelPartnerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.ChannelPartnerRepricingConfig) + assert response.name == 'name_value' + + +@pytest.mark.asyncio +async def test_create_channel_partner_repricing_config_async_from_dict(): + await test_create_channel_partner_repricing_config_async(request_type=dict) + + +def test_create_channel_partner_repricing_config_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateChannelPartnerRepricingConfigRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_repricing_config), + '__call__') as call: + call.return_value = repricing.ChannelPartnerRepricingConfig() + client.create_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_channel_partner_repricing_config_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.CreateChannelPartnerRepricingConfigRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_repricing_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) + await client.create_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_channel_partner_repricing_config_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.ChannelPartnerRepricingConfig() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_channel_partner_repricing_config( + parent='parent_value', + channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].channel_partner_repricing_config + mock_val = repricing.ChannelPartnerRepricingConfig(name='name_value') + assert arg == mock_val + + +def test_create_channel_partner_repricing_config_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_channel_partner_repricing_config( + service.CreateChannelPartnerRepricingConfigRequest(), + parent='parent_value', + channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), + ) + +@pytest.mark.asyncio +async def test_create_channel_partner_repricing_config_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.ChannelPartnerRepricingConfig() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_channel_partner_repricing_config( + parent='parent_value', + channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].channel_partner_repricing_config + mock_val = repricing.ChannelPartnerRepricingConfig(name='name_value') + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_channel_partner_repricing_config_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_channel_partner_repricing_config( + service.CreateChannelPartnerRepricingConfigRequest(), + parent='parent_value', + channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), + ) + + +@pytest.mark.parametrize("request_type", [ + service.UpdateChannelPartnerRepricingConfigRequest, + dict, +]) +def test_update_channel_partner_repricing_config(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.ChannelPartnerRepricingConfig( + name='name_value', + ) + response = client.update_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateChannelPartnerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.ChannelPartnerRepricingConfig) + assert response.name == 'name_value' + + +def test_update_channel_partner_repricing_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_repricing_config), + '__call__') as call: + client.update_channel_partner_repricing_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateChannelPartnerRepricingConfigRequest() + +@pytest.mark.asyncio +async def test_update_channel_partner_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.UpdateChannelPartnerRepricingConfigRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig( + name='name_value', + )) + response = await client.update_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateChannelPartnerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repricing.ChannelPartnerRepricingConfig) + assert response.name == 'name_value' + + +@pytest.mark.asyncio +async def test_update_channel_partner_repricing_config_async_from_dict(): + await test_update_channel_partner_repricing_config_async(request_type=dict) + + +def test_update_channel_partner_repricing_config_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UpdateChannelPartnerRepricingConfigRequest() + + request.channel_partner_repricing_config.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_repricing_config), + '__call__') as call: + call.return_value = repricing.ChannelPartnerRepricingConfig() + client.update_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'channel_partner_repricing_config.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_channel_partner_repricing_config_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UpdateChannelPartnerRepricingConfigRequest() + + request.channel_partner_repricing_config.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_repricing_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) + await client.update_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'channel_partner_repricing_config.name=name_value', + ) in kw['metadata'] + + +def test_update_channel_partner_repricing_config_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.ChannelPartnerRepricingConfig() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_channel_partner_repricing_config( + channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].channel_partner_repricing_config + mock_val = repricing.ChannelPartnerRepricingConfig(name='name_value') + assert arg == mock_val + + +def test_update_channel_partner_repricing_config_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_channel_partner_repricing_config( + service.UpdateChannelPartnerRepricingConfigRequest(), + channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), + ) + +@pytest.mark.asyncio +async def test_update_channel_partner_repricing_config_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = repricing.ChannelPartnerRepricingConfig() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_channel_partner_repricing_config( + channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].channel_partner_repricing_config + mock_val = repricing.ChannelPartnerRepricingConfig(name='name_value') + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_channel_partner_repricing_config_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_channel_partner_repricing_config( + service.UpdateChannelPartnerRepricingConfigRequest(), + channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), + ) + + +@pytest.mark.parametrize("request_type", [ + service.DeleteChannelPartnerRepricingConfigRequest, + dict, +]) +def test_delete_channel_partner_repricing_config(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteChannelPartnerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_channel_partner_repricing_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_partner_repricing_config), + '__call__') as call: + client.delete_channel_partner_repricing_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteChannelPartnerRepricingConfigRequest() + +@pytest.mark.asyncio +async def test_delete_channel_partner_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.DeleteChannelPartnerRepricingConfigRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteChannelPartnerRepricingConfigRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_delete_channel_partner_repricing_config_async_from_dict(): + await test_delete_channel_partner_repricing_config_async(request_type=dict) + + +def test_delete_channel_partner_repricing_config_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.DeleteChannelPartnerRepricingConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_partner_repricing_config), + '__call__') as call: + call.return_value = None + client.delete_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_delete_channel_partner_repricing_config_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.DeleteChannelPartnerRepricingConfigRequest() + + request.name = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_partner_repricing_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_channel_partner_repricing_config(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_channel_partner_repricing_config_flattened(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_channel_partner_repricing_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_channel_partner_repricing_config_flattened_error(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_channel_partner_repricing_config( + service.DeleteChannelPartnerRepricingConfigRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_channel_partner_repricing_config_flattened_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_partner_repricing_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_channel_partner_repricing_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_channel_partner_repricing_config_flattened_error_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_channel_partner_repricing_config( + service.DeleteChannelPartnerRepricingConfigRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.LookupOfferRequest, + dict, +]) +def test_lookup_offer(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_offer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = offers.Offer( + name='name_value', + ) + response = client.lookup_offer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.LookupOfferRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, offers.Offer) + assert response.name == 'name_value' + + +def test_lookup_offer_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_offer), + '__call__') as call: + client.lookup_offer() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.LookupOfferRequest() + +@pytest.mark.asyncio +async def test_lookup_offer_async(transport: str = 'grpc_asyncio', request_type=service.LookupOfferRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_offer), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(offers.Offer( + name='name_value', + )) + response = await client.lookup_offer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.LookupOfferRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, offers.Offer) + assert response.name == 'name_value' + + +@pytest.mark.asyncio +async def test_lookup_offer_async_from_dict(): + await test_lookup_offer_async(request_type=dict) + + +def test_lookup_offer_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.LookupOfferRequest() + + request.entitlement = 'entitlement_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_offer), + '__call__') as call: + call.return_value = offers.Offer() + client.lookup_offer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'entitlement=entitlement_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_lookup_offer_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.LookupOfferRequest() + + request.entitlement = 'entitlement_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.lookup_offer), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(offers.Offer()) + await client.lookup_offer(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'entitlement=entitlement_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.ListProductsRequest, + dict, +]) +def test_list_products(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_products), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListProductsResponse( + next_page_token='next_page_token_value', + ) + response = client.list_products(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListProductsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListProductsPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_products_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_products), + '__call__') as call: + client.list_products() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListProductsRequest() + +@pytest.mark.asyncio +async def test_list_products_async(transport: str = 'grpc_asyncio', request_type=service.ListProductsRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_products), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListProductsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_products(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListProductsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListProductsAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_products_async_from_dict(): + await test_list_products_async(request_type=dict) + + +def test_list_products_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_products), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListProductsResponse( + products=[ + products.Product(), + products.Product(), + products.Product(), + ], + next_page_token='abc', + ), + service.ListProductsResponse( + products=[], + next_page_token='def', + ), + service.ListProductsResponse( + products=[ + products.Product(), + ], + next_page_token='ghi', + ), + service.ListProductsResponse( + products=[ + products.Product(), + products.Product(), + ], + ), + RuntimeError, + ) + + metadata = () + pager = client.list_products(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, products.Product) + for i in results) +def test_list_products_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_products), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListProductsResponse( + products=[ + products.Product(), + products.Product(), + products.Product(), + ], + next_page_token='abc', + ), + service.ListProductsResponse( + products=[], + next_page_token='def', + ), + service.ListProductsResponse( + products=[ + products.Product(), + ], + next_page_token='ghi', + ), + service.ListProductsResponse( + products=[ + products.Product(), + products.Product(), + ], + ), + RuntimeError, + ) + pages = list(client.list_products(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_products_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_products), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListProductsResponse( + products=[ + products.Product(), + products.Product(), + products.Product(), + ], + next_page_token='abc', + ), + service.ListProductsResponse( + products=[], + next_page_token='def', + ), + service.ListProductsResponse( + products=[ + products.Product(), + ], + next_page_token='ghi', + ), + service.ListProductsResponse( + products=[ + products.Product(), + products.Product(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_products(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, products.Product) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_products_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_products), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListProductsResponse( + products=[ + products.Product(), + products.Product(), + products.Product(), + ], + next_page_token='abc', + ), + service.ListProductsResponse( + products=[], + next_page_token='def', + ), + service.ListProductsResponse( + products=[ + products.Product(), + ], + next_page_token='ghi', + ), + service.ListProductsResponse( + products=[ + products.Product(), + products.Product(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_products(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.ListSkusRequest, + dict, +]) +def test_list_skus(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_skus), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListSkusResponse( + next_page_token='next_page_token_value', + ) + response = client.list_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListSkusRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListSkusPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_skus_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_skus), + '__call__') as call: + client.list_skus() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListSkusRequest() + +@pytest.mark.asyncio +async def test_list_skus_async(transport: str = 'grpc_asyncio', request_type=service.ListSkusRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_skus), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListSkusResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListSkusRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListSkusAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_skus_async_from_dict(): + await test_list_skus_async(request_type=dict) + + +def test_list_skus_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListSkusRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_skus), + '__call__') as call: + call.return_value = service.ListSkusResponse() + client.list_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_skus_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListSkusRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_skus), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListSkusResponse()) + await client.list_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_skus_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_skus), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListSkusResponse( + skus=[ + products.Sku(), + products.Sku(), + products.Sku(), + ], + next_page_token='abc', + ), + service.ListSkusResponse( + skus=[], + next_page_token='def', + ), + service.ListSkusResponse( + skus=[ + products.Sku(), + ], + next_page_token='ghi', + ), + service.ListSkusResponse( + skus=[ + products.Sku(), + products.Sku(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_skus(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, products.Sku) + for i in results) +def test_list_skus_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_skus), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListSkusResponse( + skus=[ + products.Sku(), + products.Sku(), + products.Sku(), + ], + next_page_token='abc', + ), + service.ListSkusResponse( + skus=[], + next_page_token='def', + ), + service.ListSkusResponse( + skus=[ + products.Sku(), + ], + next_page_token='ghi', + ), + service.ListSkusResponse( + skus=[ + products.Sku(), + products.Sku(), + ], + ), + RuntimeError, + ) + pages = list(client.list_skus(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_skus_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_skus), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListSkusResponse( + skus=[ + products.Sku(), + products.Sku(), + products.Sku(), + ], + next_page_token='abc', + ), + service.ListSkusResponse( + skus=[], + next_page_token='def', + ), + service.ListSkusResponse( + skus=[ + products.Sku(), + ], + next_page_token='ghi', + ), + service.ListSkusResponse( + skus=[ + products.Sku(), + products.Sku(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_skus(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, products.Sku) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_skus_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_skus), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListSkusResponse( + skus=[ + products.Sku(), + products.Sku(), + products.Sku(), + ], + next_page_token='abc', + ), + service.ListSkusResponse( + skus=[], + next_page_token='def', + ), + service.ListSkusResponse( + skus=[ + products.Sku(), + ], + next_page_token='ghi', + ), + service.ListSkusResponse( + skus=[ + products.Sku(), + products.Sku(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_skus(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.ListOffersRequest, + dict, +]) +def test_list_offers(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_offers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListOffersResponse( + next_page_token='next_page_token_value', + ) + response = client.list_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListOffersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListOffersPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_offers_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_offers), + '__call__') as call: + client.list_offers() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListOffersRequest() + +@pytest.mark.asyncio +async def test_list_offers_async(transport: str = 'grpc_asyncio', request_type=service.ListOffersRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_offers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListOffersResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListOffersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListOffersAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_offers_async_from_dict(): + await test_list_offers_async(request_type=dict) + + +def test_list_offers_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListOffersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_offers), + '__call__') as call: + call.return_value = service.ListOffersResponse() + client.list_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_offers_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListOffersRequest() + + request.parent = 'parent_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_offers), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListOffersResponse()) + await client.list_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_offers_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_offers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListOffersResponse( + offers=[ + offers.Offer(), + offers.Offer(), + offers.Offer(), + ], + next_page_token='abc', + ), + service.ListOffersResponse( + offers=[], + next_page_token='def', + ), + service.ListOffersResponse( + offers=[ + offers.Offer(), + ], + next_page_token='ghi', + ), + service.ListOffersResponse( + offers=[ + offers.Offer(), + offers.Offer(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_offers(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, offers.Offer) + for i in results) +def test_list_offers_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_offers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListOffersResponse( + offers=[ + offers.Offer(), + offers.Offer(), + offers.Offer(), + ], + next_page_token='abc', + ), + service.ListOffersResponse( + offers=[], + next_page_token='def', + ), + service.ListOffersResponse( + offers=[ + offers.Offer(), + ], + next_page_token='ghi', + ), + service.ListOffersResponse( + offers=[ + offers.Offer(), + offers.Offer(), + ], + ), + RuntimeError, + ) + pages = list(client.list_offers(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_offers_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_offers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListOffersResponse( + offers=[ + offers.Offer(), + offers.Offer(), + offers.Offer(), + ], + next_page_token='abc', + ), + service.ListOffersResponse( + offers=[], + next_page_token='def', + ), + service.ListOffersResponse( + offers=[ + offers.Offer(), + ], + next_page_token='ghi', + ), + service.ListOffersResponse( + offers=[ + offers.Offer(), + offers.Offer(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_offers(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, offers.Offer) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_offers_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_offers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListOffersResponse( + offers=[ + offers.Offer(), + offers.Offer(), + offers.Offer(), + ], + next_page_token='abc', + ), + service.ListOffersResponse( + offers=[], + next_page_token='def', + ), + service.ListOffersResponse( + offers=[ + offers.Offer(), + ], + next_page_token='ghi', + ), + service.ListOffersResponse( + offers=[ + offers.Offer(), + offers.Offer(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_offers(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.ListPurchasableSkusRequest, + dict, +]) +def test_list_purchasable_skus(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_skus), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListPurchasableSkusResponse( + next_page_token='next_page_token_value', + ) + response = client.list_purchasable_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListPurchasableSkusRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPurchasableSkusPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_purchasable_skus_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_skus), + '__call__') as call: + client.list_purchasable_skus() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListPurchasableSkusRequest() + +@pytest.mark.asyncio +async def test_list_purchasable_skus_async(transport: str = 'grpc_asyncio', request_type=service.ListPurchasableSkusRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_skus), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListPurchasableSkusResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_purchasable_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListPurchasableSkusRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPurchasableSkusAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_purchasable_skus_async_from_dict(): + await test_list_purchasable_skus_async(request_type=dict) + + +def test_list_purchasable_skus_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListPurchasableSkusRequest() + + request.customer = 'customer_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_skus), + '__call__') as call: + call.return_value = service.ListPurchasableSkusResponse() + client.list_purchasable_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer=customer_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_purchasable_skus_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListPurchasableSkusRequest() + + request.customer = 'customer_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_skus), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListPurchasableSkusResponse()) + await client.list_purchasable_skus(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer=customer_value', + ) in kw['metadata'] + + +def test_list_purchasable_skus_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_skus), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + service.PurchasableSku(), + service.PurchasableSku(), + ], + next_page_token='abc', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[], + next_page_token='def', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + ], + next_page_token='ghi', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + service.PurchasableSku(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('customer', ''), + )), + ) + pager = client.list_purchasable_skus(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, service.PurchasableSku) + for i in results) +def test_list_purchasable_skus_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_skus), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + service.PurchasableSku(), + service.PurchasableSku(), + ], + next_page_token='abc', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[], + next_page_token='def', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + ], + next_page_token='ghi', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + service.PurchasableSku(), + ], + ), + RuntimeError, + ) + pages = list(client.list_purchasable_skus(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_purchasable_skus_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_skus), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + service.PurchasableSku(), + service.PurchasableSku(), + ], + next_page_token='abc', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[], + next_page_token='def', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + ], + next_page_token='ghi', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + service.PurchasableSku(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_purchasable_skus(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, service.PurchasableSku) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_purchasable_skus_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_skus), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + service.PurchasableSku(), + service.PurchasableSku(), + ], + next_page_token='abc', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[], + next_page_token='def', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + ], + next_page_token='ghi', + ), + service.ListPurchasableSkusResponse( + purchasable_skus=[ + service.PurchasableSku(), + service.PurchasableSku(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_purchasable_skus(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.ListPurchasableOffersRequest, + dict, +]) +def test_list_purchasable_offers(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_offers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListPurchasableOffersResponse( + next_page_token='next_page_token_value', + ) + response = client.list_purchasable_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListPurchasableOffersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPurchasableOffersPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_purchasable_offers_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_offers), + '__call__') as call: + client.list_purchasable_offers() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListPurchasableOffersRequest() + +@pytest.mark.asyncio +async def test_list_purchasable_offers_async(transport: str = 'grpc_asyncio', request_type=service.ListPurchasableOffersRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_offers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListPurchasableOffersResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_purchasable_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListPurchasableOffersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPurchasableOffersAsyncPager) + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_purchasable_offers_async_from_dict(): + await test_list_purchasable_offers_async(request_type=dict) + + +def test_list_purchasable_offers_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListPurchasableOffersRequest() + + request.customer = 'customer_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_offers), + '__call__') as call: + call.return_value = service.ListPurchasableOffersResponse() + client.list_purchasable_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer=customer_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_purchasable_offers_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListPurchasableOffersRequest() + + request.customer = 'customer_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_offers), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListPurchasableOffersResponse()) + await client.list_purchasable_offers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'customer=customer_value', + ) in kw['metadata'] + + +def test_list_purchasable_offers_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_offers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + service.PurchasableOffer(), + service.PurchasableOffer(), + ], + next_page_token='abc', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[], + next_page_token='def', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + ], + next_page_token='ghi', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + service.PurchasableOffer(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('customer', ''), + )), + ) + pager = client.list_purchasable_offers(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, service.PurchasableOffer) + for i in results) +def test_list_purchasable_offers_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_offers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + service.PurchasableOffer(), + service.PurchasableOffer(), + ], + next_page_token='abc', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[], + next_page_token='def', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + ], + next_page_token='ghi', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + service.PurchasableOffer(), + ], + ), + RuntimeError, + ) + pages = list(client.list_purchasable_offers(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_purchasable_offers_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_offers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + service.PurchasableOffer(), + service.PurchasableOffer(), + ], + next_page_token='abc', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[], + next_page_token='def', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + ], + next_page_token='ghi', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + service.PurchasableOffer(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_purchasable_offers(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, service.PurchasableOffer) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_purchasable_offers_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_purchasable_offers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + service.PurchasableOffer(), + service.PurchasableOffer(), + ], + next_page_token='abc', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[], + next_page_token='def', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + ], + next_page_token='ghi', + ), + service.ListPurchasableOffersResponse( + purchasable_offers=[ + service.PurchasableOffer(), + service.PurchasableOffer(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_purchasable_offers(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.RegisterSubscriberRequest, + dict, +]) +def test_register_subscriber(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.register_subscriber), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.RegisterSubscriberResponse( + topic='topic_value', + ) + response = client.register_subscriber(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.RegisterSubscriberRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, service.RegisterSubscriberResponse) + assert response.topic == 'topic_value' + + +def test_register_subscriber_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.register_subscriber), + '__call__') as call: + client.register_subscriber() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.RegisterSubscriberRequest() + +@pytest.mark.asyncio +async def test_register_subscriber_async(transport: str = 'grpc_asyncio', request_type=service.RegisterSubscriberRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.register_subscriber), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.RegisterSubscriberResponse( + topic='topic_value', + )) + response = await client.register_subscriber(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.RegisterSubscriberRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, service.RegisterSubscriberResponse) + assert response.topic == 'topic_value' + + +@pytest.mark.asyncio +async def test_register_subscriber_async_from_dict(): + await test_register_subscriber_async(request_type=dict) + + +def test_register_subscriber_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.RegisterSubscriberRequest() + + request.account = 'account_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.register_subscriber), + '__call__') as call: + call.return_value = service.RegisterSubscriberResponse() + client.register_subscriber(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'account=account_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_register_subscriber_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.RegisterSubscriberRequest() + + request.account = 'account_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.register_subscriber), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.RegisterSubscriberResponse()) + await client.register_subscriber(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'account=account_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.UnregisterSubscriberRequest, + dict, +]) +def test_unregister_subscriber(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.unregister_subscriber), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.UnregisterSubscriberResponse( + topic='topic_value', + ) + response = client.unregister_subscriber(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.UnregisterSubscriberRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, service.UnregisterSubscriberResponse) + assert response.topic == 'topic_value' + + +def test_unregister_subscriber_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.unregister_subscriber), + '__call__') as call: + client.unregister_subscriber() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UnregisterSubscriberRequest() + +@pytest.mark.asyncio +async def test_unregister_subscriber_async(transport: str = 'grpc_asyncio', request_type=service.UnregisterSubscriberRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.unregister_subscriber), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.UnregisterSubscriberResponse( + topic='topic_value', + )) + response = await client.unregister_subscriber(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.UnregisterSubscriberRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, service.UnregisterSubscriberResponse) + assert response.topic == 'topic_value' + + +@pytest.mark.asyncio +async def test_unregister_subscriber_async_from_dict(): + await test_unregister_subscriber_async(request_type=dict) + + +def test_unregister_subscriber_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UnregisterSubscriberRequest() + + request.account = 'account_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.unregister_subscriber), + '__call__') as call: + call.return_value = service.UnregisterSubscriberResponse() + client.unregister_subscriber(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'account=account_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_unregister_subscriber_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.UnregisterSubscriberRequest() + + request.account = 'account_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.unregister_subscriber), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.UnregisterSubscriberResponse()) + await client.unregister_subscriber(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'account=account_value', + ) in kw['metadata'] + + +@pytest.mark.parametrize("request_type", [ + service.ListSubscribersRequest, + dict, +]) +def test_list_subscribers(request_type, transport: str = 'grpc'): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_subscribers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListSubscribersResponse( + topic='topic_value', + service_accounts=['service_accounts_value'], + next_page_token='next_page_token_value', + ) + response = client.list_subscribers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListSubscribersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListSubscribersPager) + assert response.topic == 'topic_value' + assert response.service_accounts == ['service_accounts_value'] + assert response.next_page_token == 'next_page_token_value' + + +def test_list_subscribers_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_subscribers), + '__call__') as call: + client.list_subscribers() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListSubscribersRequest() + +@pytest.mark.asyncio +async def test_list_subscribers_async(transport: str = 'grpc_asyncio', request_type=service.ListSubscribersRequest): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_subscribers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListSubscribersResponse( + topic='topic_value', + service_accounts=['service_accounts_value'], + next_page_token='next_page_token_value', + )) + response = await client.list_subscribers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListSubscribersRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListSubscribersAsyncPager) + assert response.topic == 'topic_value' + assert response.service_accounts == ['service_accounts_value'] + assert response.next_page_token == 'next_page_token_value' + + +@pytest.mark.asyncio +async def test_list_subscribers_async_from_dict(): + await test_list_subscribers_async(request_type=dict) + + +def test_list_subscribers_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListSubscribersRequest() + + request.account = 'account_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_subscribers), + '__call__') as call: + call.return_value = service.ListSubscribersResponse() + client.list_subscribers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'account=account_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_subscribers_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = service.ListSubscribersRequest() + + request.account = 'account_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_subscribers), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListSubscribersResponse()) + await client.list_subscribers(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'account=account_value', + ) in kw['metadata'] + + +def test_list_subscribers_pager(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_subscribers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListSubscribersResponse( + service_accounts=[ + str(), + str(), + str(), + ], + next_page_token='abc', + ), + service.ListSubscribersResponse( + service_accounts=[], + next_page_token='def', + ), + service.ListSubscribersResponse( + service_accounts=[ + str(), + ], + next_page_token='ghi', + ), + service.ListSubscribersResponse( + service_accounts=[ + str(), + str(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('account', ''), + )), + ) + pager = client.list_subscribers(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, str) + for i in results) +def test_list_subscribers_pages(transport_name: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_subscribers), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListSubscribersResponse( + service_accounts=[ + str(), + str(), + str(), + ], + next_page_token='abc', + ), + service.ListSubscribersResponse( + service_accounts=[], + next_page_token='def', + ), + service.ListSubscribersResponse( + service_accounts=[ + str(), + ], + next_page_token='ghi', + ), + service.ListSubscribersResponse( + service_accounts=[ + str(), + str(), + ], + ), + RuntimeError, + ) + pages = list(client.list_subscribers(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_subscribers_async_pager(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_subscribers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListSubscribersResponse( + service_accounts=[ + str(), + str(), + str(), + ], + next_page_token='abc', + ), + service.ListSubscribersResponse( + service_accounts=[], + next_page_token='def', + ), + service.ListSubscribersResponse( + service_accounts=[ + str(), + ], + next_page_token='ghi', + ), + service.ListSubscribersResponse( + service_accounts=[ + str(), + str(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_subscribers(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, str) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_subscribers_async_pages(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_subscribers), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListSubscribersResponse( + service_accounts=[ + str(), + str(), + str(), + ], + next_page_token='abc', + ), + service.ListSubscribersResponse( + service_accounts=[], + next_page_token='def', + ), + service.ListSubscribersResponse( + service_accounts=[ + str(), + ], + next_page_token='ghi', + ), + service.ListSubscribersResponse( + service_accounts=[ + str(), + str(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_subscribers(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.CloudChannelServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.CloudChannelServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudChannelServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.CloudChannelServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CloudChannelServiceClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CloudChannelServiceClient( + client_options=options, + credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.CloudChannelServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudChannelServiceClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.CloudChannelServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = CloudChannelServiceClient(transport=transport) + assert client.transport is transport + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.CloudChannelServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.CloudChannelServiceGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + +@pytest.mark.parametrize("transport_class", [ + transports.CloudChannelServiceGrpcTransport, + transports.CloudChannelServiceGrpcAsyncIOTransport, +]) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class() + adc.assert_called_once() + +@pytest.mark.parametrize("transport_name", [ + "grpc", +]) +def test_transport_kind(transport_name): + transport = CloudChannelServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.CloudChannelServiceGrpcTransport, + ) + +def test_cloud_channel_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.CloudChannelServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json" + ) + + +def test_cloud_channel_service_base_transport(): + # Instantiate the base transport. + with mock.patch('google.cloud.channel_v1.services.cloud_channel_service.transports.CloudChannelServiceTransport.__init__') as Transport: + Transport.return_value = None + transport = transports.CloudChannelServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + 'list_customers', + 'get_customer', + 'check_cloud_identity_accounts_exist', + 'create_customer', + 'update_customer', + 'delete_customer', + 'import_customer', + 'provision_cloud_identity', + 'list_entitlements', + 'list_transferable_skus', + 'list_transferable_offers', + 'get_entitlement', + 'create_entitlement', + 'change_parameters', + 'change_renewal_settings', + 'change_offer', + 'start_paid_service', + 'suspend_entitlement', + 'cancel_entitlement', + 'activate_entitlement', + 'transfer_entitlements', + 'transfer_entitlements_to_google', + 'list_channel_partner_links', + 'get_channel_partner_link', + 'create_channel_partner_link', + 'update_channel_partner_link', + 'get_customer_repricing_config', + 'list_customer_repricing_configs', + 'create_customer_repricing_config', + 'update_customer_repricing_config', + 'delete_customer_repricing_config', + 'get_channel_partner_repricing_config', + 'list_channel_partner_repricing_configs', + 'create_channel_partner_repricing_config', + 'update_channel_partner_repricing_config', + 'delete_channel_partner_repricing_config', + 'lookup_offer', + 'list_products', + 'list_skus', + 'list_offers', + 'list_purchasable_skus', + 'list_purchasable_offers', + 'register_subscriber', + 'unregister_subscriber', + 'list_subscribers', + 'get_operation', + 'cancel_operation', + 'delete_operation', + 'list_operations', + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + with pytest.raises(NotImplementedError): + transport.operations_client + + # Catch all for all remaining methods and properties + remainder = [ + 'kind', + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + + +def test_cloud_channel_service_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.channel_v1.services.cloud_channel_service.transports.CloudChannelServiceTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CloudChannelServiceTransport( + credentials_file="credentials.json", + quota_project_id="octopus", + ) + load_creds.assert_called_once_with("credentials.json", + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/apps.order', +), + quota_project_id="octopus", + ) + + +def test_cloud_channel_service_base_transport_with_adc(): + # Test the default credentials are used if credentials and credentials_file are None. + with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.channel_v1.services.cloud_channel_service.transports.CloudChannelServiceTransport._prep_wrapped_messages') as Transport: + Transport.return_value = None + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CloudChannelServiceTransport() + adc.assert_called_once() + + +def test_cloud_channel_service_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + CloudChannelServiceClient() + adc.assert_called_once_with( + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/apps.order', +), + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudChannelServiceGrpcTransport, + transports.CloudChannelServiceGrpcAsyncIOTransport, + ], +) +def test_cloud_channel_service_transport_auth_adc(transport_class): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) + adc.assert_called_once_with( + scopes=["1", "2"], + default_scopes=( 'https://www.googleapis.com/auth/apps.order',), + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudChannelServiceGrpcTransport, + transports.CloudChannelServiceGrpcAsyncIOTransport, + ], +) +def test_cloud_channel_service_transport_auth_gdch_credentials(transport_class): + host = 'https://language.com' + api_audience_tests = [None, 'https://language2.com'] + api_audience_expect = [host, 'https://language2.com'] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with( + e + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CloudChannelServiceGrpcTransport, grpc_helpers), + (transports.CloudChannelServiceGrpcAsyncIOTransport, grpc_helpers_async) + ], +) +def test_cloud_channel_service_transport_create_channel(transport_class, grpc_helpers): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object( + grpc_helpers, "create_channel", autospec=True + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + adc.return_value = (creds, None) + transport_class( + quota_project_id="octopus", + scopes=["1", "2"] + ) + + create_channel.assert_called_with( + "cloudchannel.googleapis.com:443", + credentials=creds, + credentials_file=None, + quota_project_id="octopus", + default_scopes=( + 'https://www.googleapis.com/auth/apps.order', +), + scopes=["1", "2"], + default_host="cloudchannel.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("transport_class", [transports.CloudChannelServiceGrpcTransport, transports.CloudChannelServiceGrpcAsyncIOTransport]) +def test_cloud_channel_service_grpc_transport_client_cert_source_for_mtls( + transport_class +): + cred = ga_credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, + private_key=expected_key + ) + + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_cloud_channel_service_host_no_port(transport_name): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='cloudchannel.googleapis.com'), + transport=transport_name, + ) + assert client.transport._host == ( + 'cloudchannel.googleapis.com:443' + ) + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_cloud_channel_service_host_with_port(transport_name): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='cloudchannel.googleapis.com:8000'), + transport=transport_name, + ) + assert client.transport._host == ( + 'cloudchannel.googleapis.com:8000' + ) + +def test_cloud_channel_service_grpc_transport_channel(): + channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CloudChannelServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +def test_cloud_channel_service_grpc_asyncio_transport_channel(): + channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CloudChannelServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CloudChannelServiceGrpcTransport, transports.CloudChannelServiceGrpcAsyncIOTransport]) +def test_cloud_channel_service_transport_channel_mtls_with_client_cert_source( + transport_class +): + with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + cred = ga_credentials.AnonymousCredentials() + with pytest.warns(DeprecationWarning): + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (cred, None) + transport = transport_class( + host="squid.clam.whelk", + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + adc.assert_called_once() + + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + assert transport._ssl_channel_credentials == mock_ssl_cred + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CloudChannelServiceGrpcTransport, transports.CloudChannelServiceGrpcAsyncIOTransport]) +def test_cloud_channel_service_transport_channel_mtls_with_adc( + transport_class +): + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + mock_cred = mock.Mock() + + with pytest.warns(DeprecationWarning): + transport = transport_class( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=None, + ) + + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_cloud_channel_service_grpc_lro_client(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_cloud_channel_service_grpc_lro_async_client(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_channel_partner_link_path(): + account = "squid" + channel_partner_link = "clam" + expected = "accounts/{account}/channelPartnerLinks/{channel_partner_link}".format(account=account, channel_partner_link=channel_partner_link, ) + actual = CloudChannelServiceClient.channel_partner_link_path(account, channel_partner_link) + assert expected == actual + + +def test_parse_channel_partner_link_path(): + expected = { + "account": "whelk", + "channel_partner_link": "octopus", + } + path = CloudChannelServiceClient.channel_partner_link_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_channel_partner_link_path(path) + assert expected == actual + +def test_channel_partner_repricing_config_path(): + account = "oyster" + channel_partner = "nudibranch" + channel_partner_repricing_config = "cuttlefish" + expected = "accounts/{account}/channelPartnerLinks/{channel_partner}/channelPartnerRepricingConfigs/{channel_partner_repricing_config}".format(account=account, channel_partner=channel_partner, channel_partner_repricing_config=channel_partner_repricing_config, ) + actual = CloudChannelServiceClient.channel_partner_repricing_config_path(account, channel_partner, channel_partner_repricing_config) + assert expected == actual + + +def test_parse_channel_partner_repricing_config_path(): + expected = { + "account": "mussel", + "channel_partner": "winkle", + "channel_partner_repricing_config": "nautilus", + } + path = CloudChannelServiceClient.channel_partner_repricing_config_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_channel_partner_repricing_config_path(path) + assert expected == actual + +def test_customer_path(): + account = "scallop" + customer = "abalone" + expected = "accounts/{account}/customers/{customer}".format(account=account, customer=customer, ) + actual = CloudChannelServiceClient.customer_path(account, customer) + assert expected == actual + + +def test_parse_customer_path(): + expected = { + "account": "squid", + "customer": "clam", + } + path = CloudChannelServiceClient.customer_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_customer_path(path) + assert expected == actual + +def test_customer_repricing_config_path(): + account = "whelk" + customer = "octopus" + customer_repricing_config = "oyster" + expected = "accounts/{account}/customers/{customer}/customerRepricingConfigs/{customer_repricing_config}".format(account=account, customer=customer, customer_repricing_config=customer_repricing_config, ) + actual = CloudChannelServiceClient.customer_repricing_config_path(account, customer, customer_repricing_config) + assert expected == actual + + +def test_parse_customer_repricing_config_path(): + expected = { + "account": "nudibranch", + "customer": "cuttlefish", + "customer_repricing_config": "mussel", + } + path = CloudChannelServiceClient.customer_repricing_config_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_customer_repricing_config_path(path) + assert expected == actual + +def test_entitlement_path(): + account = "winkle" + customer = "nautilus" + entitlement = "scallop" + expected = "accounts/{account}/customers/{customer}/entitlements/{entitlement}".format(account=account, customer=customer, entitlement=entitlement, ) + actual = CloudChannelServiceClient.entitlement_path(account, customer, entitlement) + assert expected == actual + + +def test_parse_entitlement_path(): + expected = { + "account": "abalone", + "customer": "squid", + "entitlement": "clam", + } + path = CloudChannelServiceClient.entitlement_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_entitlement_path(path) + assert expected == actual + +def test_offer_path(): + account = "whelk" + offer = "octopus" + expected = "accounts/{account}/offers/{offer}".format(account=account, offer=offer, ) + actual = CloudChannelServiceClient.offer_path(account, offer) + assert expected == actual + + +def test_parse_offer_path(): + expected = { + "account": "oyster", + "offer": "nudibranch", + } + path = CloudChannelServiceClient.offer_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_offer_path(path) + assert expected == actual + +def test_product_path(): + product = "cuttlefish" + expected = "products/{product}".format(product=product, ) + actual = CloudChannelServiceClient.product_path(product) + assert expected == actual + + +def test_parse_product_path(): + expected = { + "product": "mussel", + } + path = CloudChannelServiceClient.product_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_product_path(path) + assert expected == actual + +def test_sku_path(): + product = "winkle" + sku = "nautilus" + expected = "products/{product}/skus/{sku}".format(product=product, sku=sku, ) + actual = CloudChannelServiceClient.sku_path(product, sku) + assert expected == actual + + +def test_parse_sku_path(): + expected = { + "product": "scallop", + "sku": "abalone", + } + path = CloudChannelServiceClient.sku_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_sku_path(path) + assert expected == actual + +def test_common_billing_account_path(): + billing_account = "squid" + expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + actual = CloudChannelServiceClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "clam", + } + path = CloudChannelServiceClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_common_billing_account_path(path) + assert expected == actual + +def test_common_folder_path(): + folder = "whelk" + expected = "folders/{folder}".format(folder=folder, ) + actual = CloudChannelServiceClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "octopus", + } + path = CloudChannelServiceClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_common_folder_path(path) + assert expected == actual + +def test_common_organization_path(): + organization = "oyster" + expected = "organizations/{organization}".format(organization=organization, ) + actual = CloudChannelServiceClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "nudibranch", + } + path = CloudChannelServiceClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_common_organization_path(path) + assert expected == actual + +def test_common_project_path(): + project = "cuttlefish" + expected = "projects/{project}".format(project=project, ) + actual = CloudChannelServiceClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "mussel", + } + path = CloudChannelServiceClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_common_project_path(path) + assert expected == actual + +def test_common_location_path(): + project = "winkle" + location = "nautilus" + expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) + actual = CloudChannelServiceClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "scallop", + "location": "abalone", + } + path = CloudChannelServiceClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = CloudChannelServiceClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object(transports.CloudChannelServiceTransport, '_prep_wrapped_messages') as prep: + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object(transports.CloudChannelServiceTransport, '_prep_wrapped_messages') as prep: + transport_class = CloudChannelServiceClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", + ) + with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_delete_operation(transport: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.DeleteOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None +@pytest.mark.asyncio +async def test_delete_operation_async(transport: str = "grpc"): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.DeleteOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + +def test_delete_operation_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.DeleteOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + call.return_value = None + + client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_delete_operation_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.DeleteOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + await client.delete_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_delete_operation_from_dict(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_delete_operation_from_dict_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.delete_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_cancel_operation(transport: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.CancelOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None +@pytest.mark.asyncio +async def test_cancel_operation_async(transport: str = "grpc"): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.CancelOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + +def test_cancel_operation_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.CancelOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + call.return_value = None + + client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_cancel_operation_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.CancelOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + await client.cancel_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_cancel_operation_from_dict(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.cancel_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_cancel_operation_from_dict_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + None + ) + response = await client.cancel_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_get_operation(transport: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.GetOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + response = client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) +@pytest.mark.asyncio +async def test_get_operation_async(transport: str = "grpc"): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.GetOperationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + response = await client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.Operation) + +def test_get_operation_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.GetOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + call.return_value = operations_pb2.Operation() + + client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_get_operation_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.GetOperationRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + await client.get_operation(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_get_operation_from_dict(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation() + + response = client.get_operation( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_get_operation_from_dict_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation() + ) + response = await client.get_operation( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_list_operations(transport: str = "grpc"): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.ListOperationsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.ListOperationsResponse() + response = client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) +@pytest.mark.asyncio +async def test_list_operations_async(transport: str = "grpc"): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = operations_pb2.ListOperationsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + response = await client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, operations_pb2.ListOperationsResponse) + +def test_list_operations_field_headers(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.ListOperationsRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + call.return_value = operations_pb2.ListOperationsResponse() + + client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] +@pytest.mark.asyncio +async def test_list_operations_field_headers_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = operations_pb2.ListOperationsRequest() + request.name = "locations" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + await client.list_operations(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + +def test_list_operations_from_dict(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.ListOperationsResponse() + + response = client.list_operations( + request={ + "name": "locations", + } + ) + call.assert_called() +@pytest.mark.asyncio +async def test_list_operations_from_dict_async(): + client = CloudChannelServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.ListOperationsResponse() + ) + response = await client.list_operations( + request={ + "name": "locations", + } + ) + call.assert_called() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + +def test_client_ctx(): + transports = [ + 'grpc', + ] + for transport in transports: + client = CloudChannelServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + +@pytest.mark.parametrize("client_class,transport_class", [ + (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport), + (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport), +]) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) From 399132c184ef391da0e300d31d4748c432b5bb75 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 17 Oct 2022 16:57:24 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../cloud_channel_reports_service.rst | 0 docs/channel_v1/services.rst | 1 + google/cloud/channel/__init__.py | 38 + google/cloud/channel_v1/__init__.py | 36 + google/cloud/channel_v1/gapic_metadata.json | 44 + .../cloud_channel_reports_service/__init__.py | 6 +- .../async_client.py | 205 +- .../cloud_channel_reports_service/client.py | 295 +- .../cloud_channel_reports_service/pagers.py | 81 +- .../transports/__init__.py | 15 +- .../transports/base.py | 141 +- .../transports/grpc.py | 140 +- .../transports/grpc_asyncio.py | 141 +- .../cloud_channel_service/async_client.py | 3 +- .../services/cloud_channel_service/client.py | 3 +- .../cloud_channel_service/transports/grpc.py | 3 +- .../transports/grpc_asyncio.py | 3 +- google/cloud/channel_v1/types/__init__.py | 30 + .../cloud/channel_v1/types/reports_service.py | 72 +- google/cloud/channel_v1/types/service.py | 18 +- owl-bot-staging/v1/.coveragerc | 17 - owl-bot-staging/v1/.flake8 | 33 - owl-bot-staging/v1/MANIFEST.in | 2 - owl-bot-staging/v1/README.rst | 49 - .../docs/channel_v1/cloud_channel_service.rst | 10 - .../v1/docs/channel_v1/services.rst | 7 - owl-bot-staging/v1/docs/channel_v1/types.rst | 7 - owl-bot-staging/v1/docs/conf.py | 376 - owl-bot-staging/v1/docs/index.rst | 7 - .../v1/google/cloud/channel/__init__.py | 283 - .../v1/google/cloud/channel/py.typed | 2 - .../v1/google/cloud/channel_v1/__init__.py | 284 - .../cloud/channel_v1/gapic_metadata.json | 517 - .../v1/google/cloud/channel_v1/py.typed | 2 - .../cloud/channel_v1/services/__init__.py | 15 - .../cloud_channel_service/__init__.py | 22 - .../cloud_channel_service/async_client.py | 5677 -------- .../services/cloud_channel_service/client.py | 5973 -------- .../services/cloud_channel_service/pagers.py | 1597 -- .../transports/__init__.py | 33 - .../cloud_channel_service/transports/base.py | 820 -- .../cloud_channel_service/transports/grpc.py | 2459 ---- .../transports/grpc_asyncio.py | 2458 ---- .../google/cloud/channel_v1/types/__init__.py | 296 - .../channel_v1/types/channel_partner_links.py | 123 - .../google/cloud/channel_v1/types/common.py | 236 - .../cloud/channel_v1/types/customers.py | 194 - .../cloud/channel_v1/types/entitlements.py | 418 - .../google/cloud/channel_v1/types/offers.py | 503 - .../cloud/channel_v1/types/operations.py | 58 - .../google/cloud/channel_v1/types/products.py | 147 - .../cloud/channel_v1/types/repricing.py | 247 - .../google/cloud/channel_v1/types/service.py | 2391 --- .../channel_v1/types/subscriber_event.py | 134 - owl-bot-staging/v1/mypy.ini | 3 - owl-bot-staging/v1/noxfile.py | 179 - ...nnel_service_activate_entitlement_async.py | 56 - ...annel_service_activate_entitlement_sync.py | 56 - ...hannel_service_cancel_entitlement_async.py | 56 - ...channel_service_cancel_entitlement_sync.py | 56 - ...loud_channel_service_change_offer_async.py | 57 - ...cloud_channel_service_change_offer_sync.py | 57 - ...channel_service_change_parameters_async.py | 56 - ..._channel_service_change_parameters_sync.py | 56 - ...l_service_change_renewal_settings_async.py | 56 - ...el_service_change_renewal_settings_sync.py | 56 - ...eck_cloud_identity_accounts_exist_async.py | 53 - ...heck_cloud_identity_accounts_exist_sync.py | 53 - ...rvice_create_channel_partner_link_async.py | 57 - ...ervice_create_channel_partner_link_sync.py | 57 - ..._channel_partner_repricing_config_async.py | 56 - ...e_channel_partner_repricing_config_sync.py | 56 - ...d_channel_service_create_customer_async.py | 57 - ..._create_customer_repricing_config_async.py | 56 - ...e_create_customer_repricing_config_sync.py | 56 - ...ud_channel_service_create_customer_sync.py | 57 - ...hannel_service_create_entitlement_async.py | 60 - ...channel_service_create_entitlement_sync.py | 60 - ..._channel_partner_repricing_config_async.py | 50 - ...e_channel_partner_repricing_config_sync.py | 50 - ...d_channel_service_delete_customer_async.py | 50 - ..._delete_customer_repricing_config_async.py | 50 - ...e_delete_customer_repricing_config_sync.py | 50 - ...ud_channel_service_delete_customer_sync.py | 50 - ..._service_get_channel_partner_link_async.py | 52 - ...l_service_get_channel_partner_link_sync.py | 52 - ..._channel_partner_repricing_config_async.py | 52 - ...t_channel_partner_repricing_config_sync.py | 52 - ...loud_channel_service_get_customer_async.py | 52 - ...ice_get_customer_repricing_config_async.py | 52 - ...vice_get_customer_repricing_config_sync.py | 52 - ...cloud_channel_service_get_customer_sync.py | 52 - ...d_channel_service_get_entitlement_async.py | 52 - ...ud_channel_service_get_entitlement_sync.py | 52 - ...d_channel_service_import_customer_async.py | 54 - ...ud_channel_service_import_customer_sync.py | 54 - ...ervice_list_channel_partner_links_async.py | 53 - ...service_list_channel_partner_links_sync.py | 53 - ...channel_partner_repricing_configs_async.py | 53 - ..._channel_partner_repricing_configs_sync.py | 53 - ...e_list_customer_repricing_configs_async.py | 53 - ...ce_list_customer_repricing_configs_sync.py | 53 - ...ud_channel_service_list_customers_async.py | 53 - ...oud_channel_service_list_customers_sync.py | 53 - ...channel_service_list_entitlements_async.py | 53 - ..._channel_service_list_entitlements_sync.py | 53 - ...cloud_channel_service_list_offers_async.py | 53 - ..._cloud_channel_service_list_offers_sync.py | 53 - ...oud_channel_service_list_products_async.py | 53 - ...loud_channel_service_list_products_sync.py | 53 - ...l_service_list_purchasable_offers_async.py | 57 - ...el_service_list_purchasable_offers_sync.py | 57 - ...nel_service_list_purchasable_skus_async.py | 57 - ...nnel_service_list_purchasable_skus_sync.py | 57 - ...d_cloud_channel_service_list_skus_async.py | 54 - ...ed_cloud_channel_service_list_skus_sync.py | 54 - ..._channel_service_list_subscribers_async.py | 53 - ...d_channel_service_list_subscribers_sync.py | 53 - ..._service_list_transferable_offers_async.py | 55 - ...l_service_list_transferable_offers_sync.py | 55 - ...el_service_list_transferable_skus_async.py | 54 - ...nel_service_list_transferable_skus_sync.py | 54 - ...loud_channel_service_lookup_offer_async.py | 52 - ...cloud_channel_service_lookup_offer_sync.py | 52 - ..._service_provision_cloud_identity_async.py | 56 - ...l_service_provision_cloud_identity_sync.py | 56 - ...annel_service_register_subscriber_async.py | 53 - ...hannel_service_register_subscriber_sync.py | 53 - ...hannel_service_start_paid_service_async.py | 56 - ...channel_service_start_paid_service_sync.py | 56 - ...annel_service_suspend_entitlement_async.py | 56 - ...hannel_service_suspend_entitlement_sync.py | 56 - ...nel_service_transfer_entitlements_async.py | 60 - ...nnel_service_transfer_entitlements_sync.py | 60 - ...e_transfer_entitlements_to_google_async.py | 60 - ...ce_transfer_entitlements_to_google_sync.py | 60 - ...nel_service_unregister_subscriber_async.py | 53 - ...nnel_service_unregister_subscriber_sync.py | 53 - ...rvice_update_channel_partner_link_async.py | 57 - ...ervice_update_channel_partner_link_sync.py | 57 - ..._channel_partner_repricing_config_async.py | 55 - ...e_channel_partner_repricing_config_sync.py | 55 - ...d_channel_service_update_customer_async.py | 56 - ..._update_customer_repricing_config_async.py | 55 - ...e_update_customer_repricing_config_sync.py | 55 - ...ud_channel_service_update_customer_sync.py | 56 - .../snippet_metadata_channel_v1.json | 7468 ---------- .../v1/scripts/fixup_channel_v1_keywords.py | 223 - owl-bot-staging/v1/setup.py | 58 - owl-bot-staging/v1/tests/__init__.py | 16 - owl-bot-staging/v1/tests/unit/__init__.py | 16 - .../v1/tests/unit/gapic/__init__.py | 16 - .../tests/unit/gapic/channel_v1/__init__.py | 16 - .../channel_v1/test_cloud_channel_service.py | 12149 ---------------- ...orts_service_fetch_report_results_async.py | 0 ...ports_service_fetch_report_results_sync.py | 0 ...nnel_reports_service_list_reports_async.py | 0 ...annel_reports_service_list_reports_sync.py | 0 ...el_reports_service_run_report_job_async.py | 0 ...nel_reports_service_run_report_job_sync.py | 0 .../snippet_metadata_channel_v1.json | 475 + scripts/fixup_channel_v1_keywords.py | 3 + .../test_cloud_channel_reports_service.py | 1309 +- 163 files changed, 2107 insertions(+), 51404 deletions(-) rename {owl-bot-staging/v1/docs => docs}/channel_v1/cloud_channel_reports_service.rst (100%) rename {owl-bot-staging/v1/google => google}/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py (89%) rename {owl-bot-staging/v1/google => google}/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py (86%) rename {owl-bot-staging/v1/google => google}/cloud/channel_v1/services/cloud_channel_reports_service/client.py (84%) rename {owl-bot-staging/v1/google => google}/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py (85%) rename {owl-bot-staging/v1/google => google}/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py (71%) rename {owl-bot-staging/v1/google => google}/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py (66%) rename {owl-bot-staging/v1/google => google}/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py (85%) rename {owl-bot-staging/v1/google => google}/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py (84%) rename {owl-bot-staging/v1/google => google}/cloud/channel_v1/types/reports_service.py (95%) delete mode 100644 owl-bot-staging/v1/.coveragerc delete mode 100644 owl-bot-staging/v1/.flake8 delete mode 100644 owl-bot-staging/v1/MANIFEST.in delete mode 100644 owl-bot-staging/v1/README.rst delete mode 100644 owl-bot-staging/v1/docs/channel_v1/cloud_channel_service.rst delete mode 100644 owl-bot-staging/v1/docs/channel_v1/services.rst delete mode 100644 owl-bot-staging/v1/docs/channel_v1/types.rst delete mode 100644 owl-bot-staging/v1/docs/conf.py delete mode 100644 owl-bot-staging/v1/docs/index.rst delete mode 100644 owl-bot-staging/v1/google/cloud/channel/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel/py.typed delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/py.typed delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/async_client.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/client.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/pagers.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/channel_partner_links.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/common.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/customers.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/entitlements.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/offers.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/operations.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/products.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/repricing.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/service.py delete mode 100644 owl-bot-staging/v1/google/cloud/channel_v1/types/subscriber_event.py delete mode 100644 owl-bot-staging/v1/mypy.ini delete mode 100644 owl-bot-staging/v1/noxfile.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/snippet_metadata_channel_v1.json delete mode 100644 owl-bot-staging/v1/scripts/fixup_channel_v1_keywords.py delete mode 100644 owl-bot-staging/v1/setup.py delete mode 100644 owl-bot-staging/v1/tests/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/channel_v1/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_service.py rename {owl-bot-staging/v1/samples => samples}/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py (100%) rename {owl-bot-staging/v1/samples => samples}/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py (100%) rename {owl-bot-staging/v1/samples => samples}/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py (100%) rename {owl-bot-staging/v1/samples => samples}/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py (100%) rename {owl-bot-staging/v1/samples => samples}/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py (100%) rename {owl-bot-staging/v1/samples => samples}/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py (100%) rename {owl-bot-staging/v1/tests => tests}/unit/gapic/channel_v1/test_cloud_channel_reports_service.py (76%) diff --git a/owl-bot-staging/v1/docs/channel_v1/cloud_channel_reports_service.rst b/docs/channel_v1/cloud_channel_reports_service.rst similarity index 100% rename from owl-bot-staging/v1/docs/channel_v1/cloud_channel_reports_service.rst rename to docs/channel_v1/cloud_channel_reports_service.rst diff --git a/docs/channel_v1/services.rst b/docs/channel_v1/services.rst index afcb3e9..a310f7a 100644 --- a/docs/channel_v1/services.rst +++ b/docs/channel_v1/services.rst @@ -3,4 +3,5 @@ Services for Google Cloud Channel v1 API .. toctree:: :maxdepth: 2 + cloud_channel_reports_service cloud_channel_service diff --git a/google/cloud/channel/__init__.py b/google/cloud/channel/__init__.py index 7d0eb98..0d1b70e 100644 --- a/google/cloud/channel/__init__.py +++ b/google/cloud/channel/__init__.py @@ -14,6 +14,12 @@ # limitations under the License. # +from google.cloud.channel_v1.services.cloud_channel_reports_service.async_client import ( + CloudChannelReportsServiceAsyncClient, +) +from google.cloud.channel_v1.services.cloud_channel_reports_service.client import ( + CloudChannelReportsServiceClient, +) from google.cloud.channel_v1.services.cloud_channel_service.async_client import ( CloudChannelServiceAsyncClient, ) @@ -68,6 +74,22 @@ Product, Sku, ) +from google.cloud.channel_v1.types.reports_service import ( + Column, + DateRange, + FetchReportResultsRequest, + FetchReportResultsResponse, + ListReportsRequest, + ListReportsResponse, + Report, + ReportJob, + ReportResultsMetadata, + ReportStatus, + ReportValue, + Row, + RunReportJobRequest, + RunReportJobResponse, +) from google.cloud.channel_v1.types.repricing import ( ChannelPartnerRepricingConfig, CustomerRepricingConfig, @@ -151,6 +173,8 @@ ) __all__ = ( + "CloudChannelReportsServiceClient", + "CloudChannelReportsServiceAsyncClient", "CloudChannelServiceClient", "CloudChannelServiceAsyncClient", "ChannelPartnerLink", @@ -192,6 +216,20 @@ "Product", "Sku", "MediaType", + "Column", + "DateRange", + "FetchReportResultsRequest", + "FetchReportResultsResponse", + "ListReportsRequest", + "ListReportsResponse", + "Report", + "ReportJob", + "ReportResultsMetadata", + "ReportStatus", + "ReportValue", + "Row", + "RunReportJobRequest", + "RunReportJobResponse", "ChannelPartnerRepricingConfig", "CustomerRepricingConfig", "PercentageAdjustment", diff --git a/google/cloud/channel_v1/__init__.py b/google/cloud/channel_v1/__init__.py index c5f1724..a6e47a6 100644 --- a/google/cloud/channel_v1/__init__.py +++ b/google/cloud/channel_v1/__init__.py @@ -14,6 +14,10 @@ # limitations under the License. # +from .services.cloud_channel_reports_service import ( + CloudChannelReportsServiceAsyncClient, + CloudChannelReportsServiceClient, +) from .services.cloud_channel_service import ( CloudChannelServiceAsyncClient, CloudChannelServiceClient, @@ -55,6 +59,22 @@ ) from .types.operations import OperationMetadata from .types.products import MarketingInfo, Media, MediaType, Product, Sku +from .types.reports_service import ( + Column, + DateRange, + FetchReportResultsRequest, + FetchReportResultsResponse, + ListReportsRequest, + ListReportsResponse, + Report, + ReportJob, + ReportResultsMetadata, + ReportStatus, + ReportValue, + Row, + RunReportJobRequest, + RunReportJobResponse, +) from .types.repricing import ( ChannelPartnerRepricingConfig, CustomerRepricingConfig, @@ -134,6 +154,7 @@ from .types.subscriber_event import CustomerEvent, EntitlementEvent, SubscriberEvent __all__ = ( + "CloudChannelReportsServiceAsyncClient", "CloudChannelServiceAsyncClient", "ActivateEntitlementRequest", "AdminUser", @@ -148,9 +169,11 @@ "ChannelPartnerRepricingConfig", "CheckCloudIdentityAccountsExistRequest", "CheckCloudIdentityAccountsExistResponse", + "CloudChannelReportsServiceClient", "CloudChannelServiceClient", "CloudIdentityCustomerAccount", "CloudIdentityInfo", + "Column", "CommitmentSettings", "Constraints", "ContactInfo", @@ -163,12 +186,15 @@ "CustomerConstraints", "CustomerEvent", "CustomerRepricingConfig", + "DateRange", "DeleteChannelPartnerRepricingConfigRequest", "DeleteCustomerRepricingConfigRequest", "DeleteCustomerRequest", "EduData", "Entitlement", "EntitlementEvent", + "FetchReportResultsRequest", + "FetchReportResultsResponse", "GetChannelPartnerLinkRequest", "GetChannelPartnerRepricingConfigRequest", "GetCustomerRepricingConfigRequest", @@ -193,6 +219,8 @@ "ListPurchasableOffersResponse", "ListPurchasableSkusRequest", "ListPurchasableSkusResponse", + "ListReportsRequest", + "ListReportsResponse", "ListSkusRequest", "ListSkusResponse", "ListSubscribersRequest", @@ -229,9 +257,17 @@ "RegisterSubscriberRequest", "RegisterSubscriberResponse", "RenewalSettings", + "Report", + "ReportJob", + "ReportResultsMetadata", + "ReportStatus", + "ReportValue", "RepricingAdjustment", "RepricingConfig", "ResourceType", + "Row", + "RunReportJobRequest", + "RunReportJobResponse", "Sku", "StartPaidServiceRequest", "SubscriberEvent", diff --git a/google/cloud/channel_v1/gapic_metadata.json b/google/cloud/channel_v1/gapic_metadata.json index 38333bb..aff1a2d 100644 --- a/google/cloud/channel_v1/gapic_metadata.json +++ b/google/cloud/channel_v1/gapic_metadata.json @@ -5,6 +5,50 @@ "protoPackage": "google.cloud.channel.v1", "schema": "1.0", "services": { + "CloudChannelReportsService": { + "clients": { + "grpc": { + "libraryClient": "CloudChannelReportsServiceClient", + "rpcs": { + "FetchReportResults": { + "methods": [ + "fetch_report_results" + ] + }, + "ListReports": { + "methods": [ + "list_reports" + ] + }, + "RunReportJob": { + "methods": [ + "run_report_job" + ] + } + } + }, + "grpc-async": { + "libraryClient": "CloudChannelReportsServiceAsyncClient", + "rpcs": { + "FetchReportResults": { + "methods": [ + "fetch_report_results" + ] + }, + "ListReports": { + "methods": [ + "list_reports" + ] + }, + "RunReportJob": { + "methods": [ + "run_report_job" + ] + } + } + } + } + }, "CloudChannelService": { "clients": { "grpc": { diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py b/google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py similarity index 89% rename from owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py rename to google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py index 73fa291..8815a86 100644 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py +++ b/google/cloud/channel_v1/services/cloud_channel_reports_service/__init__.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import CloudChannelReportsServiceClient from .async_client import CloudChannelReportsServiceAsyncClient +from .client import CloudChannelReportsServiceClient __all__ = ( - 'CloudChannelReportsServiceClient', - 'CloudChannelReportsServiceAsyncClient', + "CloudChannelReportsServiceClient", + "CloudChannelReportsServiceAsyncClient", ) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py b/google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py similarity index 86% rename from owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py rename to google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py index 483e7a5..e690456 100644 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py +++ b/google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore +from google.api_core.client_options import ClientOptions +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,13 +33,14 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.channel_v1.services.cloud_channel_reports_service import pagers -from google.cloud.channel_v1.types import operations -from google.cloud.channel_v1.types import reports_service from google.longrunning import operations_pb2 -from .transports.base import CloudChannelReportsServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import CloudChannelReportsServiceGrpcAsyncIOTransport + +from google.cloud.channel_v1.services.cloud_channel_reports_service import pagers +from google.cloud.channel_v1.types import operations, reports_service + from .client import CloudChannelReportsServiceClient +from .transports.base import DEFAULT_CLIENT_INFO, CloudChannelReportsServiceTransport +from .transports.grpc_asyncio import CloudChannelReportsServiceGrpcAsyncIOTransport class CloudChannelReportsServiceAsyncClient: @@ -57,17 +58,39 @@ class CloudChannelReportsServiceAsyncClient: report_path = staticmethod(CloudChannelReportsServiceClient.report_path) parse_report_path = staticmethod(CloudChannelReportsServiceClient.parse_report_path) report_job_path = staticmethod(CloudChannelReportsServiceClient.report_job_path) - parse_report_job_path = staticmethod(CloudChannelReportsServiceClient.parse_report_job_path) - common_billing_account_path = staticmethod(CloudChannelReportsServiceClient.common_billing_account_path) - parse_common_billing_account_path = staticmethod(CloudChannelReportsServiceClient.parse_common_billing_account_path) - common_folder_path = staticmethod(CloudChannelReportsServiceClient.common_folder_path) - parse_common_folder_path = staticmethod(CloudChannelReportsServiceClient.parse_common_folder_path) - common_organization_path = staticmethod(CloudChannelReportsServiceClient.common_organization_path) - parse_common_organization_path = staticmethod(CloudChannelReportsServiceClient.parse_common_organization_path) - common_project_path = staticmethod(CloudChannelReportsServiceClient.common_project_path) - parse_common_project_path = staticmethod(CloudChannelReportsServiceClient.parse_common_project_path) - common_location_path = staticmethod(CloudChannelReportsServiceClient.common_location_path) - parse_common_location_path = staticmethod(CloudChannelReportsServiceClient.parse_common_location_path) + parse_report_job_path = staticmethod( + CloudChannelReportsServiceClient.parse_report_job_path + ) + common_billing_account_path = staticmethod( + CloudChannelReportsServiceClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + CloudChannelReportsServiceClient.parse_common_billing_account_path + ) + common_folder_path = staticmethod( + CloudChannelReportsServiceClient.common_folder_path + ) + parse_common_folder_path = staticmethod( + CloudChannelReportsServiceClient.parse_common_folder_path + ) + common_organization_path = staticmethod( + CloudChannelReportsServiceClient.common_organization_path + ) + parse_common_organization_path = staticmethod( + CloudChannelReportsServiceClient.parse_common_organization_path + ) + common_project_path = staticmethod( + CloudChannelReportsServiceClient.common_project_path + ) + parse_common_project_path = staticmethod( + CloudChannelReportsServiceClient.parse_common_project_path + ) + common_location_path = staticmethod( + CloudChannelReportsServiceClient.common_location_path + ) + parse_common_location_path = staticmethod( + CloudChannelReportsServiceClient.parse_common_location_path + ) @classmethod def from_service_account_info(cls, info: dict, *args, **kwargs): @@ -103,7 +126,9 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[ClientOptions] = None + ): """Return the API endpoint and client cert source for mutual TLS. The client cert source is determined in the following order: @@ -145,14 +170,19 @@ def transport(self) -> CloudChannelReportsServiceTransport: """ return self._client.transport - get_transport_class = functools.partial(type(CloudChannelReportsServiceClient).get_transport_class, type(CloudChannelReportsServiceClient)) + get_transport_class = functools.partial( + type(CloudChannelReportsServiceClient).get_transport_class, + type(CloudChannelReportsServiceClient), + ) - def __init__(self, *, - credentials: ga_credentials.Credentials = None, - transport: Union[str, CloudChannelReportsServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: + def __init__( + self, + *, + credentials: ga_credentials.Credentials = None, + transport: Union[str, CloudChannelReportsServiceTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: """Instantiates the cloud channel reports service client. Args: @@ -190,16 +220,16 @@ def __init__(self, *, transport=transport, client_options=client_options, client_info=client_info, - ) - async def run_report_job(self, - request: Union[reports_service.RunReportJobRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: + async def run_report_job( + self, + request: Union[reports_service.RunReportJobRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: r"""Begins generation of data for a given report. The report identifier is a UID (for example, ``613bf59q``). @@ -291,9 +321,7 @@ async def sample_run_report_job(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -315,14 +343,15 @@ async def sample_run_report_job(): # Done; return the response. return response - async def fetch_report_results(self, - request: Union[reports_service.FetchReportResultsRequest, dict] = None, - *, - report_job: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.FetchReportResultsAsyncPager: + async def fetch_report_results( + self, + request: Union[reports_service.FetchReportResultsRequest, dict] = None, + *, + report_job: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.FetchReportResultsAsyncPager: r"""Retrieves data generated by [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. @@ -387,8 +416,10 @@ async def sample_fetch_report_results(): # gotten any keyword arguments that map to the request. has_flattened_params = any([report_job]) if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) request = reports_service.FetchReportResultsRequest(request) @@ -408,9 +439,9 @@ async def sample_fetch_report_results(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("report_job", request.report_job), - )), + gapic_v1.routing_header.to_grpc_metadata( + (("report_job", request.report_job),) + ), ) # Send the request. @@ -433,14 +464,15 @@ async def sample_fetch_report_results(): # Done; return the response. return response - async def list_reports(self, - request: Union[reports_service.ListReportsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListReportsAsyncPager: + async def list_reports( + self, + request: Union[reports_service.ListReportsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListReportsAsyncPager: r"""Lists the reports that RunReportJob can run. These reports include an ID, a description, and the list of columns that will be in the result. @@ -504,8 +536,10 @@ async def sample_list_reports(): # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) request = reports_service.ListReportsRequest(request) @@ -525,9 +559,7 @@ async def sample_list_reports(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -590,13 +622,16 @@ async def list_operations( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -641,13 +676,16 @@ async def get_operation( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -696,12 +734,16 @@ async def delete_operation( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) async def cancel_operation( self, @@ -746,12 +788,16 @@ async def cancel_operation( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) async def __aenter__(self): return self @@ -759,6 +805,7 @@ async def __aenter__(self): async def __aexit__(self, exc_type, exc, tb): await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( @@ -769,6 +816,4 @@ async def __aexit__(self, exc_type, exc, tb): DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -__all__ = ( - "CloudChannelReportsServiceAsyncClient", -) +__all__ = ("CloudChannelReportsServiceAsyncClient",) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/client.py b/google/cloud/channel_v1/services/cloud_channel_reports_service/client.py similarity index 84% rename from owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/client.py rename to google/cloud/channel_v1/services/cloud_channel_reports_service/client.py index 9471313..5325507 100644 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/client.py +++ b/google/cloud/channel_v1/services/cloud_channel_reports_service/client.py @@ -17,17 +17,17 @@ import os import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,11 +36,12 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.channel_v1.services.cloud_channel_reports_service import pagers -from google.cloud.channel_v1.types import operations -from google.cloud.channel_v1.types import reports_service from google.longrunning import operations_pb2 -from .transports.base import CloudChannelReportsServiceTransport, DEFAULT_CLIENT_INFO + +from google.cloud.channel_v1.services.cloud_channel_reports_service import pagers +from google.cloud.channel_v1.types import operations, reports_service + +from .transports.base import DEFAULT_CLIENT_INFO, CloudChannelReportsServiceTransport from .transports.grpc import CloudChannelReportsServiceGrpcTransport from .transports.grpc_asyncio import CloudChannelReportsServiceGrpcAsyncIOTransport @@ -52,13 +53,17 @@ class CloudChannelReportsServiceClientMeta(type): support objects (e.g. transport) without polluting the client instance objects. """ - _transport_registry = OrderedDict() # type: Dict[str, Type[CloudChannelReportsServiceTransport]] + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[CloudChannelReportsServiceTransport]] _transport_registry["grpc"] = CloudChannelReportsServiceGrpcTransport _transport_registry["grpc_asyncio"] = CloudChannelReportsServiceGrpcAsyncIOTransport - def get_transport_class(cls, - label: str = None, - ) -> Type[CloudChannelReportsServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[CloudChannelReportsServiceTransport]: """Returns an appropriate transport class. Args: @@ -150,8 +155,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): Returns: CloudChannelReportsServiceClient: The constructed client. """ - credentials = service_account.Credentials.from_service_account_file( - filename) + credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials return cls(*args, **kwargs) @@ -168,84 +172,122 @@ def transport(self) -> CloudChannelReportsServiceTransport: return self._transport @staticmethod - def report_path(account: str,report: str,) -> str: + def report_path( + account: str, + report: str, + ) -> str: """Returns a fully-qualified report string.""" - return "accounts/{account}/reports/{report}".format(account=account, report=report, ) + return "accounts/{account}/reports/{report}".format( + account=account, + report=report, + ) @staticmethod - def parse_report_path(path: str) -> Dict[str,str]: + def parse_report_path(path: str) -> Dict[str, str]: """Parses a report path into its component segments.""" m = re.match(r"^accounts/(?P.+?)/reports/(?P.+?)$", path) return m.groupdict() if m else {} @staticmethod - def report_job_path(account: str,report_job: str,) -> str: + def report_job_path( + account: str, + report_job: str, + ) -> str: """Returns a fully-qualified report_job string.""" - return "accounts/{account}/reportJobs/{report_job}".format(account=account, report_job=report_job, ) + return "accounts/{account}/reportJobs/{report_job}".format( + account=account, + report_job=report_job, + ) @staticmethod - def parse_report_job_path(path: str) -> Dict[str,str]: + def parse_report_job_path(path: str) -> Dict[str, str]: """Parses a report_job path into its component segments.""" - m = re.match(r"^accounts/(?P.+?)/reportJobs/(?P.+?)$", path) + m = re.match( + r"^accounts/(?P.+?)/reportJobs/(?P.+?)$", path + ) return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str, ) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str,str]: + def parse_common_billing_account_path(path: str) -> Dict[str, str]: """Parse a billing_account path into its component segments.""" m = re.match(r"^billingAccounts/(?P.+?)$", path) return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str, ) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder, ) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod - def parse_common_folder_path(path: str) -> Dict[str,str]: + def parse_common_folder_path(path: str) -> Dict[str, str]: """Parse a folder path into its component segments.""" m = re.match(r"^folders/(?P.+?)$", path) return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str, ) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization, ) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod - def parse_common_organization_path(path: str) -> Dict[str,str]: + def parse_common_organization_path(path: str) -> Dict[str, str]: """Parse a organization path into its component segments.""" m = re.match(r"^organizations/(?P.+?)$", path) return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str, ) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project, ) + return "projects/{project}".format( + project=project, + ) @staticmethod - def parse_common_project_path(path: str) -> Dict[str,str]: + def parse_common_project_path(path: str) -> Dict[str, str]: """Parse a project path into its component segments.""" m = re.match(r"^projects/(?P.+?)$", path) return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str, ) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format(project=project, location=location, ) + return "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) @staticmethod - def parse_common_location_path(path: str) -> Dict[str,str]: + def parse_common_location_path(path: str) -> Dict[str, str]: """Parse a location path into its component segments.""" m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) return m.groupdict() if m else {} @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): """Return the API endpoint and client cert source for mutual TLS. The client cert source is determined in the following order: @@ -281,9 +323,13 @@ def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_optio use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") if use_client_cert not in ("true", "false"): - raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) # Figure out the client cert source to use. client_cert_source = None @@ -296,19 +342,23 @@ def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_optio # Figure out which api endpoint to use. if client_options.api_endpoint is not None: api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): api_endpoint = cls.DEFAULT_MTLS_ENDPOINT else: api_endpoint = cls.DEFAULT_ENDPOINT return api_endpoint, client_cert_source - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, CloudChannelReportsServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: + def __init__( + self, + *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, CloudChannelReportsServiceTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: """Instantiates the cloud channel reports service client. Args: @@ -351,11 +401,15 @@ def __init__(self, *, if client_options is None: client_options = client_options_lib.ClientOptions() - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options + ) api_key_value = getattr(client_options, "api_key", None) if api_key_value and credentials: - raise ValueError("client_options.api_key and credentials are mutually exclusive") + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport @@ -363,8 +417,10 @@ def __init__(self, *, if isinstance(transport, CloudChannelReportsServiceTransport): # transport is a CloudChannelReportsServiceTransport instance. if credentials or client_options.credentials_file or api_key_value: - raise ValueError("When providing a transport instance, " - "provide its credentials directly.") + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) if client_options.scopes: raise ValueError( "When providing a transport instance, provide its scopes " @@ -374,8 +430,12 @@ def __init__(self, *, else: import google.auth._default # type: ignore - if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): - credentials = google.auth._default.get_api_key_credentials(api_key_value) + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) Transport = type(self).get_transport_class(transport) self._transport = Transport( @@ -390,13 +450,14 @@ def __init__(self, *, api_audience=client_options.api_audience, ) - def run_report_job(self, - request: Union[reports_service.RunReportJobRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: + def run_report_job( + self, + request: Union[reports_service.RunReportJobRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: r"""Begins generation of data for a given report. The report identifier is a UID (for example, ``613bf59q``). @@ -486,12 +547,10 @@ def sample_run_report_job(): # and friendly error handling. rpc = self._transport._wrapped_methods[self._transport.run_report_job] - # Certain fields should be provided within the metadata header; + # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -513,14 +572,15 @@ def sample_run_report_job(): # Done; return the response. return response - def fetch_report_results(self, - request: Union[reports_service.FetchReportResultsRequest, dict] = None, - *, - report_job: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.FetchReportResultsPager: + def fetch_report_results( + self, + request: Union[reports_service.FetchReportResultsRequest, dict] = None, + *, + report_job: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.FetchReportResultsPager: r"""Retrieves data generated by [CloudChannelReportsService.RunReportJob][google.cloud.channel.v1.CloudChannelReportsService.RunReportJob]. @@ -585,8 +645,10 @@ def sample_fetch_report_results(): # gotten any keyword arguments that map to the request. has_flattened_params = any([report_job]) if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) # Minor optimization to avoid making a copy if the user passes # in a reports_service.FetchReportResultsRequest. @@ -603,12 +665,12 @@ def sample_fetch_report_results(): # and friendly error handling. rpc = self._transport._wrapped_methods[self._transport.fetch_report_results] - # Certain fields should be provided within the metadata header; + # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("report_job", request.report_job), - )), + gapic_v1.routing_header.to_grpc_metadata( + (("report_job", request.report_job),) + ), ) # Send the request. @@ -631,14 +693,15 @@ def sample_fetch_report_results(): # Done; return the response. return response - def list_reports(self, - request: Union[reports_service.ListReportsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListReportsPager: + def list_reports( + self, + request: Union[reports_service.ListReportsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListReportsPager: r"""Lists the reports that RunReportJob can run. These reports include an ID, a description, and the list of columns that will be in the result. @@ -702,8 +765,10 @@ def sample_list_reports(): # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) # Minor optimization to avoid making a copy if the user passes # in a reports_service.ListReportsRequest. @@ -720,12 +785,10 @@ def sample_list_reports(): # and friendly error handling. rpc = self._transport._wrapped_methods[self._transport.list_reports] - # Certain fields should be provided within the metadata header; + # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -801,13 +864,16 @@ def list_operations( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -852,13 +918,16 @@ def get_operation( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -907,12 +976,16 @@ def delete_operation( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) def cancel_operation( self, @@ -957,16 +1030,16 @@ def cancel_operation( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - - - + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) try: @@ -979,6 +1052,4 @@ def cancel_operation( DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -__all__ = ( - "CloudChannelReportsServiceClient", -) +__all__ = ("CloudChannelReportsServiceClient",) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py b/google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py similarity index 85% rename from owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py rename to google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py index dc033f4..fa8146d 100644 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py +++ b/google/cloud/channel_v1/services/cloud_channel_reports_service/pagers.py @@ -13,7 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator +from typing import ( + Any, + AsyncIterator, + Awaitable, + Callable, + Iterator, + Optional, + Sequence, + Tuple, +) from google.cloud.channel_v1.types import reports_service @@ -35,12 +44,15 @@ class FetchReportResultsPager: attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ - def __init__(self, - method: Callable[..., reports_service.FetchReportResultsResponse], - request: reports_service.FetchReportResultsRequest, - response: reports_service.FetchReportResultsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): + + def __init__( + self, + method: Callable[..., reports_service.FetchReportResultsResponse], + request: reports_service.FetchReportResultsRequest, + response: reports_service.FetchReportResultsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): """Instantiate the pager. Args: @@ -74,7 +86,7 @@ def __iter__(self) -> Iterator[reports_service.Row]: yield from page.rows def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) class FetchReportResultsAsyncPager: @@ -94,12 +106,15 @@ class FetchReportResultsAsyncPager: attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ - def __init__(self, - method: Callable[..., Awaitable[reports_service.FetchReportResultsResponse]], - request: reports_service.FetchReportResultsRequest, - response: reports_service.FetchReportResultsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): + + def __init__( + self, + method: Callable[..., Awaitable[reports_service.FetchReportResultsResponse]], + request: reports_service.FetchReportResultsRequest, + response: reports_service.FetchReportResultsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): """Instantiates the pager. Args: @@ -127,6 +142,7 @@ async def pages(self) -> AsyncIterator[reports_service.FetchReportResultsRespons self._request.page_token = self._response.next_page_token self._response = await self._method(self._request, metadata=self._metadata) yield self._response + def __aiter__(self) -> AsyncIterator[reports_service.Row]: async def async_generator(): async for page in self.pages: @@ -136,7 +152,7 @@ async def async_generator(): return async_generator() def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) class ListReportsPager: @@ -156,12 +172,15 @@ class ListReportsPager: attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ - def __init__(self, - method: Callable[..., reports_service.ListReportsResponse], - request: reports_service.ListReportsRequest, - response: reports_service.ListReportsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): + + def __init__( + self, + method: Callable[..., reports_service.ListReportsResponse], + request: reports_service.ListReportsRequest, + response: reports_service.ListReportsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): """Instantiate the pager. Args: @@ -195,7 +214,7 @@ def __iter__(self) -> Iterator[reports_service.Report]: yield from page.reports def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) class ListReportsAsyncPager: @@ -215,12 +234,15 @@ class ListReportsAsyncPager: attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ - def __init__(self, - method: Callable[..., Awaitable[reports_service.ListReportsResponse]], - request: reports_service.ListReportsRequest, - response: reports_service.ListReportsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): + + def __init__( + self, + method: Callable[..., Awaitable[reports_service.ListReportsResponse]], + request: reports_service.ListReportsRequest, + response: reports_service.ListReportsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): """Instantiates the pager. Args: @@ -248,6 +270,7 @@ async def pages(self) -> AsyncIterator[reports_service.ListReportsResponse]: self._request.page_token = self._response.next_page_token self._response = await self._method(self._request, metadata=self._metadata) yield self._response + def __aiter__(self) -> AsyncIterator[reports_service.Report]: async def async_generator(): async for page in self.pages: @@ -257,4 +280,4 @@ async def async_generator(): return async_generator() def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py b/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py similarity index 71% rename from owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py rename to google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py index b81caab..18c348e 100644 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py +++ b/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/__init__.py @@ -20,14 +20,15 @@ from .grpc import CloudChannelReportsServiceGrpcTransport from .grpc_asyncio import CloudChannelReportsServiceGrpcAsyncIOTransport - # Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[CloudChannelReportsServiceTransport]] -_transport_registry['grpc'] = CloudChannelReportsServiceGrpcTransport -_transport_registry['grpc_asyncio'] = CloudChannelReportsServiceGrpcAsyncIOTransport +_transport_registry = ( + OrderedDict() +) # type: Dict[str, Type[CloudChannelReportsServiceTransport]] +_transport_registry["grpc"] = CloudChannelReportsServiceGrpcTransport +_transport_registry["grpc_asyncio"] = CloudChannelReportsServiceGrpcAsyncIOTransport __all__ = ( - 'CloudChannelReportsServiceTransport', - 'CloudChannelReportsServiceGrpcTransport', - 'CloudChannelReportsServiceGrpcAsyncIOTransport', + "CloudChannelReportsServiceTransport", + "CloudChannelReportsServiceGrpcTransport", + "CloudChannelReportsServiceGrpcAsyncIOTransport", ) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py b/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py similarity index 66% rename from owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py rename to google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py index e4fa2bb..9089d44 100644 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py +++ b/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/base.py @@ -15,25 +15,23 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore +from google.longrunning import operations_pb2 # type: ignore +from google.oauth2 import service_account # type: ignore +import pkg_resources from google.cloud.channel_v1.types import reports_service -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( - 'google-cloud-channel', + "google-cloud-channel", ).version, ) except pkg_resources.DistributionNotFound: @@ -43,23 +41,23 @@ class CloudChannelReportsServiceTransport(abc.ABC): """Abstract transport class for CloudChannelReportsService.""" - AUTH_SCOPES = ( - 'https://www.googleapis.com/auth/apps.reports.usage.readonly', - ) + AUTH_SCOPES = ("https://www.googleapis.com/auth/apps.reports.usage.readonly",) + + DEFAULT_HOST: str = "cloudchannel.googleapis.com" - DEFAULT_HOST: str = 'cloudchannel.googleapis.com' def __init__( - self, *, - host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: + self, + *, + host: str = DEFAULT_HOST, + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + **kwargs, + ) -> None: """Instantiate the transport. Args: @@ -93,30 +91,38 @@ def __init__( # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") + raise core_exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) if credentials_file is not None: credentials, _ = google.auth.load_credentials_from_file( - credentials_file, - **scopes_kwargs, - quota_project_id=quota_project_id - ) + credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + ) elif credentials is None: - credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) + credentials, _ = google.auth.default( + **scopes_kwargs, quota_project_id=quota_project_id + ) # Don't apply audience if the credentials file passed from user. if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience(api_audience if api_audience else host) + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. - if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): credentials = credentials.with_always_use_jwt_access(True) # Save the credentials. self._credentials = credentials # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ':' not in host: - host += ':443' + if ":" not in host: + host += ":443" self._host = host def _prep_wrapped_messages(self, client_info): @@ -137,14 +143,14 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), - } + } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -154,30 +160,36 @@ def operations_client(self): raise NotImplementedError() @property - def run_report_job(self) -> Callable[ - [reports_service.RunReportJobRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: + def run_report_job( + self, + ) -> Callable[ + [reports_service.RunReportJobRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: raise NotImplementedError() @property - def fetch_report_results(self) -> Callable[ - [reports_service.FetchReportResultsRequest], - Union[ - reports_service.FetchReportResultsResponse, - Awaitable[reports_service.FetchReportResultsResponse] - ]]: + def fetch_report_results( + self, + ) -> Callable[ + [reports_service.FetchReportResultsRequest], + Union[ + reports_service.FetchReportResultsResponse, + Awaitable[reports_service.FetchReportResultsResponse], + ], + ]: raise NotImplementedError() @property - def list_reports(self) -> Callable[ - [reports_service.ListReportsRequest], - Union[ - reports_service.ListReportsResponse, - Awaitable[reports_service.ListReportsResponse] - ]]: + def list_reports( + self, + ) -> Callable[ + [reports_service.ListReportsRequest], + Union[ + reports_service.ListReportsResponse, + Awaitable[reports_service.ListReportsResponse], + ], + ]: raise NotImplementedError() @property @@ -185,7 +197,10 @@ def list_operations( self, ) -> Callable[ [operations_pb2.ListOperationsRequest], - Union[operations_pb2.ListOperationsResponse, Awaitable[operations_pb2.ListOperationsResponse]], + Union[ + operations_pb2.ListOperationsResponse, + Awaitable[operations_pb2.ListOperationsResponse], + ], ]: raise NotImplementedError() @@ -201,19 +216,13 @@ def get_operation( @property def cancel_operation( self, - ) -> Callable[ - [operations_pb2.CancelOperationRequest], - None, - ]: + ) -> Callable[[operations_pb2.CancelOperationRequest], None,]: raise NotImplementedError() @property def delete_operation( self, - ) -> Callable[ - [operations_pb2.DeleteOperationRequest], - None, - ]: + ) -> Callable[[operations_pb2.DeleteOperationRequest], None,]: raise NotImplementedError() @property @@ -221,6 +230,4 @@ def kind(self) -> str: raise NotImplementedError() -__all__ = ( - 'CloudChannelReportsServiceTransport', -) +__all__ = ("CloudChannelReportsServiceTransport",) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py b/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py similarity index 85% rename from owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py rename to google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py index 4de3981..3e8a73d 100644 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py +++ b/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc.py @@ -13,22 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 -import google.auth # type: ignore +from google.api_core import gapic_v1, grpc_helpers, operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from google.cloud.channel_v1.types import reports_service -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore -from .base import CloudChannelReportsServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, CloudChannelReportsServiceTransport class CloudChannelReportsServiceGrpcTransport(CloudChannelReportsServiceTransport): @@ -46,23 +43,26 @@ class CloudChannelReportsServiceGrpcTransport(CloudChannelReportsServiceTranspor It sends protocol buffers over the wire using gRPC (which is built on top of HTTP/2); the ``grpcio`` package must be installed. """ + _stubs: Dict[str, Callable] - def __init__(self, *, - host: str = 'cloudchannel.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: + def __init__( + self, + *, + host: str = "cloudchannel.googleapis.com", + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: """Instantiate the transport. Args: @@ -182,13 +182,15 @@ def __init__(self, *, self._prep_wrapped_messages(client_info) @classmethod - def create_channel(cls, - host: str = 'cloudchannel.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> grpc.Channel: + def create_channel( + cls, + host: str = "cloudchannel.googleapis.com", + credentials: ga_credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> grpc.Channel: """Create and return a gRPC channel object. Args: host (Optional[str]): The host for the channel to use. @@ -223,13 +225,12 @@ def create_channel(cls, default_scopes=cls.AUTH_SCOPES, scopes=scopes, default_host=cls.DEFAULT_HOST, - **kwargs + **kwargs, ) @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -241,17 +242,15 @@ def operations_client(self) -> operations_v1.OperationsClient: """ # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient( - self.grpc_channel - ) + self._operations_client = operations_v1.OperationsClient(self.grpc_channel) # Return the client from cache. return self._operations_client @property - def run_report_job(self) -> Callable[ - [reports_service.RunReportJobRequest], - operations_pb2.Operation]: + def run_report_job( + self, + ) -> Callable[[reports_service.RunReportJobRequest], operations_pb2.Operation]: r"""Return a callable for the run report job method over gRPC. Begins generation of data for a given report. The report @@ -291,18 +290,21 @@ def run_report_job(self) -> Callable[ # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if 'run_report_job' not in self._stubs: - self._stubs['run_report_job'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelReportsService/RunReportJob', + if "run_report_job" not in self._stubs: + self._stubs["run_report_job"] = self.grpc_channel.unary_unary( + "/google.cloud.channel.v1.CloudChannelReportsService/RunReportJob", request_serializer=reports_service.RunReportJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) - return self._stubs['run_report_job'] + return self._stubs["run_report_job"] @property - def fetch_report_results(self) -> Callable[ - [reports_service.FetchReportResultsRequest], - reports_service.FetchReportResultsResponse]: + def fetch_report_results( + self, + ) -> Callable[ + [reports_service.FetchReportResultsRequest], + reports_service.FetchReportResultsResponse, + ]: r"""Return a callable for the fetch report results method over gRPC. Retrieves data generated by @@ -318,18 +320,20 @@ def fetch_report_results(self) -> Callable[ # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if 'fetch_report_results' not in self._stubs: - self._stubs['fetch_report_results'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelReportsService/FetchReportResults', + if "fetch_report_results" not in self._stubs: + self._stubs["fetch_report_results"] = self.grpc_channel.unary_unary( + "/google.cloud.channel.v1.CloudChannelReportsService/FetchReportResults", request_serializer=reports_service.FetchReportResultsRequest.serialize, response_deserializer=reports_service.FetchReportResultsResponse.deserialize, ) - return self._stubs['fetch_report_results'] + return self._stubs["fetch_report_results"] @property - def list_reports(self) -> Callable[ - [reports_service.ListReportsRequest], - reports_service.ListReportsResponse]: + def list_reports( + self, + ) -> Callable[ + [reports_service.ListReportsRequest], reports_service.ListReportsResponse + ]: r"""Return a callable for the list reports method over gRPC. Lists the reports that RunReportJob can run. These @@ -346,13 +350,13 @@ def list_reports(self) -> Callable[ # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if 'list_reports' not in self._stubs: - self._stubs['list_reports'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelReportsService/ListReports', + if "list_reports" not in self._stubs: + self._stubs["list_reports"] = self.grpc_channel.unary_unary( + "/google.cloud.channel.v1.CloudChannelReportsService/ListReports", request_serializer=reports_service.ListReportsRequest.serialize, response_deserializer=reports_service.ListReportsResponse.deserialize, ) - return self._stubs['list_reports'] + return self._stubs["list_reports"] def close(self): self.grpc_channel.close() @@ -361,8 +365,7 @@ def close(self): def delete_operation( self, ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: - r"""Return a callable for the delete_operation method over gRPC. - """ + r"""Return a callable for the delete_operation method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need @@ -379,8 +382,7 @@ def delete_operation( def cancel_operation( self, ) -> Callable[[operations_pb2.CancelOperationRequest], None]: - r"""Return a callable for the cancel_operation method over gRPC. - """ + r"""Return a callable for the cancel_operation method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need @@ -397,8 +399,7 @@ def cancel_operation( def get_operation( self, ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: - r"""Return a callable for the get_operation method over gRPC. - """ + r"""Return a callable for the get_operation method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need @@ -414,9 +415,10 @@ def get_operation( @property def list_operations( self, - ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: - r"""Return a callable for the list_operations method over gRPC. - """ + ) -> Callable[ + [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse + ]: + r"""Return a callable for the list_operations method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need @@ -434,6 +436,4 @@ def kind(self) -> str: return "grpc" -__all__ = ( - 'CloudChannelReportsServiceGrpcTransport', -) +__all__ = ("CloudChannelReportsServiceGrpcTransport",) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py b/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py similarity index 84% rename from owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py rename to google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py index 1ea5db0..215ea78 100644 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py +++ b/google/cloud/channel_v1/services/cloud_channel_reports_service/transports/grpc_asyncio.py @@ -13,26 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore +from google.longrunning import operations_pb2 # type: ignore +import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.channel_v1.types import reports_service -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore -from .base import CloudChannelReportsServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, CloudChannelReportsServiceTransport from .grpc import CloudChannelReportsServiceGrpcTransport -class CloudChannelReportsServiceGrpcAsyncIOTransport(CloudChannelReportsServiceTransport): +class CloudChannelReportsServiceGrpcAsyncIOTransport( + CloudChannelReportsServiceTransport +): """gRPC AsyncIO backend transport for CloudChannelReportsService. CloudChannelReportsService lets Google Cloud resellers and @@ -52,13 +51,15 @@ class CloudChannelReportsServiceGrpcAsyncIOTransport(CloudChannelReportsServiceT _stubs: Dict[str, Callable] = {} @classmethod - def create_channel(cls, - host: str = 'cloudchannel.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> aio.Channel: + def create_channel( + cls, + host: str = "cloudchannel.googleapis.com", + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: host (Optional[str]): The host for the channel to use. @@ -89,24 +90,26 @@ def create_channel(cls, default_scopes=cls.AUTH_SCOPES, scopes=scopes, default_host=cls.DEFAULT_HOST, - **kwargs + **kwargs, ) - def __init__(self, *, - host: str = 'cloudchannel.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: + def __init__( + self, + *, + host: str = "cloudchannel.googleapis.com", + credentials: ga_credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: """Instantiate the transport. Args: @@ -252,9 +255,11 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: return self._operations_client @property - def run_report_job(self) -> Callable[ - [reports_service.RunReportJobRequest], - Awaitable[operations_pb2.Operation]]: + def run_report_job( + self, + ) -> Callable[ + [reports_service.RunReportJobRequest], Awaitable[operations_pb2.Operation] + ]: r"""Return a callable for the run report job method over gRPC. Begins generation of data for a given report. The report @@ -294,18 +299,21 @@ def run_report_job(self) -> Callable[ # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if 'run_report_job' not in self._stubs: - self._stubs['run_report_job'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelReportsService/RunReportJob', + if "run_report_job" not in self._stubs: + self._stubs["run_report_job"] = self.grpc_channel.unary_unary( + "/google.cloud.channel.v1.CloudChannelReportsService/RunReportJob", request_serializer=reports_service.RunReportJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) - return self._stubs['run_report_job'] + return self._stubs["run_report_job"] @property - def fetch_report_results(self) -> Callable[ - [reports_service.FetchReportResultsRequest], - Awaitable[reports_service.FetchReportResultsResponse]]: + def fetch_report_results( + self, + ) -> Callable[ + [reports_service.FetchReportResultsRequest], + Awaitable[reports_service.FetchReportResultsResponse], + ]: r"""Return a callable for the fetch report results method over gRPC. Retrieves data generated by @@ -321,18 +329,21 @@ def fetch_report_results(self) -> Callable[ # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if 'fetch_report_results' not in self._stubs: - self._stubs['fetch_report_results'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelReportsService/FetchReportResults', + if "fetch_report_results" not in self._stubs: + self._stubs["fetch_report_results"] = self.grpc_channel.unary_unary( + "/google.cloud.channel.v1.CloudChannelReportsService/FetchReportResults", request_serializer=reports_service.FetchReportResultsRequest.serialize, response_deserializer=reports_service.FetchReportResultsResponse.deserialize, ) - return self._stubs['fetch_report_results'] + return self._stubs["fetch_report_results"] @property - def list_reports(self) -> Callable[ - [reports_service.ListReportsRequest], - Awaitable[reports_service.ListReportsResponse]]: + def list_reports( + self, + ) -> Callable[ + [reports_service.ListReportsRequest], + Awaitable[reports_service.ListReportsResponse], + ]: r"""Return a callable for the list reports method over gRPC. Lists the reports that RunReportJob can run. These @@ -349,13 +360,13 @@ def list_reports(self) -> Callable[ # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if 'list_reports' not in self._stubs: - self._stubs['list_reports'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelReportsService/ListReports', + if "list_reports" not in self._stubs: + self._stubs["list_reports"] = self.grpc_channel.unary_unary( + "/google.cloud.channel.v1.CloudChannelReportsService/ListReports", request_serializer=reports_service.ListReportsRequest.serialize, response_deserializer=reports_service.ListReportsResponse.deserialize, ) - return self._stubs['list_reports'] + return self._stubs["list_reports"] def close(self): return self.grpc_channel.close() @@ -364,8 +375,7 @@ def close(self): def delete_operation( self, ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: - r"""Return a callable for the delete_operation method over gRPC. - """ + r"""Return a callable for the delete_operation method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need @@ -382,8 +392,7 @@ def delete_operation( def cancel_operation( self, ) -> Callable[[operations_pb2.CancelOperationRequest], None]: - r"""Return a callable for the cancel_operation method over gRPC. - """ + r"""Return a callable for the cancel_operation method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need @@ -400,8 +409,7 @@ def cancel_operation( def get_operation( self, ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: - r"""Return a callable for the get_operation method over gRPC. - """ + r"""Return a callable for the get_operation method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need @@ -417,9 +425,10 @@ def get_operation( @property def list_operations( self, - ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: - r"""Return a callable for the list_operations method over gRPC. - """ + ) -> Callable[ + [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse + ]: + r"""Return a callable for the list_operations method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need @@ -433,6 +442,4 @@ def list_operations( return self._stubs["list_operations"] -__all__ = ( - 'CloudChannelReportsServiceGrpcAsyncIOTransport', -) +__all__ = ("CloudChannelReportsServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/channel_v1/services/cloud_channel_service/async_client.py b/google/cloud/channel_v1/services/cloud_channel_service/async_client.py index 9ecfbbb..3a72240 100644 --- a/google/cloud/channel_v1/services/cloud_channel_service/async_client.py +++ b/google/cloud/channel_v1/services/cloud_channel_service/async_client.py @@ -1348,7 +1348,8 @@ async def list_transferable_offers( - The customer doesn't belong to the reseller and has no auth token. - - The supplied auth token is invalid. + - The customer provided incorrect reseller information when + generating auth token. - The reseller account making the request is different from the reseller account in the query. diff --git a/google/cloud/channel_v1/services/cloud_channel_service/client.py b/google/cloud/channel_v1/services/cloud_channel_service/client.py index 9022bc4..ad0a59c 100644 --- a/google/cloud/channel_v1/services/cloud_channel_service/client.py +++ b/google/cloud/channel_v1/services/cloud_channel_service/client.py @@ -1686,7 +1686,8 @@ def list_transferable_offers( - The customer doesn't belong to the reseller and has no auth token. - - The supplied auth token is invalid. + - The customer provided incorrect reseller information when + generating auth token. - The reseller account making the request is different from the reseller account in the query. diff --git a/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py b/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py index b2f42c7..0f7126f 100644 --- a/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py +++ b/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py @@ -716,7 +716,8 @@ def list_transferable_offers( - The customer doesn't belong to the reseller and has no auth token. - - The supplied auth token is invalid. + - The customer provided incorrect reseller information when + generating auth token. - The reseller account making the request is different from the reseller account in the query. diff --git a/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py b/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py index 1655b69..503aedd 100644 --- a/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py +++ b/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py @@ -729,7 +729,8 @@ def list_transferable_offers( - The customer doesn't belong to the reseller and has no auth token. - - The supplied auth token is invalid. + - The customer provided incorrect reseller information when + generating auth token. - The reseller account making the request is different from the reseller account in the query. diff --git a/google/cloud/channel_v1/types/__init__.py b/google/cloud/channel_v1/types/__init__.py index bdaddfc..3dc7529 100644 --- a/google/cloud/channel_v1/types/__init__.py +++ b/google/cloud/channel_v1/types/__init__.py @@ -50,6 +50,22 @@ ) from .operations import OperationMetadata from .products import MarketingInfo, Media, MediaType, Product, Sku +from .reports_service import ( + Column, + DateRange, + FetchReportResultsRequest, + FetchReportResultsResponse, + ListReportsRequest, + ListReportsResponse, + Report, + ReportJob, + ReportResultsMetadata, + ReportStatus, + ReportValue, + Row, + RunReportJobRequest, + RunReportJobResponse, +) from .repricing import ( ChannelPartnerRepricingConfig, CustomerRepricingConfig, @@ -168,6 +184,20 @@ "Product", "Sku", "MediaType", + "Column", + "DateRange", + "FetchReportResultsRequest", + "FetchReportResultsResponse", + "ListReportsRequest", + "ListReportsResponse", + "Report", + "ReportJob", + "ReportResultsMetadata", + "ReportStatus", + "ReportValue", + "Row", + "RunReportJobRequest", + "RunReportJobResponse", "ChannelPartnerRepricingConfig", "CustomerRepricingConfig", "PercentageAdjustment", diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/reports_service.py b/google/cloud/channel_v1/types/reports_service.py similarity index 95% rename from owl-bot-staging/v1/google/cloud/channel_v1/types/reports_service.py rename to google/cloud/channel_v1/types/reports_service.py index f1c4116..9ecaaa2 100644 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/reports_service.py +++ b/google/cloud/channel_v1/types/reports_service.py @@ -13,32 +13,30 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import timestamp_pb2 # type: ignore from google.type import date_pb2 # type: ignore from google.type import datetime_pb2 # type: ignore from google.type import decimal_pb2 # type: ignore from google.type import money_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( - package='google.cloud.channel.v1', + package="google.cloud.channel.v1", manifest={ - 'RunReportJobRequest', - 'RunReportJobResponse', - 'FetchReportResultsRequest', - 'FetchReportResultsResponse', - 'ListReportsRequest', - 'ListReportsResponse', - 'ReportJob', - 'ReportResultsMetadata', - 'Column', - 'DateRange', - 'Row', - 'ReportValue', - 'ReportStatus', - 'Report', + "RunReportJobRequest", + "RunReportJobResponse", + "FetchReportResultsRequest", + "FetchReportResultsResponse", + "ListReportsRequest", + "ListReportsResponse", + "ReportJob", + "ReportResultsMetadata", + "Column", + "DateRange", + "Row", + "ReportValue", + "ReportStatus", + "Report", }, ) @@ -81,7 +79,7 @@ class RunReportJobRequest(proto.Message): date_range = proto.Field( proto.MESSAGE, number=2, - message='DateRange', + message="DateRange", ) filter = proto.Field( proto.STRING, @@ -112,12 +110,12 @@ class RunReportJobResponse(proto.Message): report_job = proto.Field( proto.MESSAGE, number=1, - message='ReportJob', + message="ReportJob", ) report_metadata = proto.Field( proto.MESSAGE, number=2, - message='ReportResultsMetadata', + message="ReportResultsMetadata", ) @@ -188,12 +186,12 @@ def raw_page(self): report_metadata = proto.Field( proto.MESSAGE, number=1, - message='ReportResultsMetadata', + message="ReportResultsMetadata", ) rows = proto.RepeatedField( proto.MESSAGE, number=2, - message='Row', + message="Row", ) next_page_token = proto.Field( proto.STRING, @@ -268,7 +266,7 @@ def raw_page(self): reports = proto.RepeatedField( proto.MESSAGE, number=1, - message='Report', + message="Report", ) next_page_token = proto.Field( proto.STRING, @@ -297,7 +295,7 @@ class ReportJob(proto.Message): report_status = proto.Field( proto.MESSAGE, number=2, - message='ReportStatus', + message="ReportStatus", ) @@ -327,7 +325,7 @@ class ReportResultsMetadata(proto.Message): report = proto.Field( proto.MESSAGE, number=1, - message='Report', + message="Report", ) row_count = proto.Field( proto.INT64, @@ -336,12 +334,12 @@ class ReportResultsMetadata(proto.Message): date_range = proto.Field( proto.MESSAGE, number=3, - message='DateRange', + message="DateRange", ) preceding_date_range = proto.Field( proto.MESSAGE, number=4, - message='DateRange', + message="DateRange", ) @@ -361,6 +359,7 @@ class Column(proto.Message): data_type (google.cloud.channel_v1.types.Column.DataType): The type of the values for this column. """ + class DataType(proto.Enum): r"""Available data types for columns. Corresponds to the fields in the ReportValue ``oneof`` field. @@ -455,7 +454,7 @@ class Row(proto.Message): values = proto.RepeatedField( proto.MESSAGE, number=1, - message='ReportValue', + message="ReportValue", ) @@ -502,35 +501,35 @@ class ReportValue(proto.Message): string_value = proto.Field( proto.STRING, number=1, - oneof='value', + oneof="value", ) int_value = proto.Field( proto.INT64, number=2, - oneof='value', + oneof="value", ) decimal_value = proto.Field( proto.MESSAGE, number=3, - oneof='value', + oneof="value", message=decimal_pb2.Decimal, ) money_value = proto.Field( proto.MESSAGE, number=4, - oneof='value', + oneof="value", message=money_pb2.Money, ) date_value = proto.Field( proto.MESSAGE, number=5, - oneof='value', + oneof="value", message=date_pb2.Date, ) date_time_value = proto.Field( proto.MESSAGE, number=6, - oneof='value', + oneof="value", message=datetime_pb2.DateTime, ) @@ -547,6 +546,7 @@ class ReportStatus(proto.Message): end_time (google.protobuf.timestamp_pb2.Timestamp): The report generation's completion time. """ + class State(proto.Enum): r"""Available states of report generation.""" STATE_UNSPECIFIED = 0 @@ -606,7 +606,7 @@ class Report(proto.Message): columns = proto.RepeatedField( proto.MESSAGE, number=3, - message='Column', + message="Column", ) description = proto.Field( proto.STRING, diff --git a/google/cloud/channel_v1/types/service.py b/google/cloud/channel_v1/types/service.py index 2230786..fd0bdc0 100644 --- a/google/cloud/channel_v1/types/service.py +++ b/google/cloud/channel_v1/types/service.py @@ -558,11 +558,11 @@ class ListTransferableSkusRequest(proto.Message): [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus] call. Optional. auth_token (str): - The super admin of the resold customer - generates this token to authorize a reseller to - access their Cloud Identity and purchase - entitlements on their behalf. You can omit this - token after authorization. See + Optional. The super admin of the resold + customer generates this token to authorize a + reseller to access their Cloud Identity and + purchase entitlements on their behalf. You can + omit this token after authorization. See https://support.google.com/a/answer/7643790 for more details. language_code (str): @@ -673,10 +673,10 @@ class ListTransferableOffersRequest(proto.Message): sku (str): Required. The SKU to look up Offers for. language_code (str): - The BCP-47 language code. For example, - "en-US". The response will localize in the - corresponding language code, if specified. The - default value is "en-US". + Optional. The BCP-47 language code. For + example, "en-US". The response will localize in + the corresponding language code, if specified. + The default value is "en-US". """ cloud_identity_id = proto.Field( diff --git a/owl-bot-staging/v1/.coveragerc b/owl-bot-staging/v1/.coveragerc deleted file mode 100644 index 44d34f9..0000000 --- a/owl-bot-staging/v1/.coveragerc +++ /dev/null @@ -1,17 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/channel/__init__.py -exclude_lines = - # Re-enable the standard pragma - pragma: NO COVER - # Ignore debug-only repr - def __repr__ - # Ignore pkg_resources exceptions. - # This is added at the module level as a safeguard for if someone - # generates the code and tries to run it without pip installing. This - # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound diff --git a/owl-bot-staging/v1/.flake8 b/owl-bot-staging/v1/.flake8 deleted file mode 100644 index 29227d4..0000000 --- a/owl-bot-staging/v1/.flake8 +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Generated by synthtool. DO NOT EDIT! -[flake8] -ignore = E203, E266, E501, W503 -exclude = - # Exclude generated code. - **/proto/** - **/gapic/** - **/services/** - **/types/** - *_pb2.py - - # Standard linting exemptions. - **/.nox/** - __pycache__, - .git, - *.pyc, - conf.py diff --git a/owl-bot-staging/v1/MANIFEST.in b/owl-bot-staging/v1/MANIFEST.in deleted file mode 100644 index 299d625..0000000 --- a/owl-bot-staging/v1/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include google/cloud/channel *.py -recursive-include google/cloud/channel_v1 *.py diff --git a/owl-bot-staging/v1/README.rst b/owl-bot-staging/v1/README.rst deleted file mode 100644 index 1b0de78..0000000 --- a/owl-bot-staging/v1/README.rst +++ /dev/null @@ -1,49 +0,0 @@ -Python Client for Google Cloud Channel API -================================================= - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. Enable the Google Cloud Channel API. -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - python3 -m venv - source /bin/activate - /bin/pip install /path/to/library - - -Windows -^^^^^^^ - -.. code-block:: console - - python3 -m venv - \Scripts\activate - \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1/docs/channel_v1/cloud_channel_service.rst b/owl-bot-staging/v1/docs/channel_v1/cloud_channel_service.rst deleted file mode 100644 index 917d45e..0000000 --- a/owl-bot-staging/v1/docs/channel_v1/cloud_channel_service.rst +++ /dev/null @@ -1,10 +0,0 @@ -CloudChannelService -------------------------------------- - -.. automodule:: google.cloud.channel_v1.services.cloud_channel_service - :members: - :inherited-members: - -.. automodule:: google.cloud.channel_v1.services.cloud_channel_service.pagers - :members: - :inherited-members: diff --git a/owl-bot-staging/v1/docs/channel_v1/services.rst b/owl-bot-staging/v1/docs/channel_v1/services.rst deleted file mode 100644 index a310f7a..0000000 --- a/owl-bot-staging/v1/docs/channel_v1/services.rst +++ /dev/null @@ -1,7 +0,0 @@ -Services for Google Cloud Channel v1 API -======================================== -.. toctree:: - :maxdepth: 2 - - cloud_channel_reports_service - cloud_channel_service diff --git a/owl-bot-staging/v1/docs/channel_v1/types.rst b/owl-bot-staging/v1/docs/channel_v1/types.rst deleted file mode 100644 index 1c173ec..0000000 --- a/owl-bot-staging/v1/docs/channel_v1/types.rst +++ /dev/null @@ -1,7 +0,0 @@ -Types for Google Cloud Channel v1 API -===================================== - -.. automodule:: google.cloud.channel_v1.types - :members: - :undoc-members: - :show-inheritance: diff --git a/owl-bot-staging/v1/docs/conf.py b/owl-bot-staging/v1/docs/conf.py deleted file mode 100644 index c9adba7..0000000 --- a/owl-bot-staging/v1/docs/conf.py +++ /dev/null @@ -1,376 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# google-cloud-channel documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os -import shlex - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath("..")) - -__version__ = "0.1.0" - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = "4.0.1" - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", -] - -# autodoc/autosummary flags -autoclass_content = "both" -autodoc_default_flags = ["members"] -autosummary_generate = True - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -source_suffix = [".rst", ".md"] - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The root toctree document. -root_doc = "index" - -# General information about the project. -project = u"google-cloud-channel" -copyright = u"2022, Google, LLC" -author = u"Google APIs" # TODO: autogenerate this bit - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The full version, including alpha/beta/rc tags. -release = __version__ -# The short X.Y version. -version = ".".join(release.split(".")[0:2]) - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ["_build"] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = { - "description": "Google Cloud Client Libraries for Python", - "github_user": "googleapis", - "github_repo": "google-cloud-python", - "github_banner": True, - "font_family": "'Roboto', Georgia, sans", - "head_font_family": "'Roboto', Georgia, serif", - "code_font_family": "'Roboto Mono', 'Consolas', monospace", -} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = "google-cloud-channel-doc" - -# -- Options for warnings ------------------------------------------------------ - - -suppress_warnings = [ - # Temporarily suppress this to avoid "more than one target found for - # cross-reference" warning, which are intractable for us to avoid while in - # a mono-repo. - # See https://github.com/sphinx-doc/sphinx/blob - # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 - "ref.python" -] - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', - # Latex figure (float) alignment - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - root_doc, - "google-cloud-channel.tex", - u"google-cloud-channel Documentation", - author, - "manual", - ) -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - root_doc, - "google-cloud-channel", - u"Google Cloud Channel Documentation", - [author], - 1, - ) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - root_doc, - "google-cloud-channel", - u"google-cloud-channel Documentation", - author, - "google-cloud-channel", - "GAPIC library for Google Cloud Channel API", - "APIs", - ) -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = { - "python": ("http://python.readthedocs.org/en/latest/", None), - "gax": ("https://gax-python.readthedocs.org/en/latest/", None), - "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), - "grpc": ("https://grpc.io/grpc/python/", None), - "requests": ("http://requests.kennethreitz.org/en/stable/", None), - "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), - "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), -} - - -# Napoleon settings -napoleon_google_docstring = True -napoleon_numpy_docstring = True -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = True -napoleon_use_rtype = True diff --git a/owl-bot-staging/v1/docs/index.rst b/owl-bot-staging/v1/docs/index.rst deleted file mode 100644 index d497c89..0000000 --- a/owl-bot-staging/v1/docs/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - channel_v1/services - channel_v1/types diff --git a/owl-bot-staging/v1/google/cloud/channel/__init__.py b/owl-bot-staging/v1/google/cloud/channel/__init__.py deleted file mode 100644 index d386528..0000000 --- a/owl-bot-staging/v1/google/cloud/channel/__init__.py +++ /dev/null @@ -1,283 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from google.cloud.channel_v1.services.cloud_channel_reports_service.client import CloudChannelReportsServiceClient -from google.cloud.channel_v1.services.cloud_channel_reports_service.async_client import CloudChannelReportsServiceAsyncClient -from google.cloud.channel_v1.services.cloud_channel_service.client import CloudChannelServiceClient -from google.cloud.channel_v1.services.cloud_channel_service.async_client import CloudChannelServiceAsyncClient - -from google.cloud.channel_v1.types.channel_partner_links import ChannelPartnerLink -from google.cloud.channel_v1.types.channel_partner_links import ChannelPartnerLinkState -from google.cloud.channel_v1.types.channel_partner_links import ChannelPartnerLinkView -from google.cloud.channel_v1.types.common import AdminUser -from google.cloud.channel_v1.types.common import CloudIdentityInfo -from google.cloud.channel_v1.types.common import EduData -from google.cloud.channel_v1.types.common import Value -from google.cloud.channel_v1.types.customers import ContactInfo -from google.cloud.channel_v1.types.customers import Customer -from google.cloud.channel_v1.types.entitlements import AssociationInfo -from google.cloud.channel_v1.types.entitlements import CommitmentSettings -from google.cloud.channel_v1.types.entitlements import Entitlement -from google.cloud.channel_v1.types.entitlements import Parameter -from google.cloud.channel_v1.types.entitlements import ProvisionedService -from google.cloud.channel_v1.types.entitlements import RenewalSettings -from google.cloud.channel_v1.types.entitlements import TransferableSku -from google.cloud.channel_v1.types.entitlements import TransferEligibility -from google.cloud.channel_v1.types.entitlements import TrialSettings -from google.cloud.channel_v1.types.offers import Constraints -from google.cloud.channel_v1.types.offers import CustomerConstraints -from google.cloud.channel_v1.types.offers import Offer -from google.cloud.channel_v1.types.offers import ParameterDefinition -from google.cloud.channel_v1.types.offers import Period -from google.cloud.channel_v1.types.offers import Plan -from google.cloud.channel_v1.types.offers import Price -from google.cloud.channel_v1.types.offers import PriceByResource -from google.cloud.channel_v1.types.offers import PricePhase -from google.cloud.channel_v1.types.offers import PriceTier -from google.cloud.channel_v1.types.offers import PaymentPlan -from google.cloud.channel_v1.types.offers import PaymentType -from google.cloud.channel_v1.types.offers import PeriodType -from google.cloud.channel_v1.types.offers import PromotionalOrderType -from google.cloud.channel_v1.types.offers import ResourceType -from google.cloud.channel_v1.types.operations import OperationMetadata -from google.cloud.channel_v1.types.products import MarketingInfo -from google.cloud.channel_v1.types.products import Media -from google.cloud.channel_v1.types.products import Product -from google.cloud.channel_v1.types.products import Sku -from google.cloud.channel_v1.types.products import MediaType -from google.cloud.channel_v1.types.reports_service import Column -from google.cloud.channel_v1.types.reports_service import DateRange -from google.cloud.channel_v1.types.reports_service import FetchReportResultsRequest -from google.cloud.channel_v1.types.reports_service import FetchReportResultsResponse -from google.cloud.channel_v1.types.reports_service import ListReportsRequest -from google.cloud.channel_v1.types.reports_service import ListReportsResponse -from google.cloud.channel_v1.types.reports_service import Report -from google.cloud.channel_v1.types.reports_service import ReportJob -from google.cloud.channel_v1.types.reports_service import ReportResultsMetadata -from google.cloud.channel_v1.types.reports_service import ReportStatus -from google.cloud.channel_v1.types.reports_service import ReportValue -from google.cloud.channel_v1.types.reports_service import Row -from google.cloud.channel_v1.types.reports_service import RunReportJobRequest -from google.cloud.channel_v1.types.reports_service import RunReportJobResponse -from google.cloud.channel_v1.types.repricing import ChannelPartnerRepricingConfig -from google.cloud.channel_v1.types.repricing import CustomerRepricingConfig -from google.cloud.channel_v1.types.repricing import PercentageAdjustment -from google.cloud.channel_v1.types.repricing import RepricingAdjustment -from google.cloud.channel_v1.types.repricing import RepricingConfig -from google.cloud.channel_v1.types.repricing import RebillingBasis -from google.cloud.channel_v1.types.service import ActivateEntitlementRequest -from google.cloud.channel_v1.types.service import CancelEntitlementRequest -from google.cloud.channel_v1.types.service import ChangeOfferRequest -from google.cloud.channel_v1.types.service import ChangeParametersRequest -from google.cloud.channel_v1.types.service import ChangeRenewalSettingsRequest -from google.cloud.channel_v1.types.service import CheckCloudIdentityAccountsExistRequest -from google.cloud.channel_v1.types.service import CheckCloudIdentityAccountsExistResponse -from google.cloud.channel_v1.types.service import CloudIdentityCustomerAccount -from google.cloud.channel_v1.types.service import CreateChannelPartnerLinkRequest -from google.cloud.channel_v1.types.service import CreateChannelPartnerRepricingConfigRequest -from google.cloud.channel_v1.types.service import CreateCustomerRepricingConfigRequest -from google.cloud.channel_v1.types.service import CreateCustomerRequest -from google.cloud.channel_v1.types.service import CreateEntitlementRequest -from google.cloud.channel_v1.types.service import DeleteChannelPartnerRepricingConfigRequest -from google.cloud.channel_v1.types.service import DeleteCustomerRepricingConfigRequest -from google.cloud.channel_v1.types.service import DeleteCustomerRequest -from google.cloud.channel_v1.types.service import GetChannelPartnerLinkRequest -from google.cloud.channel_v1.types.service import GetChannelPartnerRepricingConfigRequest -from google.cloud.channel_v1.types.service import GetCustomerRepricingConfigRequest -from google.cloud.channel_v1.types.service import GetCustomerRequest -from google.cloud.channel_v1.types.service import GetEntitlementRequest -from google.cloud.channel_v1.types.service import ImportCustomerRequest -from google.cloud.channel_v1.types.service import ListChannelPartnerLinksRequest -from google.cloud.channel_v1.types.service import ListChannelPartnerLinksResponse -from google.cloud.channel_v1.types.service import ListChannelPartnerRepricingConfigsRequest -from google.cloud.channel_v1.types.service import ListChannelPartnerRepricingConfigsResponse -from google.cloud.channel_v1.types.service import ListCustomerRepricingConfigsRequest -from google.cloud.channel_v1.types.service import ListCustomerRepricingConfigsResponse -from google.cloud.channel_v1.types.service import ListCustomersRequest -from google.cloud.channel_v1.types.service import ListCustomersResponse -from google.cloud.channel_v1.types.service import ListEntitlementsRequest -from google.cloud.channel_v1.types.service import ListEntitlementsResponse -from google.cloud.channel_v1.types.service import ListOffersRequest -from google.cloud.channel_v1.types.service import ListOffersResponse -from google.cloud.channel_v1.types.service import ListProductsRequest -from google.cloud.channel_v1.types.service import ListProductsResponse -from google.cloud.channel_v1.types.service import ListPurchasableOffersRequest -from google.cloud.channel_v1.types.service import ListPurchasableOffersResponse -from google.cloud.channel_v1.types.service import ListPurchasableSkusRequest -from google.cloud.channel_v1.types.service import ListPurchasableSkusResponse -from google.cloud.channel_v1.types.service import ListSkusRequest -from google.cloud.channel_v1.types.service import ListSkusResponse -from google.cloud.channel_v1.types.service import ListSubscribersRequest -from google.cloud.channel_v1.types.service import ListSubscribersResponse -from google.cloud.channel_v1.types.service import ListTransferableOffersRequest -from google.cloud.channel_v1.types.service import ListTransferableOffersResponse -from google.cloud.channel_v1.types.service import ListTransferableSkusRequest -from google.cloud.channel_v1.types.service import ListTransferableSkusResponse -from google.cloud.channel_v1.types.service import LookupOfferRequest -from google.cloud.channel_v1.types.service import ProvisionCloudIdentityRequest -from google.cloud.channel_v1.types.service import PurchasableOffer -from google.cloud.channel_v1.types.service import PurchasableSku -from google.cloud.channel_v1.types.service import RegisterSubscriberRequest -from google.cloud.channel_v1.types.service import RegisterSubscriberResponse -from google.cloud.channel_v1.types.service import StartPaidServiceRequest -from google.cloud.channel_v1.types.service import SuspendEntitlementRequest -from google.cloud.channel_v1.types.service import TransferableOffer -from google.cloud.channel_v1.types.service import TransferEntitlementsRequest -from google.cloud.channel_v1.types.service import TransferEntitlementsResponse -from google.cloud.channel_v1.types.service import TransferEntitlementsToGoogleRequest -from google.cloud.channel_v1.types.service import UnregisterSubscriberRequest -from google.cloud.channel_v1.types.service import UnregisterSubscriberResponse -from google.cloud.channel_v1.types.service import UpdateChannelPartnerLinkRequest -from google.cloud.channel_v1.types.service import UpdateChannelPartnerRepricingConfigRequest -from google.cloud.channel_v1.types.service import UpdateCustomerRepricingConfigRequest -from google.cloud.channel_v1.types.service import UpdateCustomerRequest -from google.cloud.channel_v1.types.subscriber_event import CustomerEvent -from google.cloud.channel_v1.types.subscriber_event import EntitlementEvent -from google.cloud.channel_v1.types.subscriber_event import SubscriberEvent - -__all__ = ('CloudChannelReportsServiceClient', - 'CloudChannelReportsServiceAsyncClient', - 'CloudChannelServiceClient', - 'CloudChannelServiceAsyncClient', - 'ChannelPartnerLink', - 'ChannelPartnerLinkState', - 'ChannelPartnerLinkView', - 'AdminUser', - 'CloudIdentityInfo', - 'EduData', - 'Value', - 'ContactInfo', - 'Customer', - 'AssociationInfo', - 'CommitmentSettings', - 'Entitlement', - 'Parameter', - 'ProvisionedService', - 'RenewalSettings', - 'TransferableSku', - 'TransferEligibility', - 'TrialSettings', - 'Constraints', - 'CustomerConstraints', - 'Offer', - 'ParameterDefinition', - 'Period', - 'Plan', - 'Price', - 'PriceByResource', - 'PricePhase', - 'PriceTier', - 'PaymentPlan', - 'PaymentType', - 'PeriodType', - 'PromotionalOrderType', - 'ResourceType', - 'OperationMetadata', - 'MarketingInfo', - 'Media', - 'Product', - 'Sku', - 'MediaType', - 'Column', - 'DateRange', - 'FetchReportResultsRequest', - 'FetchReportResultsResponse', - 'ListReportsRequest', - 'ListReportsResponse', - 'Report', - 'ReportJob', - 'ReportResultsMetadata', - 'ReportStatus', - 'ReportValue', - 'Row', - 'RunReportJobRequest', - 'RunReportJobResponse', - 'ChannelPartnerRepricingConfig', - 'CustomerRepricingConfig', - 'PercentageAdjustment', - 'RepricingAdjustment', - 'RepricingConfig', - 'RebillingBasis', - 'ActivateEntitlementRequest', - 'CancelEntitlementRequest', - 'ChangeOfferRequest', - 'ChangeParametersRequest', - 'ChangeRenewalSettingsRequest', - 'CheckCloudIdentityAccountsExistRequest', - 'CheckCloudIdentityAccountsExistResponse', - 'CloudIdentityCustomerAccount', - 'CreateChannelPartnerLinkRequest', - 'CreateChannelPartnerRepricingConfigRequest', - 'CreateCustomerRepricingConfigRequest', - 'CreateCustomerRequest', - 'CreateEntitlementRequest', - 'DeleteChannelPartnerRepricingConfigRequest', - 'DeleteCustomerRepricingConfigRequest', - 'DeleteCustomerRequest', - 'GetChannelPartnerLinkRequest', - 'GetChannelPartnerRepricingConfigRequest', - 'GetCustomerRepricingConfigRequest', - 'GetCustomerRequest', - 'GetEntitlementRequest', - 'ImportCustomerRequest', - 'ListChannelPartnerLinksRequest', - 'ListChannelPartnerLinksResponse', - 'ListChannelPartnerRepricingConfigsRequest', - 'ListChannelPartnerRepricingConfigsResponse', - 'ListCustomerRepricingConfigsRequest', - 'ListCustomerRepricingConfigsResponse', - 'ListCustomersRequest', - 'ListCustomersResponse', - 'ListEntitlementsRequest', - 'ListEntitlementsResponse', - 'ListOffersRequest', - 'ListOffersResponse', - 'ListProductsRequest', - 'ListProductsResponse', - 'ListPurchasableOffersRequest', - 'ListPurchasableOffersResponse', - 'ListPurchasableSkusRequest', - 'ListPurchasableSkusResponse', - 'ListSkusRequest', - 'ListSkusResponse', - 'ListSubscribersRequest', - 'ListSubscribersResponse', - 'ListTransferableOffersRequest', - 'ListTransferableOffersResponse', - 'ListTransferableSkusRequest', - 'ListTransferableSkusResponse', - 'LookupOfferRequest', - 'ProvisionCloudIdentityRequest', - 'PurchasableOffer', - 'PurchasableSku', - 'RegisterSubscriberRequest', - 'RegisterSubscriberResponse', - 'StartPaidServiceRequest', - 'SuspendEntitlementRequest', - 'TransferableOffer', - 'TransferEntitlementsRequest', - 'TransferEntitlementsResponse', - 'TransferEntitlementsToGoogleRequest', - 'UnregisterSubscriberRequest', - 'UnregisterSubscriberResponse', - 'UpdateChannelPartnerLinkRequest', - 'UpdateChannelPartnerRepricingConfigRequest', - 'UpdateCustomerRepricingConfigRequest', - 'UpdateCustomerRequest', - 'CustomerEvent', - 'EntitlementEvent', - 'SubscriberEvent', -) diff --git a/owl-bot-staging/v1/google/cloud/channel/py.typed b/owl-bot-staging/v1/google/cloud/channel/py.typed deleted file mode 100644 index 0915275..0000000 --- a/owl-bot-staging/v1/google/cloud/channel/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-channel package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/__init__.py deleted file mode 100644 index 9a670ba..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/__init__.py +++ /dev/null @@ -1,284 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from .services.cloud_channel_reports_service import CloudChannelReportsServiceClient -from .services.cloud_channel_reports_service import CloudChannelReportsServiceAsyncClient -from .services.cloud_channel_service import CloudChannelServiceClient -from .services.cloud_channel_service import CloudChannelServiceAsyncClient - -from .types.channel_partner_links import ChannelPartnerLink -from .types.channel_partner_links import ChannelPartnerLinkState -from .types.channel_partner_links import ChannelPartnerLinkView -from .types.common import AdminUser -from .types.common import CloudIdentityInfo -from .types.common import EduData -from .types.common import Value -from .types.customers import ContactInfo -from .types.customers import Customer -from .types.entitlements import AssociationInfo -from .types.entitlements import CommitmentSettings -from .types.entitlements import Entitlement -from .types.entitlements import Parameter -from .types.entitlements import ProvisionedService -from .types.entitlements import RenewalSettings -from .types.entitlements import TransferableSku -from .types.entitlements import TransferEligibility -from .types.entitlements import TrialSettings -from .types.offers import Constraints -from .types.offers import CustomerConstraints -from .types.offers import Offer -from .types.offers import ParameterDefinition -from .types.offers import Period -from .types.offers import Plan -from .types.offers import Price -from .types.offers import PriceByResource -from .types.offers import PricePhase -from .types.offers import PriceTier -from .types.offers import PaymentPlan -from .types.offers import PaymentType -from .types.offers import PeriodType -from .types.offers import PromotionalOrderType -from .types.offers import ResourceType -from .types.operations import OperationMetadata -from .types.products import MarketingInfo -from .types.products import Media -from .types.products import Product -from .types.products import Sku -from .types.products import MediaType -from .types.reports_service import Column -from .types.reports_service import DateRange -from .types.reports_service import FetchReportResultsRequest -from .types.reports_service import FetchReportResultsResponse -from .types.reports_service import ListReportsRequest -from .types.reports_service import ListReportsResponse -from .types.reports_service import Report -from .types.reports_service import ReportJob -from .types.reports_service import ReportResultsMetadata -from .types.reports_service import ReportStatus -from .types.reports_service import ReportValue -from .types.reports_service import Row -from .types.reports_service import RunReportJobRequest -from .types.reports_service import RunReportJobResponse -from .types.repricing import ChannelPartnerRepricingConfig -from .types.repricing import CustomerRepricingConfig -from .types.repricing import PercentageAdjustment -from .types.repricing import RepricingAdjustment -from .types.repricing import RepricingConfig -from .types.repricing import RebillingBasis -from .types.service import ActivateEntitlementRequest -from .types.service import CancelEntitlementRequest -from .types.service import ChangeOfferRequest -from .types.service import ChangeParametersRequest -from .types.service import ChangeRenewalSettingsRequest -from .types.service import CheckCloudIdentityAccountsExistRequest -from .types.service import CheckCloudIdentityAccountsExistResponse -from .types.service import CloudIdentityCustomerAccount -from .types.service import CreateChannelPartnerLinkRequest -from .types.service import CreateChannelPartnerRepricingConfigRequest -from .types.service import CreateCustomerRepricingConfigRequest -from .types.service import CreateCustomerRequest -from .types.service import CreateEntitlementRequest -from .types.service import DeleteChannelPartnerRepricingConfigRequest -from .types.service import DeleteCustomerRepricingConfigRequest -from .types.service import DeleteCustomerRequest -from .types.service import GetChannelPartnerLinkRequest -from .types.service import GetChannelPartnerRepricingConfigRequest -from .types.service import GetCustomerRepricingConfigRequest -from .types.service import GetCustomerRequest -from .types.service import GetEntitlementRequest -from .types.service import ImportCustomerRequest -from .types.service import ListChannelPartnerLinksRequest -from .types.service import ListChannelPartnerLinksResponse -from .types.service import ListChannelPartnerRepricingConfigsRequest -from .types.service import ListChannelPartnerRepricingConfigsResponse -from .types.service import ListCustomerRepricingConfigsRequest -from .types.service import ListCustomerRepricingConfigsResponse -from .types.service import ListCustomersRequest -from .types.service import ListCustomersResponse -from .types.service import ListEntitlementsRequest -from .types.service import ListEntitlementsResponse -from .types.service import ListOffersRequest -from .types.service import ListOffersResponse -from .types.service import ListProductsRequest -from .types.service import ListProductsResponse -from .types.service import ListPurchasableOffersRequest -from .types.service import ListPurchasableOffersResponse -from .types.service import ListPurchasableSkusRequest -from .types.service import ListPurchasableSkusResponse -from .types.service import ListSkusRequest -from .types.service import ListSkusResponse -from .types.service import ListSubscribersRequest -from .types.service import ListSubscribersResponse -from .types.service import ListTransferableOffersRequest -from .types.service import ListTransferableOffersResponse -from .types.service import ListTransferableSkusRequest -from .types.service import ListTransferableSkusResponse -from .types.service import LookupOfferRequest -from .types.service import ProvisionCloudIdentityRequest -from .types.service import PurchasableOffer -from .types.service import PurchasableSku -from .types.service import RegisterSubscriberRequest -from .types.service import RegisterSubscriberResponse -from .types.service import StartPaidServiceRequest -from .types.service import SuspendEntitlementRequest -from .types.service import TransferableOffer -from .types.service import TransferEntitlementsRequest -from .types.service import TransferEntitlementsResponse -from .types.service import TransferEntitlementsToGoogleRequest -from .types.service import UnregisterSubscriberRequest -from .types.service import UnregisterSubscriberResponse -from .types.service import UpdateChannelPartnerLinkRequest -from .types.service import UpdateChannelPartnerRepricingConfigRequest -from .types.service import UpdateCustomerRepricingConfigRequest -from .types.service import UpdateCustomerRequest -from .types.subscriber_event import CustomerEvent -from .types.subscriber_event import EntitlementEvent -from .types.subscriber_event import SubscriberEvent - -__all__ = ( - 'CloudChannelReportsServiceAsyncClient', - 'CloudChannelServiceAsyncClient', -'ActivateEntitlementRequest', -'AdminUser', -'AssociationInfo', -'CancelEntitlementRequest', -'ChangeOfferRequest', -'ChangeParametersRequest', -'ChangeRenewalSettingsRequest', -'ChannelPartnerLink', -'ChannelPartnerLinkState', -'ChannelPartnerLinkView', -'ChannelPartnerRepricingConfig', -'CheckCloudIdentityAccountsExistRequest', -'CheckCloudIdentityAccountsExistResponse', -'CloudChannelReportsServiceClient', -'CloudChannelServiceClient', -'CloudIdentityCustomerAccount', -'CloudIdentityInfo', -'Column', -'CommitmentSettings', -'Constraints', -'ContactInfo', -'CreateChannelPartnerLinkRequest', -'CreateChannelPartnerRepricingConfigRequest', -'CreateCustomerRepricingConfigRequest', -'CreateCustomerRequest', -'CreateEntitlementRequest', -'Customer', -'CustomerConstraints', -'CustomerEvent', -'CustomerRepricingConfig', -'DateRange', -'DeleteChannelPartnerRepricingConfigRequest', -'DeleteCustomerRepricingConfigRequest', -'DeleteCustomerRequest', -'EduData', -'Entitlement', -'EntitlementEvent', -'FetchReportResultsRequest', -'FetchReportResultsResponse', -'GetChannelPartnerLinkRequest', -'GetChannelPartnerRepricingConfigRequest', -'GetCustomerRepricingConfigRequest', -'GetCustomerRequest', -'GetEntitlementRequest', -'ImportCustomerRequest', -'ListChannelPartnerLinksRequest', -'ListChannelPartnerLinksResponse', -'ListChannelPartnerRepricingConfigsRequest', -'ListChannelPartnerRepricingConfigsResponse', -'ListCustomerRepricingConfigsRequest', -'ListCustomerRepricingConfigsResponse', -'ListCustomersRequest', -'ListCustomersResponse', -'ListEntitlementsRequest', -'ListEntitlementsResponse', -'ListOffersRequest', -'ListOffersResponse', -'ListProductsRequest', -'ListProductsResponse', -'ListPurchasableOffersRequest', -'ListPurchasableOffersResponse', -'ListPurchasableSkusRequest', -'ListPurchasableSkusResponse', -'ListReportsRequest', -'ListReportsResponse', -'ListSkusRequest', -'ListSkusResponse', -'ListSubscribersRequest', -'ListSubscribersResponse', -'ListTransferableOffersRequest', -'ListTransferableOffersResponse', -'ListTransferableSkusRequest', -'ListTransferableSkusResponse', -'LookupOfferRequest', -'MarketingInfo', -'Media', -'MediaType', -'Offer', -'OperationMetadata', -'Parameter', -'ParameterDefinition', -'PaymentPlan', -'PaymentType', -'PercentageAdjustment', -'Period', -'PeriodType', -'Plan', -'Price', -'PriceByResource', -'PricePhase', -'PriceTier', -'Product', -'PromotionalOrderType', -'ProvisionCloudIdentityRequest', -'ProvisionedService', -'PurchasableOffer', -'PurchasableSku', -'RebillingBasis', -'RegisterSubscriberRequest', -'RegisterSubscriberResponse', -'RenewalSettings', -'Report', -'ReportJob', -'ReportResultsMetadata', -'ReportStatus', -'ReportValue', -'RepricingAdjustment', -'RepricingConfig', -'ResourceType', -'Row', -'RunReportJobRequest', -'RunReportJobResponse', -'Sku', -'StartPaidServiceRequest', -'SubscriberEvent', -'SuspendEntitlementRequest', -'TransferEligibility', -'TransferEntitlementsRequest', -'TransferEntitlementsResponse', -'TransferEntitlementsToGoogleRequest', -'TransferableOffer', -'TransferableSku', -'TrialSettings', -'UnregisterSubscriberRequest', -'UnregisterSubscriberResponse', -'UpdateChannelPartnerLinkRequest', -'UpdateChannelPartnerRepricingConfigRequest', -'UpdateCustomerRepricingConfigRequest', -'UpdateCustomerRequest', -'Value', -) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/gapic_metadata.json b/owl-bot-staging/v1/google/cloud/channel_v1/gapic_metadata.json deleted file mode 100644 index aff1a2d..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/gapic_metadata.json +++ /dev/null @@ -1,517 +0,0 @@ - { - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "python", - "libraryPackage": "google.cloud.channel_v1", - "protoPackage": "google.cloud.channel.v1", - "schema": "1.0", - "services": { - "CloudChannelReportsService": { - "clients": { - "grpc": { - "libraryClient": "CloudChannelReportsServiceClient", - "rpcs": { - "FetchReportResults": { - "methods": [ - "fetch_report_results" - ] - }, - "ListReports": { - "methods": [ - "list_reports" - ] - }, - "RunReportJob": { - "methods": [ - "run_report_job" - ] - } - } - }, - "grpc-async": { - "libraryClient": "CloudChannelReportsServiceAsyncClient", - "rpcs": { - "FetchReportResults": { - "methods": [ - "fetch_report_results" - ] - }, - "ListReports": { - "methods": [ - "list_reports" - ] - }, - "RunReportJob": { - "methods": [ - "run_report_job" - ] - } - } - } - } - }, - "CloudChannelService": { - "clients": { - "grpc": { - "libraryClient": "CloudChannelServiceClient", - "rpcs": { - "ActivateEntitlement": { - "methods": [ - "activate_entitlement" - ] - }, - "CancelEntitlement": { - "methods": [ - "cancel_entitlement" - ] - }, - "ChangeOffer": { - "methods": [ - "change_offer" - ] - }, - "ChangeParameters": { - "methods": [ - "change_parameters" - ] - }, - "ChangeRenewalSettings": { - "methods": [ - "change_renewal_settings" - ] - }, - "CheckCloudIdentityAccountsExist": { - "methods": [ - "check_cloud_identity_accounts_exist" - ] - }, - "CreateChannelPartnerLink": { - "methods": [ - "create_channel_partner_link" - ] - }, - "CreateChannelPartnerRepricingConfig": { - "methods": [ - "create_channel_partner_repricing_config" - ] - }, - "CreateCustomer": { - "methods": [ - "create_customer" - ] - }, - "CreateCustomerRepricingConfig": { - "methods": [ - "create_customer_repricing_config" - ] - }, - "CreateEntitlement": { - "methods": [ - "create_entitlement" - ] - }, - "DeleteChannelPartnerRepricingConfig": { - "methods": [ - "delete_channel_partner_repricing_config" - ] - }, - "DeleteCustomer": { - "methods": [ - "delete_customer" - ] - }, - "DeleteCustomerRepricingConfig": { - "methods": [ - "delete_customer_repricing_config" - ] - }, - "GetChannelPartnerLink": { - "methods": [ - "get_channel_partner_link" - ] - }, - "GetChannelPartnerRepricingConfig": { - "methods": [ - "get_channel_partner_repricing_config" - ] - }, - "GetCustomer": { - "methods": [ - "get_customer" - ] - }, - "GetCustomerRepricingConfig": { - "methods": [ - "get_customer_repricing_config" - ] - }, - "GetEntitlement": { - "methods": [ - "get_entitlement" - ] - }, - "ImportCustomer": { - "methods": [ - "import_customer" - ] - }, - "ListChannelPartnerLinks": { - "methods": [ - "list_channel_partner_links" - ] - }, - "ListChannelPartnerRepricingConfigs": { - "methods": [ - "list_channel_partner_repricing_configs" - ] - }, - "ListCustomerRepricingConfigs": { - "methods": [ - "list_customer_repricing_configs" - ] - }, - "ListCustomers": { - "methods": [ - "list_customers" - ] - }, - "ListEntitlements": { - "methods": [ - "list_entitlements" - ] - }, - "ListOffers": { - "methods": [ - "list_offers" - ] - }, - "ListProducts": { - "methods": [ - "list_products" - ] - }, - "ListPurchasableOffers": { - "methods": [ - "list_purchasable_offers" - ] - }, - "ListPurchasableSkus": { - "methods": [ - "list_purchasable_skus" - ] - }, - "ListSkus": { - "methods": [ - "list_skus" - ] - }, - "ListSubscribers": { - "methods": [ - "list_subscribers" - ] - }, - "ListTransferableOffers": { - "methods": [ - "list_transferable_offers" - ] - }, - "ListTransferableSkus": { - "methods": [ - "list_transferable_skus" - ] - }, - "LookupOffer": { - "methods": [ - "lookup_offer" - ] - }, - "ProvisionCloudIdentity": { - "methods": [ - "provision_cloud_identity" - ] - }, - "RegisterSubscriber": { - "methods": [ - "register_subscriber" - ] - }, - "StartPaidService": { - "methods": [ - "start_paid_service" - ] - }, - "SuspendEntitlement": { - "methods": [ - "suspend_entitlement" - ] - }, - "TransferEntitlements": { - "methods": [ - "transfer_entitlements" - ] - }, - "TransferEntitlementsToGoogle": { - "methods": [ - "transfer_entitlements_to_google" - ] - }, - "UnregisterSubscriber": { - "methods": [ - "unregister_subscriber" - ] - }, - "UpdateChannelPartnerLink": { - "methods": [ - "update_channel_partner_link" - ] - }, - "UpdateChannelPartnerRepricingConfig": { - "methods": [ - "update_channel_partner_repricing_config" - ] - }, - "UpdateCustomer": { - "methods": [ - "update_customer" - ] - }, - "UpdateCustomerRepricingConfig": { - "methods": [ - "update_customer_repricing_config" - ] - } - } - }, - "grpc-async": { - "libraryClient": "CloudChannelServiceAsyncClient", - "rpcs": { - "ActivateEntitlement": { - "methods": [ - "activate_entitlement" - ] - }, - "CancelEntitlement": { - "methods": [ - "cancel_entitlement" - ] - }, - "ChangeOffer": { - "methods": [ - "change_offer" - ] - }, - "ChangeParameters": { - "methods": [ - "change_parameters" - ] - }, - "ChangeRenewalSettings": { - "methods": [ - "change_renewal_settings" - ] - }, - "CheckCloudIdentityAccountsExist": { - "methods": [ - "check_cloud_identity_accounts_exist" - ] - }, - "CreateChannelPartnerLink": { - "methods": [ - "create_channel_partner_link" - ] - }, - "CreateChannelPartnerRepricingConfig": { - "methods": [ - "create_channel_partner_repricing_config" - ] - }, - "CreateCustomer": { - "methods": [ - "create_customer" - ] - }, - "CreateCustomerRepricingConfig": { - "methods": [ - "create_customer_repricing_config" - ] - }, - "CreateEntitlement": { - "methods": [ - "create_entitlement" - ] - }, - "DeleteChannelPartnerRepricingConfig": { - "methods": [ - "delete_channel_partner_repricing_config" - ] - }, - "DeleteCustomer": { - "methods": [ - "delete_customer" - ] - }, - "DeleteCustomerRepricingConfig": { - "methods": [ - "delete_customer_repricing_config" - ] - }, - "GetChannelPartnerLink": { - "methods": [ - "get_channel_partner_link" - ] - }, - "GetChannelPartnerRepricingConfig": { - "methods": [ - "get_channel_partner_repricing_config" - ] - }, - "GetCustomer": { - "methods": [ - "get_customer" - ] - }, - "GetCustomerRepricingConfig": { - "methods": [ - "get_customer_repricing_config" - ] - }, - "GetEntitlement": { - "methods": [ - "get_entitlement" - ] - }, - "ImportCustomer": { - "methods": [ - "import_customer" - ] - }, - "ListChannelPartnerLinks": { - "methods": [ - "list_channel_partner_links" - ] - }, - "ListChannelPartnerRepricingConfigs": { - "methods": [ - "list_channel_partner_repricing_configs" - ] - }, - "ListCustomerRepricingConfigs": { - "methods": [ - "list_customer_repricing_configs" - ] - }, - "ListCustomers": { - "methods": [ - "list_customers" - ] - }, - "ListEntitlements": { - "methods": [ - "list_entitlements" - ] - }, - "ListOffers": { - "methods": [ - "list_offers" - ] - }, - "ListProducts": { - "methods": [ - "list_products" - ] - }, - "ListPurchasableOffers": { - "methods": [ - "list_purchasable_offers" - ] - }, - "ListPurchasableSkus": { - "methods": [ - "list_purchasable_skus" - ] - }, - "ListSkus": { - "methods": [ - "list_skus" - ] - }, - "ListSubscribers": { - "methods": [ - "list_subscribers" - ] - }, - "ListTransferableOffers": { - "methods": [ - "list_transferable_offers" - ] - }, - "ListTransferableSkus": { - "methods": [ - "list_transferable_skus" - ] - }, - "LookupOffer": { - "methods": [ - "lookup_offer" - ] - }, - "ProvisionCloudIdentity": { - "methods": [ - "provision_cloud_identity" - ] - }, - "RegisterSubscriber": { - "methods": [ - "register_subscriber" - ] - }, - "StartPaidService": { - "methods": [ - "start_paid_service" - ] - }, - "SuspendEntitlement": { - "methods": [ - "suspend_entitlement" - ] - }, - "TransferEntitlements": { - "methods": [ - "transfer_entitlements" - ] - }, - "TransferEntitlementsToGoogle": { - "methods": [ - "transfer_entitlements_to_google" - ] - }, - "UnregisterSubscriber": { - "methods": [ - "unregister_subscriber" - ] - }, - "UpdateChannelPartnerLink": { - "methods": [ - "update_channel_partner_link" - ] - }, - "UpdateChannelPartnerRepricingConfig": { - "methods": [ - "update_channel_partner_repricing_config" - ] - }, - "UpdateCustomer": { - "methods": [ - "update_customer" - ] - }, - "UpdateCustomerRepricingConfig": { - "methods": [ - "update_customer_repricing_config" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/py.typed b/owl-bot-staging/v1/google/cloud/channel_v1/py.typed deleted file mode 100644 index 0915275..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-channel package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/__init__.py deleted file mode 100644 index e8e1c38..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/__init__.py deleted file mode 100644 index 2266987..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .client import CloudChannelServiceClient -from .async_client import CloudChannelServiceAsyncClient - -__all__ = ( - 'CloudChannelServiceClient', - 'CloudChannelServiceAsyncClient', -) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/async_client.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/async_client.py deleted file mode 100644 index 7182e00..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/async_client.py +++ /dev/null @@ -1,5677 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import functools -import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources - -from google.api_core.client_options import ClientOptions -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.cloud.channel_v1.services.cloud_channel_service import pagers -from google.cloud.channel_v1.types import channel_partner_links -from google.cloud.channel_v1.types import common -from google.cloud.channel_v1.types import customers -from google.cloud.channel_v1.types import entitlements -from google.cloud.channel_v1.types import offers -from google.cloud.channel_v1.types import operations -from google.cloud.channel_v1.types import products -from google.cloud.channel_v1.types import repricing -from google.cloud.channel_v1.types import service -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from google.type import postal_address_pb2 # type: ignore -from .transports.base import CloudChannelServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import CloudChannelServiceGrpcAsyncIOTransport -from .client import CloudChannelServiceClient - - -class CloudChannelServiceAsyncClient: - """CloudChannelService lets Google cloud resellers and distributors - manage their customers, channel partners, entitlements, and reports. - - Using this service: - - 1. Resellers and distributors can manage a customer entity. - 2. Distributors can register an authorized reseller in their channel - and provide them with delegated admin access. - 3. Resellers and distributors can manage customer entitlements. - - CloudChannelService exposes the following resources: - - - [Customer][google.cloud.channel.v1.Customer]s: An entity—usually - an enterprise—managed by a reseller or distributor. - - - [Entitlement][google.cloud.channel.v1.Entitlement]s: An entity - that provides a customer with the means to use a service. - Entitlements are created or updated as a result of a successful - fulfillment. - - - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s: - An entity that identifies links between distributors and their - indirect resellers in a channel. - """ - - _client: CloudChannelServiceClient - - DEFAULT_ENDPOINT = CloudChannelServiceClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = CloudChannelServiceClient.DEFAULT_MTLS_ENDPOINT - - channel_partner_link_path = staticmethod(CloudChannelServiceClient.channel_partner_link_path) - parse_channel_partner_link_path = staticmethod(CloudChannelServiceClient.parse_channel_partner_link_path) - channel_partner_repricing_config_path = staticmethod(CloudChannelServiceClient.channel_partner_repricing_config_path) - parse_channel_partner_repricing_config_path = staticmethod(CloudChannelServiceClient.parse_channel_partner_repricing_config_path) - customer_path = staticmethod(CloudChannelServiceClient.customer_path) - parse_customer_path = staticmethod(CloudChannelServiceClient.parse_customer_path) - customer_repricing_config_path = staticmethod(CloudChannelServiceClient.customer_repricing_config_path) - parse_customer_repricing_config_path = staticmethod(CloudChannelServiceClient.parse_customer_repricing_config_path) - entitlement_path = staticmethod(CloudChannelServiceClient.entitlement_path) - parse_entitlement_path = staticmethod(CloudChannelServiceClient.parse_entitlement_path) - offer_path = staticmethod(CloudChannelServiceClient.offer_path) - parse_offer_path = staticmethod(CloudChannelServiceClient.parse_offer_path) - product_path = staticmethod(CloudChannelServiceClient.product_path) - parse_product_path = staticmethod(CloudChannelServiceClient.parse_product_path) - sku_path = staticmethod(CloudChannelServiceClient.sku_path) - parse_sku_path = staticmethod(CloudChannelServiceClient.parse_sku_path) - common_billing_account_path = staticmethod(CloudChannelServiceClient.common_billing_account_path) - parse_common_billing_account_path = staticmethod(CloudChannelServiceClient.parse_common_billing_account_path) - common_folder_path = staticmethod(CloudChannelServiceClient.common_folder_path) - parse_common_folder_path = staticmethod(CloudChannelServiceClient.parse_common_folder_path) - common_organization_path = staticmethod(CloudChannelServiceClient.common_organization_path) - parse_common_organization_path = staticmethod(CloudChannelServiceClient.parse_common_organization_path) - common_project_path = staticmethod(CloudChannelServiceClient.common_project_path) - parse_common_project_path = staticmethod(CloudChannelServiceClient.parse_common_project_path) - common_location_path = staticmethod(CloudChannelServiceClient.common_location_path) - parse_common_location_path = staticmethod(CloudChannelServiceClient.parse_common_location_path) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CloudChannelServiceAsyncClient: The constructed client. - """ - return CloudChannelServiceClient.from_service_account_info.__func__(CloudChannelServiceAsyncClient, info, *args, **kwargs) # type: ignore - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CloudChannelServiceAsyncClient: The constructed client. - """ - return CloudChannelServiceClient.from_service_account_file.__func__(CloudChannelServiceAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return CloudChannelServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> CloudChannelServiceTransport: - """Returns the transport used by the client instance. - - Returns: - CloudChannelServiceTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial(type(CloudChannelServiceClient).get_transport_class, type(CloudChannelServiceClient)) - - def __init__(self, *, - credentials: ga_credentials.Credentials = None, - transport: Union[str, CloudChannelServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the cloud channel service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CloudChannelServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (ClientOptions): Custom options for the client. It - won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = CloudChannelServiceClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - - ) - - async def list_customers(self, - request: Union[service.ListCustomersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomersAsyncPager: - r"""List [Customer][google.cloud.channel.v1.Customer]s. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: List of - [Customer][google.cloud.channel.v1.Customer]s, or an empty list - if there are no customers. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_customers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListCustomersRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_customers(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListCustomersRequest, dict]): - The request object. Request message for - [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomersAsyncPager: - Response message for - [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListCustomersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_customers, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCustomersAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_customer(self, - request: Union[service.GetCustomerRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customers.Customer: - r"""Returns the requested - [Customer][google.cloud.channel.v1.Customer] resource. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer resource doesn't exist. Usually the - result of an invalid name parameter. - - Return value: The [Customer][google.cloud.channel.v1.Customer] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_get_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetCustomerRequest( - name="name_value", - ) - - # Make the request - response = await client.get_customer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.GetCustomer][google.cloud.channel.v1.CloudChannelService.GetCustomer]. - name (:class:`str`): - Required. The resource name of the customer to retrieve. - Name uses the format: - accounts/{account_id}/customers/{customer_id} - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Customer: - Entity representing a customer of a - reseller or distributor. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.GetCustomerRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_customer, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def check_cloud_identity_accounts_exist(self, - request: Union[service.CheckCloudIdentityAccountsExistRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.CheckCloudIdentityAccountsExistResponse: - r"""Confirms the existence of Cloud Identity accounts based on the - domain and if the Cloud Identity accounts are owned by the - reseller. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - INVALID_VALUE: Invalid domain value in the request. - - Return value: A list of - [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] - resources for the domain (may be empty) - - Note: in the v1alpha1 version of the API, a NOT_FOUND error - returns if no - [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] - resources match the domain. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_check_cloud_identity_accounts_exist(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.CheckCloudIdentityAccountsExistRequest( - parent="parent_value", - domain="domain_value", - ) - - # Make the request - response = await client.check_cloud_identity_accounts_exist(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistRequest, dict]): - The request object. Request message for - [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistResponse: - Response message for - [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. - - """ - # Create or coerce a protobuf request object. - request = service.CheckCloudIdentityAccountsExistRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.check_cloud_identity_accounts_exist, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_customer(self, - request: Union[service.CreateCustomerRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customers.Customer: - r"""Creates a new [Customer][google.cloud.channel.v1.Customer] - resource under the reseller or distributor account. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - Domain field value doesn't match the primary email domain. - - Return value: The newly created - [Customer][google.cloud.channel.v1.Customer] resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_create_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - customer = channel_v1.Customer() - customer.org_display_name = "org_display_name_value" - customer.domain = "domain_value" - - request = channel_v1.CreateCustomerRequest( - parent="parent_value", - customer=customer, - ) - - # Make the request - response = await client.create_customer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateCustomer][google.cloud.channel.v1.CloudChannelService.CreateCustomer] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Customer: - Entity representing a customer of a - reseller or distributor. - - """ - # Create or coerce a protobuf request object. - request = service.CreateCustomerRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_customer, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_customer(self, - request: Union[service.UpdateCustomerRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customers.Customer: - r"""Updates an existing [Customer][google.cloud.channel.v1.Customer] - resource for the reseller or distributor. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] - resource found for the name in the request. - - Return value: The updated - [Customer][google.cloud.channel.v1.Customer] resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_update_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - customer = channel_v1.Customer() - customer.org_display_name = "org_display_name_value" - customer.domain = "domain_value" - - request = channel_v1.UpdateCustomerRequest( - customer=customer, - ) - - # Make the request - response = await client.update_customer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UpdateCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.UpdateCustomer][google.cloud.channel.v1.CloudChannelService.UpdateCustomer]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Customer: - Entity representing a customer of a - reseller or distributor. - - """ - # Create or coerce a protobuf request object. - request = service.UpdateCustomerRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_customer, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer.name", request.customer.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_customer(self, - request: Union[service.DeleteCustomerRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the given [Customer][google.cloud.channel.v1.Customer] - permanently. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The customer has existing entitlements. - - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] - resource found for the name in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_delete_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.DeleteCustomerRequest( - name="name_value", - ) - - # Make the request - await client.delete_customer(request=request) - - Args: - request (Union[google.cloud.channel_v1.types.DeleteCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.DeleteCustomer][google.cloud.channel.v1.CloudChannelService.DeleteCustomer]. - name (:class:`str`): - Required. The resource name of the - customer to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.DeleteCustomerRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_customer, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def import_customer(self, - request: Union[service.ImportCustomerRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customers.Customer: - r"""Imports a [Customer][google.cloud.channel.v1.Customer] from the - Cloud Identity associated with the provided Cloud Identity ID or - domain before a TransferEntitlements call. If a linked Customer - already exists and overwrite_if_exists is true, it will update - that Customer's data. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - NOT_FOUND: Cloud Identity doesn't exist or was deleted. - - INVALID_ARGUMENT: Required parameters are missing, or the - auth_token is expired or invalid. - - ALREADY_EXISTS: A customer already exists and has conflicting - critical fields. Requires an overwrite. - - Return value: The [Customer][google.cloud.channel.v1.Customer]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_import_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ImportCustomerRequest( - domain="domain_value", - parent="parent_value", - overwrite_if_exists=True, - ) - - # Make the request - response = await client.import_customer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ImportCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Customer: - Entity representing a customer of a - reseller or distributor. - - """ - # Create or coerce a protobuf request object. - request = service.ImportCustomerRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.import_customer, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def provision_cloud_identity(self, - request: Union[service.ProvisionCloudIdentityRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Creates a Cloud Identity for the given customer using the - customer's information, or the information provided here. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer was not found. - - ALREADY_EXISTS: The customer's primary email already exists. - Retry after changing the customer's primary contact email. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - contains an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_provision_cloud_identity(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ProvisionCloudIdentityRequest( - customer="customer_value", - ) - - # Make the request - operation = client.provision_cloud_identity(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ProvisionCloudIdentityRequest, dict]): - The request object. Request message for - [CloudChannelService.ProvisionCloudIdentity][google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Customer` Entity - representing a customer of a reseller or distributor. - - """ - # Create or coerce a protobuf request object. - request = service.ProvisionCloudIdentityRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.provision_cloud_identity, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer", request.customer), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - customers.Customer, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def list_entitlements(self, - request: Union[service.ListEntitlementsRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListEntitlementsAsyncPager: - r"""Lists [Entitlement][google.cloud.channel.v1.Entitlement]s - belonging to a customer. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: A list of the customer's - [Entitlement][google.cloud.channel.v1.Entitlement]s. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_entitlements(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListEntitlementsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_entitlements(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListEntitlementsRequest, dict]): - The request object. Request message for - [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListEntitlementsAsyncPager: - Response message for - [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListEntitlementsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_entitlements, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListEntitlementsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_transferable_skus(self, - request: Union[service.ListTransferableSkusRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListTransferableSkusAsyncPager: - r"""List [TransferableSku][google.cloud.channel.v1.TransferableSku]s - of a customer based on the Cloud Identity ID or Customer Name in - the request. - - Use this method to list the entitlements information of an - unowned customer. You should provide the customer's Cloud - Identity ID or Customer Name. - - Possible error codes: - - - PERMISSION_DENIED: - - - The customer doesn't belong to the reseller and has no - auth token. - - The supplied auth token is invalid. - - The reseller account making the request is different from - the reseller account in the query. - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: A list of the customer's - [TransferableSku][google.cloud.channel.v1.TransferableSku]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_transferable_skus(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListTransferableSkusRequest( - cloud_identity_id="cloud_identity_id_value", - parent="parent_value", - ) - - # Make the request - page_result = client.list_transferable_skus(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListTransferableSkusRequest, dict]): - The request object. Request message for - [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableSkusAsyncPager: - Response message for - [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListTransferableSkusRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_transferable_skus, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListTransferableSkusAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_transferable_offers(self, - request: Union[service.ListTransferableOffersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListTransferableOffersAsyncPager: - r"""List - [TransferableOffer][google.cloud.channel.v1.TransferableOffer]s - of a customer based on Cloud Identity ID or Customer Name in the - request. - - Use this method when a reseller gets the entitlement information - of an unowned customer. The reseller should provide the - customer's Cloud Identity ID or Customer Name. - - Possible error codes: - - - PERMISSION_DENIED: - - - The customer doesn't belong to the reseller and has no - auth token. - - The customer provided incorrect reseller information when - generating auth token. - - The reseller account making the request is different from - the reseller account in the query. - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: List of - [TransferableOffer][google.cloud.channel.v1.TransferableOffer] - for the given customer and SKU. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_transferable_offers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListTransferableOffersRequest( - cloud_identity_id="cloud_identity_id_value", - parent="parent_value", - sku="sku_value", - ) - - # Make the request - page_result = client.list_transferable_offers(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListTransferableOffersRequest, dict]): - The request object. Request message for - [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableOffersAsyncPager: - Response message for - [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListTransferableOffersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_transferable_offers, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListTransferableOffersAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_entitlement(self, - request: Union[service.GetEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> entitlements.Entitlement: - r"""Returns the requested - [Entitlement][google.cloud.channel.v1.Entitlement] resource. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer entitlement was not found. - - Return value: The requested - [Entitlement][google.cloud.channel.v1.Entitlement] resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_get_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetEntitlementRequest( - name="name_value", - ) - - # Make the request - response = await client.get_entitlement(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.GetEntitlement][google.cloud.channel.v1.CloudChannelService.GetEntitlement]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Entitlement: - An entitlement is a representation of - a customer's ability to use a service. - - """ - # Create or coerce a protobuf request object. - request = service.GetEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_entitlement, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_entitlement(self, - request: Union[service.CreateEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Creates an entitlement for a customer. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - There is already a customer entitlement for a SKU from the - same product family. - - - INVALID_VALUE: Make sure the OfferId is valid. If it is, - contact Google Channel support for further troubleshooting. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: - - - The SKU was already purchased for the customer. - - The customer's primary email already exists. Retry after - changing the customer's primary contact email. - - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The domain required for purchasing a SKU has not been - verified. - - A pre-requisite SKU required to purchase an Add-On SKU is - missing. For example, Google Workspace Business Starter is - required to purchase Vault or Drive. - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_create_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - entitlement = channel_v1.Entitlement() - entitlement.offer = "offer_value" - - request = channel_v1.CreateEntitlementRequest( - parent="parent_value", - entitlement=entitlement, - ) - - # Make the request - operation = client.create_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateEntitlement][google.cloud.channel.v1.CloudChannelService.CreateEntitlement] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - request = service.CreateEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_entitlement, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def change_parameters(self, - request: Union[service.ChangeParametersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Change parameters of the entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. For example, the number of seats being changed is - greater than the allowed number of max seats, or decreasing - seats for a commitment based plan. - - NOT_FOUND: Entitlement resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_change_parameters(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ChangeParametersRequest( - name="name_value", - ) - - # Make the request - operation = client.change_parameters(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ChangeParametersRequest, dict]): - The request object. Request message for - [CloudChannelService.ChangeParametersRequest][]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - request = service.ChangeParametersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.change_parameters, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def change_renewal_settings(self, - request: Union[service.ChangeRenewalSettingsRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Updates the renewal settings for an existing customer - entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for - a commitment plan. Can't enable or disable renewals for - non-commitment plans. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_change_renewal_settings(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ChangeRenewalSettingsRequest( - name="name_value", - ) - - # Make the request - operation = client.change_renewal_settings(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ChangeRenewalSettingsRequest, dict]): - The request object. Request message for - [CloudChannelService.ChangeRenewalSettings][google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - request = service.ChangeRenewalSettingsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.change_renewal_settings, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def change_offer(self, - request: Union[service.ChangeOfferRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Updates the Offer for an existing customer entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Offer or Entitlement resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_change_offer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ChangeOfferRequest( - name="name_value", - offer="offer_value", - ) - - # Make the request - operation = client.change_offer(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ChangeOfferRequest, dict]): - The request object. Request message for - [CloudChannelService.ChangeOffer][google.cloud.channel.v1.CloudChannelService.ChangeOffer]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - request = service.ChangeOfferRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.change_offer, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def start_paid_service(self, - request: Union[service.StartPaidServiceRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Starts paid service for a trial entitlement. - - Starts paid service for a trial entitlement immediately. This - method is only applicable if a plan is set up for a trial - entitlement but has some trial days remaining. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for - entitlement on trial plans. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_start_paid_service(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.StartPaidServiceRequest( - name="name_value", - ) - - # Make the request - operation = client.start_paid_service(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.StartPaidServiceRequest, dict]): - The request object. Request message for - [CloudChannelService.StartPaidService][google.cloud.channel.v1.CloudChannelService.StartPaidService]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - request = service.StartPaidServiceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.start_paid_service, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def suspend_entitlement(self, - request: Union[service.SuspendEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Suspends a previously fulfilled entitlement. - - An entitlement suspension is a long-running operation. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - NOT_ACTIVE: Entitlement is not active. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_suspend_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.SuspendEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.suspend_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.SuspendEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.SuspendEntitlement][google.cloud.channel.v1.CloudChannelService.SuspendEntitlement]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - request = service.SuspendEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.suspend_entitlement, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def cancel_entitlement(self, - request: Union[service.CancelEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Cancels a previously fulfilled entitlement. - - An entitlement cancellation is a long-running operation. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - FAILED_PRECONDITION: There are Google Cloud projects linked - to the Google Cloud entitlement's Cloud Billing subaccount. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google - Workspace add-ons, or entitlements for Google Cloud's - development platform. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The response will - contain google.protobuf.Empty on success. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_cancel_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.CancelEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.cancel_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CancelEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.CancelEntitlement][google.cloud.channel.v1.CloudChannelService.CancelEntitlement]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - request = service.CancelEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.cancel_entitlement, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def activate_entitlement(self, - request: Union[service.ActivateEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Activates a previously suspended entitlement. Entitlements - suspended for pending ToS acceptance can't be activated using - this method. - - An entitlement activation is a long-running operation and it - updates the state of the customer entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - SUSPENSION_NOT_RESELLER_INITIATED: Can only activate - reseller-initiated suspensions and entitlements that have - accepted the TOS. - - NOT_SUSPENDED: Can only activate suspended entitlements not - in an ACTIVE state. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_activate_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ActivateEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.activate_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ActivateEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.ActivateEntitlement][google.cloud.channel.v1.CloudChannelService.ActivateEntitlement]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - request = service.ActivateEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.activate_entitlement, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def transfer_entitlements(self, - request: Union[service.TransferEntitlementsRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Transfers customer entitlements to new reseller. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: The SKU was already transferred for the - customer. - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The SKU requires domain verification to transfer, but the - domain is not verified. - - An Add-On SKU (example, Vault or Drive) is missing the - pre-requisite SKU (example, G Suite Basic). - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - Specify all transferring entitlements. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_transfer_entitlements(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - entitlements = channel_v1.Entitlement() - entitlements.offer = "offer_value" - - request = channel_v1.TransferEntitlementsRequest( - parent="parent_value", - entitlements=entitlements, - ) - - # Make the request - operation = client.transfer_entitlements(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.TransferEntitlementsRequest, dict]): - The request object. Request message for - [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.channel_v1.types.TransferEntitlementsResponse` Response message for [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. - This is put in the response field of - google.longrunning.Operation. - - """ - # Create or coerce a protobuf request object. - request = service.TransferEntitlementsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.transfer_entitlements, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - service.TransferEntitlementsResponse, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def transfer_entitlements_to_google(self, - request: Union[service.TransferEntitlementsToGoogleRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Transfers customer entitlements from their current reseller to - Google. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: The SKU was already transferred for the - customer. - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The SKU requires domain verification to transfer, but the - domain is not verified. - - An Add-On SKU (example, Vault or Drive) is missing the - pre-requisite SKU (example, G Suite Basic). - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The response will - contain google.protobuf.Empty on success. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_transfer_entitlements_to_google(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - entitlements = channel_v1.Entitlement() - entitlements.offer = "offer_value" - - request = channel_v1.TransferEntitlementsToGoogleRequest( - parent="parent_value", - entitlements=entitlements, - ) - - # Make the request - operation = client.transfer_entitlements_to_google(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.TransferEntitlementsToGoogleRequest, dict]): - The request object. Request message for - [CloudChannelService.TransferEntitlementsToGoogle][google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - request = service.TransferEntitlementsToGoogleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.transfer_entitlements_to_google, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - async def list_channel_partner_links(self, - request: Union[service.ListChannelPartnerLinksRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListChannelPartnerLinksAsyncPager: - r"""List - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s - belonging to a distributor. You must be a distributor to call - this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: The list of the distributor account's - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resources. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_channel_partner_links(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListChannelPartnerLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_partner_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListChannelPartnerLinksRequest, dict]): - The request object. Request message for - [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerLinksAsyncPager: - Response message for - [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListChannelPartnerLinksRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_channel_partner_links, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListChannelPartnerLinksAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_channel_partner_link(self, - request: Union[service.GetChannelPartnerLinkRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> channel_partner_links.ChannelPartnerLink: - r"""Returns the requested - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. You must be a distributor to call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: ChannelPartnerLink resource not found because of - an invalid channel partner link name. - - Return value: The - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_get_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetChannelPartnerLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_channel_partner_link(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetChannelPartnerLinkRequest, dict]): - The request object. Request message for - [CloudChannelService.GetChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerLink: - Entity representing a link between - distributors and their indirect - resellers in an n-tier resale channel. - - """ - # Create or coerce a protobuf request object. - request = service.GetChannelPartnerLinkRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_channel_partner_link, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_channel_partner_link(self, - request: Union[service.CreateChannelPartnerLinkRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> channel_partner_links.ChannelPartnerLink: - r"""Initiates a channel partner link between a distributor and a - reseller, or between resellers in an n-tier reseller channel. - Invited partners need to follow the invite_link_uri provided in - the response to accept. After accepting the invitation, a link - is set up between the two parties. You must be a distributor to - call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - ALREADY_EXISTS: The ChannelPartnerLink sent in the request - already exists. - - NOT_FOUND: No Cloud Identity customer exists for provided - domain. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The new - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_create_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - channel_partner_link = channel_v1.ChannelPartnerLink() - channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" - channel_partner_link.link_state = "SUSPENDED" - - request = channel_v1.CreateChannelPartnerLinkRequest( - parent="parent_value", - channel_partner_link=channel_partner_link, - ) - - # Make the request - response = await client.create_channel_partner_link(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateChannelPartnerLinkRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerLink: - Entity representing a link between - distributors and their indirect - resellers in an n-tier resale channel. - - """ - # Create or coerce a protobuf request object. - request = service.CreateChannelPartnerLinkRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_channel_partner_link, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_channel_partner_link(self, - request: Union[service.UpdateChannelPartnerLinkRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> channel_partner_links.ChannelPartnerLink: - r"""Updates a channel partner link. Distributors call this method to - change a link's status. For example, to suspend a partner link. - You must be a distributor to call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - Link state cannot change from invited to active or - suspended. - - Cannot send reseller_cloud_identity_id, invite_url, or - name in update mask. - - - NOT_FOUND: ChannelPartnerLink resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The updated - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_update_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - channel_partner_link = channel_v1.ChannelPartnerLink() - channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" - channel_partner_link.link_state = "SUSPENDED" - - request = channel_v1.UpdateChannelPartnerLinkRequest( - name="name_value", - channel_partner_link=channel_partner_link, - ) - - # Make the request - response = await client.update_channel_partner_link(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UpdateChannelPartnerLinkRequest, dict]): - The request object. Request message for - [CloudChannelService.UpdateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerLink: - Entity representing a link between - distributors and their indirect - resellers in an n-tier resale channel. - - """ - # Create or coerce a protobuf request object. - request = service.UpdateChannelPartnerLinkRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_channel_partner_link, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_customer_repricing_config(self, - request: Union[service.GetCustomerRepricingConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.CustomerRepricingConfig: - r"""Gets information about how a Reseller modifies their bill before - sending it to a Customer. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - was not found. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_get_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetCustomerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - response = await client.get_customer_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetCustomerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.GetCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig]. - name (:class:`str`): - Required. The resource name of the - CustomerRepricingConfig. Format: - accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.CustomerRepricingConfig: - Configuration for how a reseller will - reprice a Customer. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.GetCustomerRepricingConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_customer_repricing_config, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_customer_repricing_configs(self, - request: Union[service.ListCustomerRepricingConfigsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomerRepricingConfigsAsyncPager: - r"""Lists information about how a Reseller modifies their bill - before sending it to a Customer. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resources. The data for each resource is displayed in the - ascending order of: - - - customer ID - - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] - - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - - [CustomerRepricingConfig.update_time][google.cloud.channel.v1.CustomerRepricingConfig.update_time] - - If unsuccessful, returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_customer_repricing_configs(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListCustomerRepricingConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_customer_repricing_configs(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest, dict]): - The request object. Request message for - [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. - parent (:class:`str`): - Required. The resource name of the customer. Parent uses - the format: - accounts/{account_id}/customers/{customer_id}. Supports - accounts/{account_id}/customers/- to retrieve configs - for all customers. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomerRepricingConfigsAsyncPager: - Response message for - [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.ListCustomerRepricingConfigsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_customer_repricing_configs, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCustomerRepricingConfigsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_customer_repricing_config(self, - request: Union[service.CreateCustomerRepricingConfigRequest, dict] = None, - *, - parent: str = None, - customer_repricing_config: repricing.CustomerRepricingConfig = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.CustomerRepricingConfig: - r"""Creates a CustomerRepricingConfig. Call this method to set - modifications for a specific customer's bill. You can only - create configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. If needed, you can create a config for the - current month, with some restrictions. - - When creating a config for a future month, make sure there are - no existing configs for that - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The following restrictions are for creating configs in the - current month. - - - This functionality is reserved for recovering from an - erroneous config, and should not be used for regular business - cases. - - The new config will not modify exports used with other - configs. Changes to the config may be immediate, but may take - up to 24 hours. - - There is a limit of ten configs for any - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] - or - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The contained - [CustomerRepricingConfig.repricing_config][google.cloud.channel.v1.CustomerRepricingConfig.repricing_config] - vaule must be different from the value used in the current - config for a - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement]. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_create_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - customer_repricing_config = channel_v1.CustomerRepricingConfig() - customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.CreateCustomerRepricingConfigRequest( - parent="parent_value", - customer_repricing_config=customer_repricing_config, - ) - - # Make the request - response = await client.create_customer_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateCustomerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig]. - parent (:class:`str`): - Required. The resource name of the customer that will - receive this repricing config. Parent uses the format: - accounts/{account_id}/customers/{customer_id} - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - customer_repricing_config (:class:`google.cloud.channel_v1.types.CustomerRepricingConfig`): - Required. The CustomerRepricingConfig - object to update. - - This corresponds to the ``customer_repricing_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.CustomerRepricingConfig: - Configuration for how a reseller will - reprice a Customer. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, customer_repricing_config]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.CreateCustomerRepricingConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if customer_repricing_config is not None: - request.customer_repricing_config = customer_repricing_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_customer_repricing_config, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_customer_repricing_config(self, - request: Union[service.UpdateCustomerRepricingConfigRequest, dict] = None, - *, - customer_repricing_config: repricing.CustomerRepricingConfig = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.CustomerRepricingConfig: - r"""Updates a CustomerRepricingConfig. Call this method to set - modifications for a specific customer's bill. This method - overwrites the existing CustomerRepricingConfig. - - You can only update configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. To make changes to configs for the current - month, use - [CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig], - taking note of its restrictions. You cannot update the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - When updating a config in the future: - - - This config must already exist. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_update_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - customer_repricing_config = channel_v1.CustomerRepricingConfig() - customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.UpdateCustomerRepricingConfigRequest( - customer_repricing_config=customer_repricing_config, - ) - - # Make the request - response = await client.update_customer_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UpdateCustomerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.UpdateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig]. - customer_repricing_config (:class:`google.cloud.channel_v1.types.CustomerRepricingConfig`): - Required. The CustomerRepricingConfig - object to update. - - This corresponds to the ``customer_repricing_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.CustomerRepricingConfig: - Configuration for how a reseller will - reprice a Customer. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([customer_repricing_config]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.UpdateCustomerRepricingConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if customer_repricing_config is not None: - request.customer_repricing_config = customer_repricing_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_customer_repricing_config, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer_repricing_config.name", request.customer_repricing_config.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_customer_repricing_config(self, - request: Union[service.DeleteCustomerRepricingConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the given - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - permanently. You can only delete configs if their - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is set to a date after the current month. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - is active or in the past. - - NOT_FOUND: No - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - found for the name in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_delete_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.DeleteCustomerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - await client.delete_customer_repricing_config(request=request) - - Args: - request (Union[google.cloud.channel_v1.types.DeleteCustomerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.DeleteCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig]. - name (:class:`str`): - Required. The resource name of the customer repricing - config rule to delete. Format: - accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.DeleteCustomerRepricingConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_customer_repricing_config, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def get_channel_partner_repricing_config(self, - request: Union[service.GetChannelPartnerRepricingConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.ChannelPartnerRepricingConfig: - r"""Gets information about how a Distributor modifies their bill - before sending it to a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - was not found. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_get_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetChannelPartnerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - response = await client.get_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetChannelPartnerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.GetChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig] - name (:class:`str`): - Required. The resource name of the - ChannelPartnerRepricingConfig Format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: - Configuration for how a distributor - will rebill a channel partner (also - known as a distributor-authorized - reseller). - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.GetChannelPartnerRepricingConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_channel_partner_repricing_config, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_channel_partner_repricing_configs(self, - request: Union[service.ListChannelPartnerRepricingConfigsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListChannelPartnerRepricingConfigsAsyncPager: - r"""Lists information about how a Reseller modifies their bill - before sending it to a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resources. The data for each resource is displayed in the - ascending order of: - - - channel partner ID - - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - - [ChannelPartnerRepricingConfig.update_time][google.cloud.channel.v1.ChannelPartnerRepricingConfig.update_time] - - If unsuccessful, returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_channel_partner_repricing_configs(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListChannelPartnerRepricingConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_partner_repricing_configs(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest, dict]): - The request object. Request message for - [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. - parent (:class:`str`): - Required. The resource name of the account's - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]. - Parent uses the format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id}. - Supports accounts/{account_id}/channelPartnerLinks/- to - retrieve configs for all channel partners. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerRepricingConfigsAsyncPager: - Response message for - [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.ListChannelPartnerRepricingConfigsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_channel_partner_repricing_configs, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListChannelPartnerRepricingConfigsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_channel_partner_repricing_config(self, - request: Union[service.CreateChannelPartnerRepricingConfigRequest, dict] = None, - *, - parent: str = None, - channel_partner_repricing_config: repricing.ChannelPartnerRepricingConfig = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.ChannelPartnerRepricingConfig: - r"""Creates a ChannelPartnerRepricingConfig. Call this method to set - modifications for a specific ChannelPartner's bill. You can only - create configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. If needed, you can create a config for the - current month, with some restrictions. - - When creating a config for a future month, make sure there are - no existing configs for that - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The following restrictions are for creating configs in the - current month. - - - This functionality is reserved for recovering from an - erroneous config, and should not be used for regular business - cases. - - The new config will not modify exports used with other - configs. Changes to the config may be immediate, but may take - up to 24 hours. - - There is a limit of ten configs for any ChannelPartner or - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The contained - [ChannelPartnerRepricingConfig.repricing_config][google.cloud.channel.v1.ChannelPartnerRepricingConfig.repricing_config] - vaule must be different from the value used in the current - config for a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_create_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() - channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.CreateChannelPartnerRepricingConfigRequest( - parent="parent_value", - channel_partner_repricing_config=channel_partner_repricing_config, - ) - - # Make the request - response = await client.create_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateChannelPartnerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig]. - parent (:class:`str`): - Required. The resource name of the ChannelPartner that - will receive the repricing config. Parent uses the - format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id} - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - channel_partner_repricing_config (:class:`google.cloud.channel_v1.types.ChannelPartnerRepricingConfig`): - Required. The - ChannelPartnerRepricingConfig object to - update. - - This corresponds to the ``channel_partner_repricing_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: - Configuration for how a distributor - will rebill a channel partner (also - known as a distributor-authorized - reseller). - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, channel_partner_repricing_config]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.CreateChannelPartnerRepricingConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if channel_partner_repricing_config is not None: - request.channel_partner_repricing_config = channel_partner_repricing_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_channel_partner_repricing_config, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_channel_partner_repricing_config(self, - request: Union[service.UpdateChannelPartnerRepricingConfigRequest, dict] = None, - *, - channel_partner_repricing_config: repricing.ChannelPartnerRepricingConfig = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.ChannelPartnerRepricingConfig: - r"""Updates a ChannelPartnerRepricingConfig. Call this method to set - modifications for a specific ChannelPartner's bill. This method - overwrites the existing CustomerRepricingConfig. - - You can only update configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. To make changes to configs for the current - month, use - [CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig], - taking note of its restrictions. You cannot update the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - When updating a config in the future: - - - This config must already exist. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_update_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() - channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.UpdateChannelPartnerRepricingConfigRequest( - channel_partner_repricing_config=channel_partner_repricing_config, - ) - - # Make the request - response = await client.update_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UpdateChannelPartnerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.UpdateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig]. - channel_partner_repricing_config (:class:`google.cloud.channel_v1.types.ChannelPartnerRepricingConfig`): - Required. The - ChannelPartnerRepricingConfig object to - update. - - This corresponds to the ``channel_partner_repricing_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: - Configuration for how a distributor - will rebill a channel partner (also - known as a distributor-authorized - reseller). - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([channel_partner_repricing_config]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.UpdateChannelPartnerRepricingConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if channel_partner_repricing_config is not None: - request.channel_partner_repricing_config = channel_partner_repricing_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_channel_partner_repricing_config, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("channel_partner_repricing_config.name", request.channel_partner_repricing_config.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_channel_partner_repricing_config(self, - request: Union[service.DeleteChannelPartnerRepricingConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the given - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - permanently. You can only delete configs if their - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is set to a date after the current month. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - is active or in the past. - - NOT_FOUND: No - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - found for the name in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_delete_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.DeleteChannelPartnerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - await client.delete_channel_partner_repricing_config(request=request) - - Args: - request (Union[google.cloud.channel_v1.types.DeleteChannelPartnerRepricingConfigRequest, dict]): - The request object. Request message for - DeleteChannelPartnerRepricingConfig. - name (:class:`str`): - Required. The resource name of the - channel partner repricing config rule to - delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - request = service.DeleteChannelPartnerRepricingConfigRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_channel_partner_repricing_config, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def lookup_offer(self, - request: Union[service.LookupOfferRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> offers.Offer: - r"""Returns the requested [Offer][google.cloud.channel.v1.Offer] - resource. - - Possible error codes: - - - PERMISSION_DENIED: The entitlement doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement or offer was not found. - - Return value: The [Offer][google.cloud.channel.v1.Offer] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_lookup_offer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.LookupOfferRequest( - entitlement="entitlement_value", - ) - - # Make the request - response = await client.lookup_offer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.LookupOfferRequest, dict]): - The request object. Request message for LookupOffer. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Offer: - Represents an offer made to resellers for purchase. - An offer is associated with a - [Sku][google.cloud.channel.v1.Sku], has a plan for - payment, a price, and defines the constraints for - buying. - - """ - # Create or coerce a protobuf request object. - request = service.LookupOfferRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.lookup_offer, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("entitlement", request.entitlement), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_products(self, - request: Union[service.ListProductsRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListProductsAsyncPager: - r"""Lists the Products the reseller is authorized to sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_products(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListProductsRequest( - account="account_value", - ) - - # Make the request - page_result = client.list_products(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListProductsRequest, dict]): - The request object. Request message for ListProducts. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListProductsAsyncPager: - Response message for ListProducts. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListProductsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_products, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListProductsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_skus(self, - request: Union[service.ListSkusRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListSkusAsyncPager: - r"""Lists the SKUs for a product the reseller is authorized to sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_skus(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListSkusRequest( - parent="parent_value", - account="account_value", - ) - - # Make the request - page_result = client.list_skus(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListSkusRequest, dict]): - The request object. Request message for ListSkus. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSkusAsyncPager: - Response message for ListSkus. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListSkusRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_skus, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListSkusAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_offers(self, - request: Union[service.ListOffersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListOffersAsyncPager: - r"""Lists the Offers the reseller can sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_offers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListOffersRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_offers(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListOffersRequest, dict]): - The request object. Request message for ListOffers. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListOffersAsyncPager: - Response message for ListOffers. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListOffersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_offers, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListOffersAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_purchasable_skus(self, - request: Union[service.ListPurchasableSkusRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListPurchasableSkusAsyncPager: - r"""Lists the following: - - - SKUs that you can purchase for a customer - - SKUs that you can upgrade or downgrade for an entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_purchasable_skus(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() - create_entitlement_purchase.product = "product_value" - - request = channel_v1.ListPurchasableSkusRequest( - create_entitlement_purchase=create_entitlement_purchase, - customer="customer_value", - ) - - # Make the request - page_result = client.list_purchasable_skus(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListPurchasableSkusRequest, dict]): - The request object. Request message for - ListPurchasableSkus. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableSkusAsyncPager: - Response message for - ListPurchasableSkus. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListPurchasableSkusRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_purchasable_skus, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer", request.customer), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListPurchasableSkusAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_purchasable_offers(self, - request: Union[service.ListPurchasableOffersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListPurchasableOffersAsyncPager: - r"""Lists the following: - - - Offers that you can purchase for a customer. - - Offers that you can change for an entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_purchasable_offers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() - create_entitlement_purchase.sku = "sku_value" - - request = channel_v1.ListPurchasableOffersRequest( - create_entitlement_purchase=create_entitlement_purchase, - customer="customer_value", - ) - - # Make the request - page_result = client.list_purchasable_offers(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListPurchasableOffersRequest, dict]): - The request object. Request message for - ListPurchasableOffers. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableOffersAsyncPager: - Response message for - ListPurchasableOffers. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListPurchasableOffersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_purchasable_offers, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer", request.customer), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListPurchasableOffersAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def register_subscriber(self, - request: Union[service.RegisterSubscriberRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.RegisterSubscriberResponse: - r"""Registers a service account with subscriber privileges on the - Cloud Pub/Sub topic for this Channel Services account. After you - create a subscriber, you get the events through - [SubscriberEvent][google.cloud.channel.v1.SubscriberEvent] - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The topic name with the registered service email - address. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_register_subscriber(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.RegisterSubscriberRequest( - account="account_value", - service_account="service_account_value", - ) - - # Make the request - response = await client.register_subscriber(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.RegisterSubscriberRequest, dict]): - The request object. Request Message for - RegisterSubscriber. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.RegisterSubscriberResponse: - Response Message for - RegisterSubscriber. - - """ - # Create or coerce a protobuf request object. - request = service.RegisterSubscriberRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.register_subscriber, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("account", request.account), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def unregister_subscriber(self, - request: Union[service.UnregisterSubscriberRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.UnregisterSubscriberResponse: - r"""Unregisters a service account with subscriber privileges on the - Cloud Pub/Sub topic created for this Channel Services account. - If there are no service accounts left with subscriber - privileges, this deletes the topic. You can call ListSubscribers - to check for these accounts. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The topic resource doesn't exist. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The topic name that unregistered the service email - address. Returns a success response if the service email address - wasn't registered with the topic. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_unregister_subscriber(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.UnregisterSubscriberRequest( - account="account_value", - service_account="service_account_value", - ) - - # Make the request - response = await client.unregister_subscriber(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UnregisterSubscriberRequest, dict]): - The request object. Request Message for - UnregisterSubscriber. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.UnregisterSubscriberResponse: - Response Message for - UnregisterSubscriber. - - """ - # Create or coerce a protobuf request object. - request = service.UnregisterSubscriberRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.unregister_subscriber, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("account", request.account), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_subscribers(self, - request: Union[service.ListSubscribersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListSubscribersAsyncPager: - r"""Lists service accounts with subscriber privileges on the Cloud - Pub/Sub topic created for this Channel Services account. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The topic resource doesn't exist. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: A list of service email addresses. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - async def sample_list_subscribers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListSubscribersRequest( - account="account_value", - ) - - # Make the request - page_result = client.list_subscribers(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListSubscribersRequest, dict]): - The request object. Request Message for ListSubscribers. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSubscribersAsyncPager: - Response Message for ListSubscribers. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - request = service.ListSubscribersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_subscribers, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("account", request.account), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListSubscribersAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_operations( - self, - request: operations_pb2.ListOperationsRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.ListOperationsResponse: - r"""Lists operations that match the specified filter in the request. - - Args: - request (:class:`~.operations_pb2.ListOperationsRequest`): - The request object. Request message for - `ListOperations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.ListOperationsResponse: - Response message for ``ListOperations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.ListOperationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.list_operations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def get_operation( - self, - request: operations_pb2.GetOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Gets the latest state of a long-running operation. - - Args: - request (:class:`~.operations_pb2.GetOperationRequest`): - The request object. Request message for - `GetOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.Operation: - An ``Operation`` object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.GetOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.get_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def delete_operation( - self, - request: operations_pb2.DeleteOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a long-running operation. - - This method indicates that the client is no longer interested - in the operation result. It does not cancel the operation. - If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.DeleteOperationRequest`): - The request object. Request message for - `DeleteOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.DeleteOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.delete_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - async def cancel_operation( - self, - request: operations_pb2.CancelOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Starts asynchronous cancellation on a long-running operation. - - The server makes a best effort to cancel the operation, but success - is not guaranteed. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.CancelOperationRequest`): - The request object. Request message for - `CancelOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.CancelOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._client._transport.cancel_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-channel", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -__all__ = ( - "CloudChannelServiceAsyncClient", -) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/client.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/client.py deleted file mode 100644 index 5e42438..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/client.py +++ /dev/null @@ -1,5973 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import os -import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.cloud.channel_v1.services.cloud_channel_service import pagers -from google.cloud.channel_v1.types import channel_partner_links -from google.cloud.channel_v1.types import common -from google.cloud.channel_v1.types import customers -from google.cloud.channel_v1.types import entitlements -from google.cloud.channel_v1.types import offers -from google.cloud.channel_v1.types import operations -from google.cloud.channel_v1.types import products -from google.cloud.channel_v1.types import repricing -from google.cloud.channel_v1.types import service -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from google.type import postal_address_pb2 # type: ignore -from .transports.base import CloudChannelServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CloudChannelServiceGrpcTransport -from .transports.grpc_asyncio import CloudChannelServiceGrpcAsyncIOTransport - - -class CloudChannelServiceClientMeta(type): - """Metaclass for the CloudChannelService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - _transport_registry = OrderedDict() # type: Dict[str, Type[CloudChannelServiceTransport]] - _transport_registry["grpc"] = CloudChannelServiceGrpcTransport - _transport_registry["grpc_asyncio"] = CloudChannelServiceGrpcAsyncIOTransport - - def get_transport_class(cls, - label: str = None, - ) -> Type[CloudChannelServiceTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CloudChannelServiceClient(metaclass=CloudChannelServiceClientMeta): - """CloudChannelService lets Google cloud resellers and distributors - manage their customers, channel partners, entitlements, and reports. - - Using this service: - - 1. Resellers and distributors can manage a customer entity. - 2. Distributors can register an authorized reseller in their channel - and provide them with delegated admin access. - 3. Resellers and distributors can manage customer entitlements. - - CloudChannelService exposes the following resources: - - - [Customer][google.cloud.channel.v1.Customer]s: An entity—usually - an enterprise—managed by a reseller or distributor. - - - [Entitlement][google.cloud.channel.v1.Entitlement]s: An entity - that provides a customer with the means to use a service. - Entitlements are created or updated as a result of a successful - fulfillment. - - - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s: - An entity that identifies links between distributors and their - indirect resellers in a channel. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "cloudchannel.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CloudChannelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CloudChannelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CloudChannelServiceTransport: - """Returns the transport used by the client instance. - - Returns: - CloudChannelServiceTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def channel_partner_link_path(account: str,channel_partner_link: str,) -> str: - """Returns a fully-qualified channel_partner_link string.""" - return "accounts/{account}/channelPartnerLinks/{channel_partner_link}".format(account=account, channel_partner_link=channel_partner_link, ) - - @staticmethod - def parse_channel_partner_link_path(path: str) -> Dict[str,str]: - """Parses a channel_partner_link path into its component segments.""" - m = re.match(r"^accounts/(?P.+?)/channelPartnerLinks/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def channel_partner_repricing_config_path(account: str,channel_partner: str,channel_partner_repricing_config: str,) -> str: - """Returns a fully-qualified channel_partner_repricing_config string.""" - return "accounts/{account}/channelPartnerLinks/{channel_partner}/channelPartnerRepricingConfigs/{channel_partner_repricing_config}".format(account=account, channel_partner=channel_partner, channel_partner_repricing_config=channel_partner_repricing_config, ) - - @staticmethod - def parse_channel_partner_repricing_config_path(path: str) -> Dict[str,str]: - """Parses a channel_partner_repricing_config path into its component segments.""" - m = re.match(r"^accounts/(?P.+?)/channelPartnerLinks/(?P.+?)/channelPartnerRepricingConfigs/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def customer_path(account: str,customer: str,) -> str: - """Returns a fully-qualified customer string.""" - return "accounts/{account}/customers/{customer}".format(account=account, customer=customer, ) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str,str]: - """Parses a customer path into its component segments.""" - m = re.match(r"^accounts/(?P.+?)/customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def customer_repricing_config_path(account: str,customer: str,customer_repricing_config: str,) -> str: - """Returns a fully-qualified customer_repricing_config string.""" - return "accounts/{account}/customers/{customer}/customerRepricingConfigs/{customer_repricing_config}".format(account=account, customer=customer, customer_repricing_config=customer_repricing_config, ) - - @staticmethod - def parse_customer_repricing_config_path(path: str) -> Dict[str,str]: - """Parses a customer_repricing_config path into its component segments.""" - m = re.match(r"^accounts/(?P.+?)/customers/(?P.+?)/customerRepricingConfigs/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def entitlement_path(account: str,customer: str,entitlement: str,) -> str: - """Returns a fully-qualified entitlement string.""" - return "accounts/{account}/customers/{customer}/entitlements/{entitlement}".format(account=account, customer=customer, entitlement=entitlement, ) - - @staticmethod - def parse_entitlement_path(path: str) -> Dict[str,str]: - """Parses a entitlement path into its component segments.""" - m = re.match(r"^accounts/(?P.+?)/customers/(?P.+?)/entitlements/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def offer_path(account: str,offer: str,) -> str: - """Returns a fully-qualified offer string.""" - return "accounts/{account}/offers/{offer}".format(account=account, offer=offer, ) - - @staticmethod - def parse_offer_path(path: str) -> Dict[str,str]: - """Parses a offer path into its component segments.""" - m = re.match(r"^accounts/(?P.+?)/offers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def product_path(product: str,) -> str: - """Returns a fully-qualified product string.""" - return "products/{product}".format(product=product, ) - - @staticmethod - def parse_product_path(path: str) -> Dict[str,str]: - """Parses a product path into its component segments.""" - m = re.match(r"^products/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def sku_path(product: str,sku: str,) -> str: - """Returns a fully-qualified sku string.""" - return "products/{product}/skus/{sku}".format(product=product, sku=sku, ) - - @staticmethod - def parse_sku_path(path: str) -> Dict[str,str]: - """Parses a sku path into its component segments.""" - m = re.match(r"^products/(?P.+?)/skus/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str, ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str,str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str, ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder, ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str,str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str, ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization, ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str,str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str, ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project, ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str,str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str, ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format(project=project, location=location, ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str,str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variabel is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, CloudChannelServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the cloud channel service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, CloudChannelServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError("client_options.api_key and credentials are mutually exclusive") - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CloudChannelServiceTransport): - # transport is a CloudChannelServiceTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError("When providing a transport instance, " - "provide its credentials directly.") - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): - credentials = google.auth._default.get_api_key_credentials(api_key_value) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def list_customers(self, - request: Union[service.ListCustomersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomersPager: - r"""List [Customer][google.cloud.channel.v1.Customer]s. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: List of - [Customer][google.cloud.channel.v1.Customer]s, or an empty list - if there are no customers. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_customers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListCustomersRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_customers(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListCustomersRequest, dict]): - The request object. Request message for - [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomersPager: - Response message for - [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCustomersRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListCustomersRequest): - request = service.ListCustomersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_customers] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCustomersPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_customer(self, - request: Union[service.GetCustomerRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customers.Customer: - r"""Returns the requested - [Customer][google.cloud.channel.v1.Customer] resource. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer resource doesn't exist. Usually the - result of an invalid name parameter. - - Return value: The [Customer][google.cloud.channel.v1.Customer] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_get_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetCustomerRequest( - name="name_value", - ) - - # Make the request - response = client.get_customer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.GetCustomer][google.cloud.channel.v1.CloudChannelService.GetCustomer]. - name (str): - Required. The resource name of the customer to retrieve. - Name uses the format: - accounts/{account_id}/customers/{customer_id} - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Customer: - Entity representing a customer of a - reseller or distributor. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCustomerRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.GetCustomerRequest): - request = service.GetCustomerRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_customer] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def check_cloud_identity_accounts_exist(self, - request: Union[service.CheckCloudIdentityAccountsExistRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.CheckCloudIdentityAccountsExistResponse: - r"""Confirms the existence of Cloud Identity accounts based on the - domain and if the Cloud Identity accounts are owned by the - reseller. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - INVALID_VALUE: Invalid domain value in the request. - - Return value: A list of - [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] - resources for the domain (may be empty) - - Note: in the v1alpha1 version of the API, a NOT_FOUND error - returns if no - [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] - resources match the domain. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_check_cloud_identity_accounts_exist(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.CheckCloudIdentityAccountsExistRequest( - parent="parent_value", - domain="domain_value", - ) - - # Make the request - response = client.check_cloud_identity_accounts_exist(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistRequest, dict]): - The request object. Request message for - [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistResponse: - Response message for - [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.CheckCloudIdentityAccountsExistRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.CheckCloudIdentityAccountsExistRequest): - request = service.CheckCloudIdentityAccountsExistRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.check_cloud_identity_accounts_exist] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_customer(self, - request: Union[service.CreateCustomerRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customers.Customer: - r"""Creates a new [Customer][google.cloud.channel.v1.Customer] - resource under the reseller or distributor account. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - Domain field value doesn't match the primary email domain. - - Return value: The newly created - [Customer][google.cloud.channel.v1.Customer] resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_create_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - customer = channel_v1.Customer() - customer.org_display_name = "org_display_name_value" - customer.domain = "domain_value" - - request = channel_v1.CreateCustomerRequest( - parent="parent_value", - customer=customer, - ) - - # Make the request - response = client.create_customer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateCustomer][google.cloud.channel.v1.CloudChannelService.CreateCustomer] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Customer: - Entity representing a customer of a - reseller or distributor. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateCustomerRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.CreateCustomerRequest): - request = service.CreateCustomerRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_customer] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_customer(self, - request: Union[service.UpdateCustomerRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customers.Customer: - r"""Updates an existing [Customer][google.cloud.channel.v1.Customer] - resource for the reseller or distributor. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] - resource found for the name in the request. - - Return value: The updated - [Customer][google.cloud.channel.v1.Customer] resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_update_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - customer = channel_v1.Customer() - customer.org_display_name = "org_display_name_value" - customer.domain = "domain_value" - - request = channel_v1.UpdateCustomerRequest( - customer=customer, - ) - - # Make the request - response = client.update_customer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UpdateCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.UpdateCustomer][google.cloud.channel.v1.CloudChannelService.UpdateCustomer]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Customer: - Entity representing a customer of a - reseller or distributor. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCustomerRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.UpdateCustomerRequest): - request = service.UpdateCustomerRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_customer] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer.name", request.customer.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_customer(self, - request: Union[service.DeleteCustomerRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the given [Customer][google.cloud.channel.v1.Customer] - permanently. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The customer has existing entitlements. - - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] - resource found for the name in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_delete_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.DeleteCustomerRequest( - name="name_value", - ) - - # Make the request - client.delete_customer(request=request) - - Args: - request (Union[google.cloud.channel_v1.types.DeleteCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.DeleteCustomer][google.cloud.channel.v1.CloudChannelService.DeleteCustomer]. - name (str): - Required. The resource name of the - customer to delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.DeleteCustomerRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.DeleteCustomerRequest): - request = service.DeleteCustomerRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_customer] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def import_customer(self, - request: Union[service.ImportCustomerRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customers.Customer: - r"""Imports a [Customer][google.cloud.channel.v1.Customer] from the - Cloud Identity associated with the provided Cloud Identity ID or - domain before a TransferEntitlements call. If a linked Customer - already exists and overwrite_if_exists is true, it will update - that Customer's data. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - NOT_FOUND: Cloud Identity doesn't exist or was deleted. - - INVALID_ARGUMENT: Required parameters are missing, or the - auth_token is expired or invalid. - - ALREADY_EXISTS: A customer already exists and has conflicting - critical fields. Requires an overwrite. - - Return value: The [Customer][google.cloud.channel.v1.Customer]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_import_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ImportCustomerRequest( - domain="domain_value", - parent="parent_value", - overwrite_if_exists=True, - ) - - # Make the request - response = client.import_customer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ImportCustomerRequest, dict]): - The request object. Request message for - [CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Customer: - Entity representing a customer of a - reseller or distributor. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ImportCustomerRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ImportCustomerRequest): - request = service.ImportCustomerRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.import_customer] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def provision_cloud_identity(self, - request: Union[service.ProvisionCloudIdentityRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Creates a Cloud Identity for the given customer using the - customer's information, or the information provided here. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer was not found. - - ALREADY_EXISTS: The customer's primary email already exists. - Retry after changing the customer's primary contact email. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - contains an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_provision_cloud_identity(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ProvisionCloudIdentityRequest( - customer="customer_value", - ) - - # Make the request - operation = client.provision_cloud_identity(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ProvisionCloudIdentityRequest, dict]): - The request object. Request message for - [CloudChannelService.ProvisionCloudIdentity][google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Customer` Entity - representing a customer of a reseller or distributor. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ProvisionCloudIdentityRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ProvisionCloudIdentityRequest): - request = service.ProvisionCloudIdentityRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.provision_cloud_identity] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer", request.customer), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - customers.Customer, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def list_entitlements(self, - request: Union[service.ListEntitlementsRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListEntitlementsPager: - r"""Lists [Entitlement][google.cloud.channel.v1.Entitlement]s - belonging to a customer. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: A list of the customer's - [Entitlement][google.cloud.channel.v1.Entitlement]s. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_entitlements(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListEntitlementsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_entitlements(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListEntitlementsRequest, dict]): - The request object. Request message for - [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListEntitlementsPager: - Response message for - [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListEntitlementsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListEntitlementsRequest): - request = service.ListEntitlementsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_entitlements] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListEntitlementsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_transferable_skus(self, - request: Union[service.ListTransferableSkusRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListTransferableSkusPager: - r"""List [TransferableSku][google.cloud.channel.v1.TransferableSku]s - of a customer based on the Cloud Identity ID or Customer Name in - the request. - - Use this method to list the entitlements information of an - unowned customer. You should provide the customer's Cloud - Identity ID or Customer Name. - - Possible error codes: - - - PERMISSION_DENIED: - - - The customer doesn't belong to the reseller and has no - auth token. - - The supplied auth token is invalid. - - The reseller account making the request is different from - the reseller account in the query. - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: A list of the customer's - [TransferableSku][google.cloud.channel.v1.TransferableSku]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_transferable_skus(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListTransferableSkusRequest( - cloud_identity_id="cloud_identity_id_value", - parent="parent_value", - ) - - # Make the request - page_result = client.list_transferable_skus(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListTransferableSkusRequest, dict]): - The request object. Request message for - [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableSkusPager: - Response message for - [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListTransferableSkusRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListTransferableSkusRequest): - request = service.ListTransferableSkusRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_transferable_skus] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListTransferableSkusPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_transferable_offers(self, - request: Union[service.ListTransferableOffersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListTransferableOffersPager: - r"""List - [TransferableOffer][google.cloud.channel.v1.TransferableOffer]s - of a customer based on Cloud Identity ID or Customer Name in the - request. - - Use this method when a reseller gets the entitlement information - of an unowned customer. The reseller should provide the - customer's Cloud Identity ID or Customer Name. - - Possible error codes: - - - PERMISSION_DENIED: - - - The customer doesn't belong to the reseller and has no - auth token. - - The customer provided incorrect reseller information when - generating auth token. - - The reseller account making the request is different from - the reseller account in the query. - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: List of - [TransferableOffer][google.cloud.channel.v1.TransferableOffer] - for the given customer and SKU. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_transferable_offers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListTransferableOffersRequest( - cloud_identity_id="cloud_identity_id_value", - parent="parent_value", - sku="sku_value", - ) - - # Make the request - page_result = client.list_transferable_offers(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListTransferableOffersRequest, dict]): - The request object. Request message for - [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableOffersPager: - Response message for - [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListTransferableOffersRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListTransferableOffersRequest): - request = service.ListTransferableOffersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_transferable_offers] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListTransferableOffersPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_entitlement(self, - request: Union[service.GetEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> entitlements.Entitlement: - r"""Returns the requested - [Entitlement][google.cloud.channel.v1.Entitlement] resource. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer entitlement was not found. - - Return value: The requested - [Entitlement][google.cloud.channel.v1.Entitlement] resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_get_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetEntitlementRequest( - name="name_value", - ) - - # Make the request - response = client.get_entitlement(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.GetEntitlement][google.cloud.channel.v1.CloudChannelService.GetEntitlement]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Entitlement: - An entitlement is a representation of - a customer's ability to use a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.GetEntitlementRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.GetEntitlementRequest): - request = service.GetEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_entitlement] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_entitlement(self, - request: Union[service.CreateEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Creates an entitlement for a customer. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - There is already a customer entitlement for a SKU from the - same product family. - - - INVALID_VALUE: Make sure the OfferId is valid. If it is, - contact Google Channel support for further troubleshooting. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: - - - The SKU was already purchased for the customer. - - The customer's primary email already exists. Retry after - changing the customer's primary contact email. - - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The domain required for purchasing a SKU has not been - verified. - - A pre-requisite SKU required to purchase an Add-On SKU is - missing. For example, Google Workspace Business Starter is - required to purchase Vault or Drive. - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_create_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - entitlement = channel_v1.Entitlement() - entitlement.offer = "offer_value" - - request = channel_v1.CreateEntitlementRequest( - parent="parent_value", - entitlement=entitlement, - ) - - # Make the request - operation = client.create_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateEntitlement][google.cloud.channel.v1.CloudChannelService.CreateEntitlement] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateEntitlementRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.CreateEntitlementRequest): - request = service.CreateEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_entitlement] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def change_parameters(self, - request: Union[service.ChangeParametersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Change parameters of the entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. For example, the number of seats being changed is - greater than the allowed number of max seats, or decreasing - seats for a commitment based plan. - - NOT_FOUND: Entitlement resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_change_parameters(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ChangeParametersRequest( - name="name_value", - ) - - # Make the request - operation = client.change_parameters(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ChangeParametersRequest, dict]): - The request object. Request message for - [CloudChannelService.ChangeParametersRequest][]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ChangeParametersRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ChangeParametersRequest): - request = service.ChangeParametersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.change_parameters] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def change_renewal_settings(self, - request: Union[service.ChangeRenewalSettingsRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Updates the renewal settings for an existing customer - entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for - a commitment plan. Can't enable or disable renewals for - non-commitment plans. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_change_renewal_settings(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ChangeRenewalSettingsRequest( - name="name_value", - ) - - # Make the request - operation = client.change_renewal_settings(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ChangeRenewalSettingsRequest, dict]): - The request object. Request message for - [CloudChannelService.ChangeRenewalSettings][google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ChangeRenewalSettingsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ChangeRenewalSettingsRequest): - request = service.ChangeRenewalSettingsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.change_renewal_settings] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def change_offer(self, - request: Union[service.ChangeOfferRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Updates the Offer for an existing customer entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Offer or Entitlement resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_change_offer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ChangeOfferRequest( - name="name_value", - offer="offer_value", - ) - - # Make the request - operation = client.change_offer(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ChangeOfferRequest, dict]): - The request object. Request message for - [CloudChannelService.ChangeOffer][google.cloud.channel.v1.CloudChannelService.ChangeOffer]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ChangeOfferRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ChangeOfferRequest): - request = service.ChangeOfferRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.change_offer] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def start_paid_service(self, - request: Union[service.StartPaidServiceRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Starts paid service for a trial entitlement. - - Starts paid service for a trial entitlement immediately. This - method is only applicable if a plan is set up for a trial - entitlement but has some trial days remaining. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for - entitlement on trial plans. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_start_paid_service(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.StartPaidServiceRequest( - name="name_value", - ) - - # Make the request - operation = client.start_paid_service(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.StartPaidServiceRequest, dict]): - The request object. Request message for - [CloudChannelService.StartPaidService][google.cloud.channel.v1.CloudChannelService.StartPaidService]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.StartPaidServiceRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.StartPaidServiceRequest): - request = service.StartPaidServiceRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.start_paid_service] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def suspend_entitlement(self, - request: Union[service.SuspendEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Suspends a previously fulfilled entitlement. - - An entitlement suspension is a long-running operation. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - NOT_ACTIVE: Entitlement is not active. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_suspend_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.SuspendEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.suspend_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.SuspendEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.SuspendEntitlement][google.cloud.channel.v1.CloudChannelService.SuspendEntitlement]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.SuspendEntitlementRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.SuspendEntitlementRequest): - request = service.SuspendEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.suspend_entitlement] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def cancel_entitlement(self, - request: Union[service.CancelEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Cancels a previously fulfilled entitlement. - - An entitlement cancellation is a long-running operation. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - FAILED_PRECONDITION: There are Google Cloud projects linked - to the Google Cloud entitlement's Cloud Billing subaccount. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google - Workspace add-ons, or entitlements for Google Cloud's - development platform. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The response will - contain google.protobuf.Empty on success. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_cancel_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.CancelEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.cancel_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CancelEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.CancelEntitlement][google.cloud.channel.v1.CloudChannelService.CancelEntitlement]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.CancelEntitlementRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.CancelEntitlementRequest): - request = service.CancelEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.cancel_entitlement] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def activate_entitlement(self, - request: Union[service.ActivateEntitlementRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Activates a previously suspended entitlement. Entitlements - suspended for pending ToS acceptance can't be activated using - this method. - - An entitlement activation is a long-running operation and it - updates the state of the customer entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - SUSPENSION_NOT_RESELLER_INITIATED: Can only activate - reseller-initiated suspensions and entitlements that have - accepted the TOS. - - NOT_SUSPENDED: Can only activate suspended entitlements not - in an ACTIVE state. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_activate_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ActivateEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.activate_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ActivateEntitlementRequest, dict]): - The request object. Request message for - [CloudChannelService.ActivateEntitlement][google.cloud.channel.v1.CloudChannelService.ActivateEntitlement]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be - :class:`google.cloud.channel_v1.types.Entitlement` An - entitlement is a representation of a customer's ability - to use a service. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ActivateEntitlementRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ActivateEntitlementRequest): - request = service.ActivateEntitlementRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.activate_entitlement] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - entitlements.Entitlement, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def transfer_entitlements(self, - request: Union[service.TransferEntitlementsRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Transfers customer entitlements to new reseller. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: The SKU was already transferred for the - customer. - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The SKU requires domain verification to transfer, but the - domain is not verified. - - An Add-On SKU (example, Vault or Drive) is missing the - pre-requisite SKU (example, G Suite Basic). - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - Specify all transferring entitlements. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_transfer_entitlements(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - entitlements = channel_v1.Entitlement() - entitlements.offer = "offer_value" - - request = channel_v1.TransferEntitlementsRequest( - parent="parent_value", - entitlements=entitlements, - ) - - # Make the request - operation = client.transfer_entitlements(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.TransferEntitlementsRequest, dict]): - The request object. Request message for - [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.channel_v1.types.TransferEntitlementsResponse` Response message for [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. - This is put in the response field of - google.longrunning.Operation. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.TransferEntitlementsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.TransferEntitlementsRequest): - request = service.TransferEntitlementsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.transfer_entitlements] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - service.TransferEntitlementsResponse, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def transfer_entitlements_to_google(self, - request: Union[service.TransferEntitlementsToGoogleRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Transfers customer entitlements from their current reseller to - Google. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: The SKU was already transferred for the - customer. - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The SKU requires domain verification to transfer, but the - domain is not verified. - - An Add-On SKU (example, Vault or Drive) is missing the - pre-requisite SKU (example, G Suite Basic). - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The response will - contain google.protobuf.Empty on success. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_transfer_entitlements_to_google(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - entitlements = channel_v1.Entitlement() - entitlements.offer = "offer_value" - - request = channel_v1.TransferEntitlementsToGoogleRequest( - parent="parent_value", - entitlements=entitlements, - ) - - # Make the request - operation = client.transfer_entitlements_to_google(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.TransferEntitlementsToGoogleRequest, dict]): - The request object. Request message for - [CloudChannelService.TransferEntitlementsToGoogle][google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.TransferEntitlementsToGoogleRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.TransferEntitlementsToGoogleRequest): - request = service.TransferEntitlementsToGoogleRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.transfer_entitlements_to_google] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=operations.OperationMetadata, - ) - - # Done; return the response. - return response - - def list_channel_partner_links(self, - request: Union[service.ListChannelPartnerLinksRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListChannelPartnerLinksPager: - r"""List - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s - belonging to a distributor. You must be a distributor to call - this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: The list of the distributor account's - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resources. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_channel_partner_links(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListChannelPartnerLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_partner_links(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListChannelPartnerLinksRequest, dict]): - The request object. Request message for - [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerLinksPager: - Response message for - [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListChannelPartnerLinksRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListChannelPartnerLinksRequest): - request = service.ListChannelPartnerLinksRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_channel_partner_links] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListChannelPartnerLinksPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_channel_partner_link(self, - request: Union[service.GetChannelPartnerLinkRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> channel_partner_links.ChannelPartnerLink: - r"""Returns the requested - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. You must be a distributor to call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: ChannelPartnerLink resource not found because of - an invalid channel partner link name. - - Return value: The - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_get_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetChannelPartnerLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_channel_partner_link(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetChannelPartnerLinkRequest, dict]): - The request object. Request message for - [CloudChannelService.GetChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink]. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerLink: - Entity representing a link between - distributors and their indirect - resellers in an n-tier resale channel. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.GetChannelPartnerLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.GetChannelPartnerLinkRequest): - request = service.GetChannelPartnerLinkRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_channel_partner_link] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_channel_partner_link(self, - request: Union[service.CreateChannelPartnerLinkRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> channel_partner_links.ChannelPartnerLink: - r"""Initiates a channel partner link between a distributor and a - reseller, or between resellers in an n-tier reseller channel. - Invited partners need to follow the invite_link_uri provided in - the response to accept. After accepting the invitation, a link - is set up between the two parties. You must be a distributor to - call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - ALREADY_EXISTS: The ChannelPartnerLink sent in the request - already exists. - - NOT_FOUND: No Cloud Identity customer exists for provided - domain. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The new - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_create_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - channel_partner_link = channel_v1.ChannelPartnerLink() - channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" - channel_partner_link.link_state = "SUSPENDED" - - request = channel_v1.CreateChannelPartnerLinkRequest( - parent="parent_value", - channel_partner_link=channel_partner_link, - ) - - # Make the request - response = client.create_channel_partner_link(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateChannelPartnerLinkRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerLink: - Entity representing a link between - distributors and their indirect - resellers in an n-tier resale channel. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateChannelPartnerLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.CreateChannelPartnerLinkRequest): - request = service.CreateChannelPartnerLinkRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_channel_partner_link] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_channel_partner_link(self, - request: Union[service.UpdateChannelPartnerLinkRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> channel_partner_links.ChannelPartnerLink: - r"""Updates a channel partner link. Distributors call this method to - change a link's status. For example, to suspend a partner link. - You must be a distributor to call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - Link state cannot change from invited to active or - suspended. - - Cannot send reseller_cloud_identity_id, invite_url, or - name in update mask. - - - NOT_FOUND: ChannelPartnerLink resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The updated - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_update_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - channel_partner_link = channel_v1.ChannelPartnerLink() - channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" - channel_partner_link.link_state = "SUSPENDED" - - request = channel_v1.UpdateChannelPartnerLinkRequest( - name="name_value", - channel_partner_link=channel_partner_link, - ) - - # Make the request - response = client.update_channel_partner_link(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UpdateChannelPartnerLinkRequest, dict]): - The request object. Request message for - [CloudChannelService.UpdateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink] - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerLink: - Entity representing a link between - distributors and their indirect - resellers in an n-tier resale channel. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateChannelPartnerLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.UpdateChannelPartnerLinkRequest): - request = service.UpdateChannelPartnerLinkRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_channel_partner_link] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_customer_repricing_config(self, - request: Union[service.GetCustomerRepricingConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.CustomerRepricingConfig: - r"""Gets information about how a Reseller modifies their bill before - sending it to a Customer. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - was not found. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_get_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetCustomerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - response = client.get_customer_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetCustomerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.GetCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig]. - name (str): - Required. The resource name of the - CustomerRepricingConfig. Format: - accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.CustomerRepricingConfig: - Configuration for how a reseller will - reprice a Customer. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCustomerRepricingConfigRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.GetCustomerRepricingConfigRequest): - request = service.GetCustomerRepricingConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_customer_repricing_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_customer_repricing_configs(self, - request: Union[service.ListCustomerRepricingConfigsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomerRepricingConfigsPager: - r"""Lists information about how a Reseller modifies their bill - before sending it to a Customer. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resources. The data for each resource is displayed in the - ascending order of: - - - customer ID - - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] - - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - - [CustomerRepricingConfig.update_time][google.cloud.channel.v1.CustomerRepricingConfig.update_time] - - If unsuccessful, returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_customer_repricing_configs(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListCustomerRepricingConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_customer_repricing_configs(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest, dict]): - The request object. Request message for - [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. - parent (str): - Required. The resource name of the customer. Parent uses - the format: - accounts/{account_id}/customers/{customer_id}. Supports - accounts/{account_id}/customers/- to retrieve configs - for all customers. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomerRepricingConfigsPager: - Response message for - [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCustomerRepricingConfigsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListCustomerRepricingConfigsRequest): - request = service.ListCustomerRepricingConfigsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_customer_repricing_configs] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCustomerRepricingConfigsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_customer_repricing_config(self, - request: Union[service.CreateCustomerRepricingConfigRequest, dict] = None, - *, - parent: str = None, - customer_repricing_config: repricing.CustomerRepricingConfig = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.CustomerRepricingConfig: - r"""Creates a CustomerRepricingConfig. Call this method to set - modifications for a specific customer's bill. You can only - create configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. If needed, you can create a config for the - current month, with some restrictions. - - When creating a config for a future month, make sure there are - no existing configs for that - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The following restrictions are for creating configs in the - current month. - - - This functionality is reserved for recovering from an - erroneous config, and should not be used for regular business - cases. - - The new config will not modify exports used with other - configs. Changes to the config may be immediate, but may take - up to 24 hours. - - There is a limit of ten configs for any - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] - or - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The contained - [CustomerRepricingConfig.repricing_config][google.cloud.channel.v1.CustomerRepricingConfig.repricing_config] - vaule must be different from the value used in the current - config for a - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement]. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_create_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - customer_repricing_config = channel_v1.CustomerRepricingConfig() - customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.CreateCustomerRepricingConfigRequest( - parent="parent_value", - customer_repricing_config=customer_repricing_config, - ) - - # Make the request - response = client.create_customer_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateCustomerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig]. - parent (str): - Required. The resource name of the customer that will - receive this repricing config. Parent uses the format: - accounts/{account_id}/customers/{customer_id} - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - customer_repricing_config (google.cloud.channel_v1.types.CustomerRepricingConfig): - Required. The CustomerRepricingConfig - object to update. - - This corresponds to the ``customer_repricing_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.CustomerRepricingConfig: - Configuration for how a reseller will - reprice a Customer. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, customer_repricing_config]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateCustomerRepricingConfigRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.CreateCustomerRepricingConfigRequest): - request = service.CreateCustomerRepricingConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if customer_repricing_config is not None: - request.customer_repricing_config = customer_repricing_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_customer_repricing_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_customer_repricing_config(self, - request: Union[service.UpdateCustomerRepricingConfigRequest, dict] = None, - *, - customer_repricing_config: repricing.CustomerRepricingConfig = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.CustomerRepricingConfig: - r"""Updates a CustomerRepricingConfig. Call this method to set - modifications for a specific customer's bill. This method - overwrites the existing CustomerRepricingConfig. - - You can only update configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. To make changes to configs for the current - month, use - [CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig], - taking note of its restrictions. You cannot update the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - When updating a config in the future: - - - This config must already exist. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_update_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - customer_repricing_config = channel_v1.CustomerRepricingConfig() - customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.UpdateCustomerRepricingConfigRequest( - customer_repricing_config=customer_repricing_config, - ) - - # Make the request - response = client.update_customer_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UpdateCustomerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.UpdateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig]. - customer_repricing_config (google.cloud.channel_v1.types.CustomerRepricingConfig): - Required. The CustomerRepricingConfig - object to update. - - This corresponds to the ``customer_repricing_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.CustomerRepricingConfig: - Configuration for how a reseller will - reprice a Customer. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([customer_repricing_config]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCustomerRepricingConfigRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.UpdateCustomerRepricingConfigRequest): - request = service.UpdateCustomerRepricingConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if customer_repricing_config is not None: - request.customer_repricing_config = customer_repricing_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_customer_repricing_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer_repricing_config.name", request.customer_repricing_config.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_customer_repricing_config(self, - request: Union[service.DeleteCustomerRepricingConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the given - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - permanently. You can only delete configs if their - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is set to a date after the current month. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - is active or in the past. - - NOT_FOUND: No - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - found for the name in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_delete_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.DeleteCustomerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - client.delete_customer_repricing_config(request=request) - - Args: - request (Union[google.cloud.channel_v1.types.DeleteCustomerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.DeleteCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig]. - name (str): - Required. The resource name of the customer repricing - config rule to delete. Format: - accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.DeleteCustomerRepricingConfigRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.DeleteCustomerRepricingConfigRequest): - request = service.DeleteCustomerRepricingConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_customer_repricing_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def get_channel_partner_repricing_config(self, - request: Union[service.GetChannelPartnerRepricingConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.ChannelPartnerRepricingConfig: - r"""Gets information about how a Distributor modifies their bill - before sending it to a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - was not found. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_get_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetChannelPartnerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - response = client.get_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.GetChannelPartnerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.GetChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig] - name (str): - Required. The resource name of the - ChannelPartnerRepricingConfig Format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: - Configuration for how a distributor - will rebill a channel partner (also - known as a distributor-authorized - reseller). - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetChannelPartnerRepricingConfigRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.GetChannelPartnerRepricingConfigRequest): - request = service.GetChannelPartnerRepricingConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_channel_partner_repricing_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_channel_partner_repricing_configs(self, - request: Union[service.ListChannelPartnerRepricingConfigsRequest, dict] = None, - *, - parent: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListChannelPartnerRepricingConfigsPager: - r"""Lists information about how a Reseller modifies their bill - before sending it to a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resources. The data for each resource is displayed in the - ascending order of: - - - channel partner ID - - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - - [ChannelPartnerRepricingConfig.update_time][google.cloud.channel.v1.ChannelPartnerRepricingConfig.update_time] - - If unsuccessful, returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_channel_partner_repricing_configs(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListChannelPartnerRepricingConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_partner_repricing_configs(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest, dict]): - The request object. Request message for - [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. - parent (str): - Required. The resource name of the account's - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]. - Parent uses the format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id}. - Supports accounts/{account_id}/channelPartnerLinks/- to - retrieve configs for all channel partners. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerRepricingConfigsPager: - Response message for - [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListChannelPartnerRepricingConfigsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListChannelPartnerRepricingConfigsRequest): - request = service.ListChannelPartnerRepricingConfigsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_channel_partner_repricing_configs] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListChannelPartnerRepricingConfigsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_channel_partner_repricing_config(self, - request: Union[service.CreateChannelPartnerRepricingConfigRequest, dict] = None, - *, - parent: str = None, - channel_partner_repricing_config: repricing.ChannelPartnerRepricingConfig = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.ChannelPartnerRepricingConfig: - r"""Creates a ChannelPartnerRepricingConfig. Call this method to set - modifications for a specific ChannelPartner's bill. You can only - create configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. If needed, you can create a config for the - current month, with some restrictions. - - When creating a config for a future month, make sure there are - no existing configs for that - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The following restrictions are for creating configs in the - current month. - - - This functionality is reserved for recovering from an - erroneous config, and should not be used for regular business - cases. - - The new config will not modify exports used with other - configs. Changes to the config may be immediate, but may take - up to 24 hours. - - There is a limit of ten configs for any ChannelPartner or - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The contained - [ChannelPartnerRepricingConfig.repricing_config][google.cloud.channel.v1.ChannelPartnerRepricingConfig.repricing_config] - vaule must be different from the value used in the current - config for a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_create_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() - channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.CreateChannelPartnerRepricingConfigRequest( - parent="parent_value", - channel_partner_repricing_config=channel_partner_repricing_config, - ) - - # Make the request - response = client.create_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.CreateChannelPartnerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig]. - parent (str): - Required. The resource name of the ChannelPartner that - will receive the repricing config. Parent uses the - format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id} - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - channel_partner_repricing_config (google.cloud.channel_v1.types.ChannelPartnerRepricingConfig): - Required. The - ChannelPartnerRepricingConfig object to - update. - - This corresponds to the ``channel_partner_repricing_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: - Configuration for how a distributor - will rebill a channel partner (also - known as a distributor-authorized - reseller). - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, channel_partner_repricing_config]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateChannelPartnerRepricingConfigRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.CreateChannelPartnerRepricingConfigRequest): - request = service.CreateChannelPartnerRepricingConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if channel_partner_repricing_config is not None: - request.channel_partner_repricing_config = channel_partner_repricing_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_channel_partner_repricing_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_channel_partner_repricing_config(self, - request: Union[service.UpdateChannelPartnerRepricingConfigRequest, dict] = None, - *, - channel_partner_repricing_config: repricing.ChannelPartnerRepricingConfig = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> repricing.ChannelPartnerRepricingConfig: - r"""Updates a ChannelPartnerRepricingConfig. Call this method to set - modifications for a specific ChannelPartner's bill. This method - overwrites the existing CustomerRepricingConfig. - - You can only update configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. To make changes to configs for the current - month, use - [CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig], - taking note of its restrictions. You cannot update the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - When updating a config in the future: - - - This config must already exist. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_update_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() - channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.UpdateChannelPartnerRepricingConfigRequest( - channel_partner_repricing_config=channel_partner_repricing_config, - ) - - # Make the request - response = client.update_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UpdateChannelPartnerRepricingConfigRequest, dict]): - The request object. Request message for - [CloudChannelService.UpdateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig]. - channel_partner_repricing_config (google.cloud.channel_v1.types.ChannelPartnerRepricingConfig): - Required. The - ChannelPartnerRepricingConfig object to - update. - - This corresponds to the ``channel_partner_repricing_config`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.ChannelPartnerRepricingConfig: - Configuration for how a distributor - will rebill a channel partner (also - known as a distributor-authorized - reseller). - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([channel_partner_repricing_config]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateChannelPartnerRepricingConfigRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.UpdateChannelPartnerRepricingConfigRequest): - request = service.UpdateChannelPartnerRepricingConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if channel_partner_repricing_config is not None: - request.channel_partner_repricing_config = channel_partner_repricing_config - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_channel_partner_repricing_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("channel_partner_repricing_config.name", request.channel_partner_repricing_config.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_channel_partner_repricing_config(self, - request: Union[service.DeleteChannelPartnerRepricingConfigRequest, dict] = None, - *, - name: str = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes the given - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - permanently. You can only delete configs if their - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is set to a date after the current month. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - is active or in the past. - - NOT_FOUND: No - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - found for the name in the request. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_delete_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.DeleteChannelPartnerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - client.delete_channel_partner_repricing_config(request=request) - - Args: - request (Union[google.cloud.channel_v1.types.DeleteChannelPartnerRepricingConfigRequest, dict]): - The request object. Request message for - DeleteChannelPartnerRepricingConfig. - name (str): - Required. The resource name of the - channel partner repricing config rule to - delete. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.DeleteChannelPartnerRepricingConfigRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.DeleteChannelPartnerRepricingConfigRequest): - request = service.DeleteChannelPartnerRepricingConfigRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_channel_partner_repricing_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def lookup_offer(self, - request: Union[service.LookupOfferRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> offers.Offer: - r"""Returns the requested [Offer][google.cloud.channel.v1.Offer] - resource. - - Possible error codes: - - - PERMISSION_DENIED: The entitlement doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement or offer was not found. - - Return value: The [Offer][google.cloud.channel.v1.Offer] - resource. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_lookup_offer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.LookupOfferRequest( - entitlement="entitlement_value", - ) - - # Make the request - response = client.lookup_offer(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.LookupOfferRequest, dict]): - The request object. Request message for LookupOffer. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.Offer: - Represents an offer made to resellers for purchase. - An offer is associated with a - [Sku][google.cloud.channel.v1.Sku], has a plan for - payment, a price, and defines the constraints for - buying. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.LookupOfferRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.LookupOfferRequest): - request = service.LookupOfferRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.lookup_offer] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("entitlement", request.entitlement), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_products(self, - request: Union[service.ListProductsRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListProductsPager: - r"""Lists the Products the reseller is authorized to sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_products(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListProductsRequest( - account="account_value", - ) - - # Make the request - page_result = client.list_products(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListProductsRequest, dict]): - The request object. Request message for ListProducts. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListProductsPager: - Response message for ListProducts. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListProductsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListProductsRequest): - request = service.ListProductsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_products] - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListProductsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_skus(self, - request: Union[service.ListSkusRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListSkusPager: - r"""Lists the SKUs for a product the reseller is authorized to sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_skus(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListSkusRequest( - parent="parent_value", - account="account_value", - ) - - # Make the request - page_result = client.list_skus(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListSkusRequest, dict]): - The request object. Request message for ListSkus. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSkusPager: - Response message for ListSkus. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListSkusRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListSkusRequest): - request = service.ListSkusRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_skus] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListSkusPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_offers(self, - request: Union[service.ListOffersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListOffersPager: - r"""Lists the Offers the reseller can sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_offers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListOffersRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_offers(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListOffersRequest, dict]): - The request object. Request message for ListOffers. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListOffersPager: - Response message for ListOffers. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListOffersRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListOffersRequest): - request = service.ListOffersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_offers] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListOffersPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_purchasable_skus(self, - request: Union[service.ListPurchasableSkusRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListPurchasableSkusPager: - r"""Lists the following: - - - SKUs that you can purchase for a customer - - SKUs that you can upgrade or downgrade for an entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_purchasable_skus(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() - create_entitlement_purchase.product = "product_value" - - request = channel_v1.ListPurchasableSkusRequest( - create_entitlement_purchase=create_entitlement_purchase, - customer="customer_value", - ) - - # Make the request - page_result = client.list_purchasable_skus(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListPurchasableSkusRequest, dict]): - The request object. Request message for - ListPurchasableSkus. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableSkusPager: - Response message for - ListPurchasableSkus. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListPurchasableSkusRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListPurchasableSkusRequest): - request = service.ListPurchasableSkusRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_purchasable_skus] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer", request.customer), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListPurchasableSkusPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_purchasable_offers(self, - request: Union[service.ListPurchasableOffersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListPurchasableOffersPager: - r"""Lists the following: - - - Offers that you can purchase for a customer. - - Offers that you can change for an entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_purchasable_offers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() - create_entitlement_purchase.sku = "sku_value" - - request = channel_v1.ListPurchasableOffersRequest( - create_entitlement_purchase=create_entitlement_purchase, - customer="customer_value", - ) - - # Make the request - page_result = client.list_purchasable_offers(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListPurchasableOffersRequest, dict]): - The request object. Request message for - ListPurchasableOffers. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableOffersPager: - Response message for - ListPurchasableOffers. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListPurchasableOffersRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListPurchasableOffersRequest): - request = service.ListPurchasableOffersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_purchasable_offers] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("customer", request.customer), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListPurchasableOffersPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def register_subscriber(self, - request: Union[service.RegisterSubscriberRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.RegisterSubscriberResponse: - r"""Registers a service account with subscriber privileges on the - Cloud Pub/Sub topic for this Channel Services account. After you - create a subscriber, you get the events through - [SubscriberEvent][google.cloud.channel.v1.SubscriberEvent] - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The topic name with the registered service email - address. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_register_subscriber(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.RegisterSubscriberRequest( - account="account_value", - service_account="service_account_value", - ) - - # Make the request - response = client.register_subscriber(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.RegisterSubscriberRequest, dict]): - The request object. Request Message for - RegisterSubscriber. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.RegisterSubscriberResponse: - Response Message for - RegisterSubscriber. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.RegisterSubscriberRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.RegisterSubscriberRequest): - request = service.RegisterSubscriberRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.register_subscriber] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("account", request.account), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def unregister_subscriber(self, - request: Union[service.UnregisterSubscriberRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.UnregisterSubscriberResponse: - r"""Unregisters a service account with subscriber privileges on the - Cloud Pub/Sub topic created for this Channel Services account. - If there are no service accounts left with subscriber - privileges, this deletes the topic. You can call ListSubscribers - to check for these accounts. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The topic resource doesn't exist. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The topic name that unregistered the service email - address. Returns a success response if the service email address - wasn't registered with the topic. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_unregister_subscriber(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.UnregisterSubscriberRequest( - account="account_value", - service_account="service_account_value", - ) - - # Make the request - response = client.unregister_subscriber(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.UnregisterSubscriberRequest, dict]): - The request object. Request Message for - UnregisterSubscriber. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.types.UnregisterSubscriberResponse: - Response Message for - UnregisterSubscriber. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.UnregisterSubscriberRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.UnregisterSubscriberRequest): - request = service.UnregisterSubscriberRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.unregister_subscriber] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("account", request.account), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_subscribers(self, - request: Union[service.ListSubscribersRequest, dict] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListSubscribersPager: - r"""Lists service accounts with subscriber privileges on the Cloud - Pub/Sub topic created for this Channel Services account. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The topic resource doesn't exist. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: A list of service email addresses. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import channel_v1 - - def sample_list_subscribers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListSubscribersRequest( - account="account_value", - ) - - # Make the request - page_result = client.list_subscribers(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.channel_v1.types.ListSubscribersRequest, dict]): - The request object. Request Message for ListSubscribers. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSubscribersPager: - Response Message for ListSubscribers. - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a service.ListSubscribersRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, service.ListSubscribersRequest): - request = service.ListSubscribersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_subscribers] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("account", request.account), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListSubscribersPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def __enter__(self): - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - def list_operations( - self, - request: operations_pb2.ListOperationsRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.ListOperationsResponse: - r"""Lists operations that match the specified filter in the request. - - Args: - request (:class:`~.operations_pb2.ListOperationsRequest`): - The request object. Request message for - `ListOperations` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.ListOperationsResponse: - Response message for ``ListOperations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.ListOperationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.list_operations, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def get_operation( - self, - request: operations_pb2.GetOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operations_pb2.Operation: - r"""Gets the latest state of a long-running operation. - - Args: - request (:class:`~.operations_pb2.GetOperationRequest`): - The request object. Request message for - `GetOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - ~.operations_pb2.Operation: - An ``Operation`` object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.GetOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.get_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - def delete_operation( - self, - request: operations_pb2.DeleteOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a long-running operation. - - This method indicates that the client is no longer interested - in the operation result. It does not cancel the operation. - If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.DeleteOperationRequest`): - The request object. Request message for - `DeleteOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.DeleteOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.delete_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - def cancel_operation( - self, - request: operations_pb2.CancelOperationRequest = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Starts asynchronous cancellation on a long-running operation. - - The server makes a best effort to cancel the operation, but success - is not guaranteed. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - - Args: - request (:class:`~.operations_pb2.CancelOperationRequest`): - The request object. Request message for - `CancelOperation` method. - retry (google.api_core.retry.Retry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - Returns: - None - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = operations_pb2.CancelOperationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method.wrap_method( - self._transport.cancel_operation, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Send the request. - rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - - - - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-channel", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -__all__ = ( - "CloudChannelServiceClient", -) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/pagers.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/pagers.py deleted file mode 100644 index a9d06f9..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/pagers.py +++ /dev/null @@ -1,1597 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator - -from google.cloud.channel_v1.types import channel_partner_links -from google.cloud.channel_v1.types import customers -from google.cloud.channel_v1.types import entitlements -from google.cloud.channel_v1.types import offers -from google.cloud.channel_v1.types import products -from google.cloud.channel_v1.types import repricing -from google.cloud.channel_v1.types import service - - -class ListCustomersPager: - """A pager for iterating through ``list_customers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListCustomersResponse` object, and - provides an ``__iter__`` method to iterate through its - ``customers`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCustomers`` requests and continue to iterate - through the ``customers`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListCustomersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCustomersResponse], - request: service.ListCustomersRequest, - response: service.ListCustomersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListCustomersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListCustomersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCustomersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCustomersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[customers.Customer]: - for page in self.pages: - yield from page.customers - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCustomersAsyncPager: - """A pager for iterating through ``list_customers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListCustomersResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``customers`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCustomers`` requests and continue to iterate - through the ``customers`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListCustomersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCustomersResponse]], - request: service.ListCustomersRequest, - response: service.ListCustomersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListCustomersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListCustomersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCustomersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCustomersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[customers.Customer]: - async def async_generator(): - async for page in self.pages: - for response in page.customers: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListEntitlementsPager: - """A pager for iterating through ``list_entitlements`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListEntitlementsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``entitlements`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListEntitlements`` requests and continue to iterate - through the ``entitlements`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListEntitlementsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListEntitlementsResponse], - request: service.ListEntitlementsRequest, - response: service.ListEntitlementsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListEntitlementsRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListEntitlementsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListEntitlementsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListEntitlementsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[entitlements.Entitlement]: - for page in self.pages: - yield from page.entitlements - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListEntitlementsAsyncPager: - """A pager for iterating through ``list_entitlements`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListEntitlementsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``entitlements`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListEntitlements`` requests and continue to iterate - through the ``entitlements`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListEntitlementsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListEntitlementsResponse]], - request: service.ListEntitlementsRequest, - response: service.ListEntitlementsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListEntitlementsRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListEntitlementsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListEntitlementsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListEntitlementsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[entitlements.Entitlement]: - async def async_generator(): - async for page in self.pages: - for response in page.entitlements: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListTransferableSkusPager: - """A pager for iterating through ``list_transferable_skus`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListTransferableSkusResponse` object, and - provides an ``__iter__`` method to iterate through its - ``transferable_skus`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListTransferableSkus`` requests and continue to iterate - through the ``transferable_skus`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListTransferableSkusResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListTransferableSkusResponse], - request: service.ListTransferableSkusRequest, - response: service.ListTransferableSkusResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListTransferableSkusRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListTransferableSkusResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListTransferableSkusRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListTransferableSkusResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[entitlements.TransferableSku]: - for page in self.pages: - yield from page.transferable_skus - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListTransferableSkusAsyncPager: - """A pager for iterating through ``list_transferable_skus`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListTransferableSkusResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``transferable_skus`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListTransferableSkus`` requests and continue to iterate - through the ``transferable_skus`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListTransferableSkusResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListTransferableSkusResponse]], - request: service.ListTransferableSkusRequest, - response: service.ListTransferableSkusResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListTransferableSkusRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListTransferableSkusResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListTransferableSkusRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListTransferableSkusResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[entitlements.TransferableSku]: - async def async_generator(): - async for page in self.pages: - for response in page.transferable_skus: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListTransferableOffersPager: - """A pager for iterating through ``list_transferable_offers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListTransferableOffersResponse` object, and - provides an ``__iter__`` method to iterate through its - ``transferable_offers`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListTransferableOffers`` requests and continue to iterate - through the ``transferable_offers`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListTransferableOffersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListTransferableOffersResponse], - request: service.ListTransferableOffersRequest, - response: service.ListTransferableOffersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListTransferableOffersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListTransferableOffersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListTransferableOffersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListTransferableOffersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[service.TransferableOffer]: - for page in self.pages: - yield from page.transferable_offers - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListTransferableOffersAsyncPager: - """A pager for iterating through ``list_transferable_offers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListTransferableOffersResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``transferable_offers`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListTransferableOffers`` requests and continue to iterate - through the ``transferable_offers`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListTransferableOffersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListTransferableOffersResponse]], - request: service.ListTransferableOffersRequest, - response: service.ListTransferableOffersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListTransferableOffersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListTransferableOffersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListTransferableOffersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListTransferableOffersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[service.TransferableOffer]: - async def async_generator(): - async for page in self.pages: - for response in page.transferable_offers: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListChannelPartnerLinksPager: - """A pager for iterating through ``list_channel_partner_links`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListChannelPartnerLinksResponse` object, and - provides an ``__iter__`` method to iterate through its - ``channel_partner_links`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListChannelPartnerLinks`` requests and continue to iterate - through the ``channel_partner_links`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListChannelPartnerLinksResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListChannelPartnerLinksResponse], - request: service.ListChannelPartnerLinksRequest, - response: service.ListChannelPartnerLinksResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListChannelPartnerLinksRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListChannelPartnerLinksResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListChannelPartnerLinksRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListChannelPartnerLinksResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[channel_partner_links.ChannelPartnerLink]: - for page in self.pages: - yield from page.channel_partner_links - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListChannelPartnerLinksAsyncPager: - """A pager for iterating through ``list_channel_partner_links`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListChannelPartnerLinksResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``channel_partner_links`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListChannelPartnerLinks`` requests and continue to iterate - through the ``channel_partner_links`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListChannelPartnerLinksResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListChannelPartnerLinksResponse]], - request: service.ListChannelPartnerLinksRequest, - response: service.ListChannelPartnerLinksResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListChannelPartnerLinksRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListChannelPartnerLinksResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListChannelPartnerLinksRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListChannelPartnerLinksResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[channel_partner_links.ChannelPartnerLink]: - async def async_generator(): - async for page in self.pages: - for response in page.channel_partner_links: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCustomerRepricingConfigsPager: - """A pager for iterating through ``list_customer_repricing_configs`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``customer_repricing_configs`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCustomerRepricingConfigs`` requests and continue to iterate - through the ``customer_repricing_configs`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCustomerRepricingConfigsResponse], - request: service.ListCustomerRepricingConfigsRequest, - response: service.ListCustomerRepricingConfigsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCustomerRepricingConfigsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCustomerRepricingConfigsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[repricing.CustomerRepricingConfig]: - for page in self.pages: - yield from page.customer_repricing_configs - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCustomerRepricingConfigsAsyncPager: - """A pager for iterating through ``list_customer_repricing_configs`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``customer_repricing_configs`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCustomerRepricingConfigs`` requests and continue to iterate - through the ``customer_repricing_configs`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCustomerRepricingConfigsResponse]], - request: service.ListCustomerRepricingConfigsRequest, - response: service.ListCustomerRepricingConfigsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListCustomerRepricingConfigsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCustomerRepricingConfigsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCustomerRepricingConfigsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[repricing.CustomerRepricingConfig]: - async def async_generator(): - async for page in self.pages: - for response in page.customer_repricing_configs: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListChannelPartnerRepricingConfigsPager: - """A pager for iterating through ``list_channel_partner_repricing_configs`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``channel_partner_repricing_configs`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListChannelPartnerRepricingConfigs`` requests and continue to iterate - through the ``channel_partner_repricing_configs`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListChannelPartnerRepricingConfigsResponse], - request: service.ListChannelPartnerRepricingConfigsRequest, - response: service.ListChannelPartnerRepricingConfigsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListChannelPartnerRepricingConfigsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListChannelPartnerRepricingConfigsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[repricing.ChannelPartnerRepricingConfig]: - for page in self.pages: - yield from page.channel_partner_repricing_configs - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListChannelPartnerRepricingConfigsAsyncPager: - """A pager for iterating through ``list_channel_partner_repricing_configs`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``channel_partner_repricing_configs`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListChannelPartnerRepricingConfigs`` requests and continue to iterate - through the ``channel_partner_repricing_configs`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListChannelPartnerRepricingConfigsResponse]], - request: service.ListChannelPartnerRepricingConfigsRequest, - response: service.ListChannelPartnerRepricingConfigsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListChannelPartnerRepricingConfigsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListChannelPartnerRepricingConfigsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[repricing.ChannelPartnerRepricingConfig]: - async def async_generator(): - async for page in self.pages: - for response in page.channel_partner_repricing_configs: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListProductsPager: - """A pager for iterating through ``list_products`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListProductsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``products`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListProducts`` requests and continue to iterate - through the ``products`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListProductsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListProductsResponse], - request: service.ListProductsRequest, - response: service.ListProductsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListProductsRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListProductsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListProductsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListProductsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[products.Product]: - for page in self.pages: - yield from page.products - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListProductsAsyncPager: - """A pager for iterating through ``list_products`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListProductsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``products`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListProducts`` requests and continue to iterate - through the ``products`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListProductsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListProductsResponse]], - request: service.ListProductsRequest, - response: service.ListProductsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListProductsRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListProductsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListProductsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListProductsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[products.Product]: - async def async_generator(): - async for page in self.pages: - for response in page.products: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListSkusPager: - """A pager for iterating through ``list_skus`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListSkusResponse` object, and - provides an ``__iter__`` method to iterate through its - ``skus`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListSkus`` requests and continue to iterate - through the ``skus`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListSkusResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListSkusResponse], - request: service.ListSkusRequest, - response: service.ListSkusResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListSkusRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListSkusResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListSkusRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListSkusResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[products.Sku]: - for page in self.pages: - yield from page.skus - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListSkusAsyncPager: - """A pager for iterating through ``list_skus`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListSkusResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``skus`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListSkus`` requests and continue to iterate - through the ``skus`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListSkusResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListSkusResponse]], - request: service.ListSkusRequest, - response: service.ListSkusResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListSkusRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListSkusResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListSkusRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListSkusResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[products.Sku]: - async def async_generator(): - async for page in self.pages: - for response in page.skus: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListOffersPager: - """A pager for iterating through ``list_offers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListOffersResponse` object, and - provides an ``__iter__`` method to iterate through its - ``offers`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListOffers`` requests and continue to iterate - through the ``offers`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListOffersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListOffersResponse], - request: service.ListOffersRequest, - response: service.ListOffersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListOffersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListOffersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListOffersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListOffersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[offers.Offer]: - for page in self.pages: - yield from page.offers - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListOffersAsyncPager: - """A pager for iterating through ``list_offers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListOffersResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``offers`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListOffers`` requests and continue to iterate - through the ``offers`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListOffersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListOffersResponse]], - request: service.ListOffersRequest, - response: service.ListOffersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListOffersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListOffersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListOffersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListOffersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[offers.Offer]: - async def async_generator(): - async for page in self.pages: - for response in page.offers: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListPurchasableSkusPager: - """A pager for iterating through ``list_purchasable_skus`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListPurchasableSkusResponse` object, and - provides an ``__iter__`` method to iterate through its - ``purchasable_skus`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListPurchasableSkus`` requests and continue to iterate - through the ``purchasable_skus`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListPurchasableSkusResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListPurchasableSkusResponse], - request: service.ListPurchasableSkusRequest, - response: service.ListPurchasableSkusResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListPurchasableSkusRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListPurchasableSkusResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListPurchasableSkusRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListPurchasableSkusResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[service.PurchasableSku]: - for page in self.pages: - yield from page.purchasable_skus - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListPurchasableSkusAsyncPager: - """A pager for iterating through ``list_purchasable_skus`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListPurchasableSkusResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``purchasable_skus`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListPurchasableSkus`` requests and continue to iterate - through the ``purchasable_skus`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListPurchasableSkusResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListPurchasableSkusResponse]], - request: service.ListPurchasableSkusRequest, - response: service.ListPurchasableSkusResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListPurchasableSkusRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListPurchasableSkusResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListPurchasableSkusRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListPurchasableSkusResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[service.PurchasableSku]: - async def async_generator(): - async for page in self.pages: - for response in page.purchasable_skus: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListPurchasableOffersPager: - """A pager for iterating through ``list_purchasable_offers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListPurchasableOffersResponse` object, and - provides an ``__iter__`` method to iterate through its - ``purchasable_offers`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListPurchasableOffers`` requests and continue to iterate - through the ``purchasable_offers`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListPurchasableOffersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListPurchasableOffersResponse], - request: service.ListPurchasableOffersRequest, - response: service.ListPurchasableOffersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListPurchasableOffersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListPurchasableOffersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListPurchasableOffersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListPurchasableOffersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[service.PurchasableOffer]: - for page in self.pages: - yield from page.purchasable_offers - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListPurchasableOffersAsyncPager: - """A pager for iterating through ``list_purchasable_offers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListPurchasableOffersResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``purchasable_offers`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListPurchasableOffers`` requests and continue to iterate - through the ``purchasable_offers`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListPurchasableOffersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListPurchasableOffersResponse]], - request: service.ListPurchasableOffersRequest, - response: service.ListPurchasableOffersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListPurchasableOffersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListPurchasableOffersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListPurchasableOffersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListPurchasableOffersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[service.PurchasableOffer]: - async def async_generator(): - async for page in self.pages: - for response in page.purchasable_offers: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListSubscribersPager: - """A pager for iterating through ``list_subscribers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListSubscribersResponse` object, and - provides an ``__iter__`` method to iterate through its - ``service_accounts`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListSubscribers`` requests and continue to iterate - through the ``service_accounts`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListSubscribersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListSubscribersResponse], - request: service.ListSubscribersRequest, - response: service.ListSubscribersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListSubscribersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListSubscribersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListSubscribersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListSubscribersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[str]: - for page in self.pages: - yield from page.service_accounts - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListSubscribersAsyncPager: - """A pager for iterating through ``list_subscribers`` requests. - - This class thinly wraps an initial - :class:`google.cloud.channel_v1.types.ListSubscribersResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``service_accounts`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListSubscribers`` requests and continue to iterate - through the ``service_accounts`` field on the - corresponding responses. - - All the usual :class:`google.cloud.channel_v1.types.ListSubscribersResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListSubscribersResponse]], - request: service.ListSubscribersRequest, - response: service.ListSubscribersResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.channel_v1.types.ListSubscribersRequest): - The initial request object. - response (google.cloud.channel_v1.types.ListSubscribersResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListSubscribersRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListSubscribersResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[str]: - async def async_generator(): - async for page in self.pages: - for response in page.service_accounts: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/__init__.py deleted file mode 100644 index eb57bb2..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import CloudChannelServiceTransport -from .grpc import CloudChannelServiceGrpcTransport -from .grpc_asyncio import CloudChannelServiceGrpcAsyncIOTransport - - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[CloudChannelServiceTransport]] -_transport_registry['grpc'] = CloudChannelServiceGrpcTransport -_transport_registry['grpc_asyncio'] = CloudChannelServiceGrpcAsyncIOTransport - -__all__ = ( - 'CloudChannelServiceTransport', - 'CloudChannelServiceGrpcTransport', - 'CloudChannelServiceGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py deleted file mode 100644 index f0ea07d..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py +++ /dev/null @@ -1,820 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources - -import google.auth # type: ignore -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.channel_v1.types import channel_partner_links -from google.cloud.channel_v1.types import customers -from google.cloud.channel_v1.types import entitlements -from google.cloud.channel_v1.types import offers -from google.cloud.channel_v1.types import repricing -from google.cloud.channel_v1.types import service -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - 'google-cloud-channel', - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CloudChannelServiceTransport(abc.ABC): - """Abstract transport class for CloudChannelService.""" - - AUTH_SCOPES = ( - 'https://www.googleapis.com/auth/apps.order', - ) - - DEFAULT_HOST: str = 'cloudchannel.googleapis.com' - def __init__( - self, *, - host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A list of scopes. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, - **scopes_kwargs, - quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience(api_audience if api_audience else host) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ':' not in host: - host += ':443' - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.list_customers: gapic_v1.method.wrap_method( - self.list_customers, - default_timeout=None, - client_info=client_info, - ), - self.get_customer: gapic_v1.method.wrap_method( - self.get_customer, - default_timeout=None, - client_info=client_info, - ), - self.check_cloud_identity_accounts_exist: gapic_v1.method.wrap_method( - self.check_cloud_identity_accounts_exist, - default_timeout=None, - client_info=client_info, - ), - self.create_customer: gapic_v1.method.wrap_method( - self.create_customer, - default_timeout=None, - client_info=client_info, - ), - self.update_customer: gapic_v1.method.wrap_method( - self.update_customer, - default_timeout=None, - client_info=client_info, - ), - self.delete_customer: gapic_v1.method.wrap_method( - self.delete_customer, - default_timeout=None, - client_info=client_info, - ), - self.import_customer: gapic_v1.method.wrap_method( - self.import_customer, - default_timeout=None, - client_info=client_info, - ), - self.provision_cloud_identity: gapic_v1.method.wrap_method( - self.provision_cloud_identity, - default_timeout=60.0, - client_info=client_info, - ), - self.list_entitlements: gapic_v1.method.wrap_method( - self.list_entitlements, - default_timeout=None, - client_info=client_info, - ), - self.list_transferable_skus: gapic_v1.method.wrap_method( - self.list_transferable_skus, - default_timeout=None, - client_info=client_info, - ), - self.list_transferable_offers: gapic_v1.method.wrap_method( - self.list_transferable_offers, - default_timeout=None, - client_info=client_info, - ), - self.get_entitlement: gapic_v1.method.wrap_method( - self.get_entitlement, - default_timeout=None, - client_info=client_info, - ), - self.create_entitlement: gapic_v1.method.wrap_method( - self.create_entitlement, - default_timeout=60.0, - client_info=client_info, - ), - self.change_parameters: gapic_v1.method.wrap_method( - self.change_parameters, - default_timeout=60.0, - client_info=client_info, - ), - self.change_renewal_settings: gapic_v1.method.wrap_method( - self.change_renewal_settings, - default_timeout=60.0, - client_info=client_info, - ), - self.change_offer: gapic_v1.method.wrap_method( - self.change_offer, - default_timeout=60.0, - client_info=client_info, - ), - self.start_paid_service: gapic_v1.method.wrap_method( - self.start_paid_service, - default_timeout=60.0, - client_info=client_info, - ), - self.suspend_entitlement: gapic_v1.method.wrap_method( - self.suspend_entitlement, - default_timeout=60.0, - client_info=client_info, - ), - self.cancel_entitlement: gapic_v1.method.wrap_method( - self.cancel_entitlement, - default_timeout=60.0, - client_info=client_info, - ), - self.activate_entitlement: gapic_v1.method.wrap_method( - self.activate_entitlement, - default_timeout=60.0, - client_info=client_info, - ), - self.transfer_entitlements: gapic_v1.method.wrap_method( - self.transfer_entitlements, - default_timeout=60.0, - client_info=client_info, - ), - self.transfer_entitlements_to_google: gapic_v1.method.wrap_method( - self.transfer_entitlements_to_google, - default_timeout=60.0, - client_info=client_info, - ), - self.list_channel_partner_links: gapic_v1.method.wrap_method( - self.list_channel_partner_links, - default_timeout=None, - client_info=client_info, - ), - self.get_channel_partner_link: gapic_v1.method.wrap_method( - self.get_channel_partner_link, - default_timeout=None, - client_info=client_info, - ), - self.create_channel_partner_link: gapic_v1.method.wrap_method( - self.create_channel_partner_link, - default_timeout=None, - client_info=client_info, - ), - self.update_channel_partner_link: gapic_v1.method.wrap_method( - self.update_channel_partner_link, - default_timeout=None, - client_info=client_info, - ), - self.get_customer_repricing_config: gapic_v1.method.wrap_method( - self.get_customer_repricing_config, - default_timeout=None, - client_info=client_info, - ), - self.list_customer_repricing_configs: gapic_v1.method.wrap_method( - self.list_customer_repricing_configs, - default_timeout=None, - client_info=client_info, - ), - self.create_customer_repricing_config: gapic_v1.method.wrap_method( - self.create_customer_repricing_config, - default_timeout=None, - client_info=client_info, - ), - self.update_customer_repricing_config: gapic_v1.method.wrap_method( - self.update_customer_repricing_config, - default_timeout=None, - client_info=client_info, - ), - self.delete_customer_repricing_config: gapic_v1.method.wrap_method( - self.delete_customer_repricing_config, - default_timeout=None, - client_info=client_info, - ), - self.get_channel_partner_repricing_config: gapic_v1.method.wrap_method( - self.get_channel_partner_repricing_config, - default_timeout=None, - client_info=client_info, - ), - self.list_channel_partner_repricing_configs: gapic_v1.method.wrap_method( - self.list_channel_partner_repricing_configs, - default_timeout=None, - client_info=client_info, - ), - self.create_channel_partner_repricing_config: gapic_v1.method.wrap_method( - self.create_channel_partner_repricing_config, - default_timeout=None, - client_info=client_info, - ), - self.update_channel_partner_repricing_config: gapic_v1.method.wrap_method( - self.update_channel_partner_repricing_config, - default_timeout=None, - client_info=client_info, - ), - self.delete_channel_partner_repricing_config: gapic_v1.method.wrap_method( - self.delete_channel_partner_repricing_config, - default_timeout=None, - client_info=client_info, - ), - self.lookup_offer: gapic_v1.method.wrap_method( - self.lookup_offer, - default_timeout=None, - client_info=client_info, - ), - self.list_products: gapic_v1.method.wrap_method( - self.list_products, - default_timeout=None, - client_info=client_info, - ), - self.list_skus: gapic_v1.method.wrap_method( - self.list_skus, - default_timeout=None, - client_info=client_info, - ), - self.list_offers: gapic_v1.method.wrap_method( - self.list_offers, - default_timeout=None, - client_info=client_info, - ), - self.list_purchasable_skus: gapic_v1.method.wrap_method( - self.list_purchasable_skus, - default_timeout=None, - client_info=client_info, - ), - self.list_purchasable_offers: gapic_v1.method.wrap_method( - self.list_purchasable_offers, - default_timeout=None, - client_info=client_info, - ), - self.register_subscriber: gapic_v1.method.wrap_method( - self.register_subscriber, - default_timeout=None, - client_info=client_info, - ), - self.unregister_subscriber: gapic_v1.method.wrap_method( - self.unregister_subscriber, - default_timeout=None, - client_info=client_info, - ), - self.list_subscribers: gapic_v1.method.wrap_method( - self.list_subscribers, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def list_customers(self) -> Callable[ - [service.ListCustomersRequest], - Union[ - service.ListCustomersResponse, - Awaitable[service.ListCustomersResponse] - ]]: - raise NotImplementedError() - - @property - def get_customer(self) -> Callable[ - [service.GetCustomerRequest], - Union[ - customers.Customer, - Awaitable[customers.Customer] - ]]: - raise NotImplementedError() - - @property - def check_cloud_identity_accounts_exist(self) -> Callable[ - [service.CheckCloudIdentityAccountsExistRequest], - Union[ - service.CheckCloudIdentityAccountsExistResponse, - Awaitable[service.CheckCloudIdentityAccountsExistResponse] - ]]: - raise NotImplementedError() - - @property - def create_customer(self) -> Callable[ - [service.CreateCustomerRequest], - Union[ - customers.Customer, - Awaitable[customers.Customer] - ]]: - raise NotImplementedError() - - @property - def update_customer(self) -> Callable[ - [service.UpdateCustomerRequest], - Union[ - customers.Customer, - Awaitable[customers.Customer] - ]]: - raise NotImplementedError() - - @property - def delete_customer(self) -> Callable[ - [service.DeleteCustomerRequest], - Union[ - empty_pb2.Empty, - Awaitable[empty_pb2.Empty] - ]]: - raise NotImplementedError() - - @property - def import_customer(self) -> Callable[ - [service.ImportCustomerRequest], - Union[ - customers.Customer, - Awaitable[customers.Customer] - ]]: - raise NotImplementedError() - - @property - def provision_cloud_identity(self) -> Callable[ - [service.ProvisionCloudIdentityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def list_entitlements(self) -> Callable[ - [service.ListEntitlementsRequest], - Union[ - service.ListEntitlementsResponse, - Awaitable[service.ListEntitlementsResponse] - ]]: - raise NotImplementedError() - - @property - def list_transferable_skus(self) -> Callable[ - [service.ListTransferableSkusRequest], - Union[ - service.ListTransferableSkusResponse, - Awaitable[service.ListTransferableSkusResponse] - ]]: - raise NotImplementedError() - - @property - def list_transferable_offers(self) -> Callable[ - [service.ListTransferableOffersRequest], - Union[ - service.ListTransferableOffersResponse, - Awaitable[service.ListTransferableOffersResponse] - ]]: - raise NotImplementedError() - - @property - def get_entitlement(self) -> Callable[ - [service.GetEntitlementRequest], - Union[ - entitlements.Entitlement, - Awaitable[entitlements.Entitlement] - ]]: - raise NotImplementedError() - - @property - def create_entitlement(self) -> Callable[ - [service.CreateEntitlementRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def change_parameters(self) -> Callable[ - [service.ChangeParametersRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def change_renewal_settings(self) -> Callable[ - [service.ChangeRenewalSettingsRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def change_offer(self) -> Callable[ - [service.ChangeOfferRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def start_paid_service(self) -> Callable[ - [service.StartPaidServiceRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def suspend_entitlement(self) -> Callable[ - [service.SuspendEntitlementRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def cancel_entitlement(self) -> Callable[ - [service.CancelEntitlementRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def activate_entitlement(self) -> Callable[ - [service.ActivateEntitlementRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def transfer_entitlements(self) -> Callable[ - [service.TransferEntitlementsRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def transfer_entitlements_to_google(self) -> Callable[ - [service.TransferEntitlementsToGoogleRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def list_channel_partner_links(self) -> Callable[ - [service.ListChannelPartnerLinksRequest], - Union[ - service.ListChannelPartnerLinksResponse, - Awaitable[service.ListChannelPartnerLinksResponse] - ]]: - raise NotImplementedError() - - @property - def get_channel_partner_link(self) -> Callable[ - [service.GetChannelPartnerLinkRequest], - Union[ - channel_partner_links.ChannelPartnerLink, - Awaitable[channel_partner_links.ChannelPartnerLink] - ]]: - raise NotImplementedError() - - @property - def create_channel_partner_link(self) -> Callable[ - [service.CreateChannelPartnerLinkRequest], - Union[ - channel_partner_links.ChannelPartnerLink, - Awaitable[channel_partner_links.ChannelPartnerLink] - ]]: - raise NotImplementedError() - - @property - def update_channel_partner_link(self) -> Callable[ - [service.UpdateChannelPartnerLinkRequest], - Union[ - channel_partner_links.ChannelPartnerLink, - Awaitable[channel_partner_links.ChannelPartnerLink] - ]]: - raise NotImplementedError() - - @property - def get_customer_repricing_config(self) -> Callable[ - [service.GetCustomerRepricingConfigRequest], - Union[ - repricing.CustomerRepricingConfig, - Awaitable[repricing.CustomerRepricingConfig] - ]]: - raise NotImplementedError() - - @property - def list_customer_repricing_configs(self) -> Callable[ - [service.ListCustomerRepricingConfigsRequest], - Union[ - service.ListCustomerRepricingConfigsResponse, - Awaitable[service.ListCustomerRepricingConfigsResponse] - ]]: - raise NotImplementedError() - - @property - def create_customer_repricing_config(self) -> Callable[ - [service.CreateCustomerRepricingConfigRequest], - Union[ - repricing.CustomerRepricingConfig, - Awaitable[repricing.CustomerRepricingConfig] - ]]: - raise NotImplementedError() - - @property - def update_customer_repricing_config(self) -> Callable[ - [service.UpdateCustomerRepricingConfigRequest], - Union[ - repricing.CustomerRepricingConfig, - Awaitable[repricing.CustomerRepricingConfig] - ]]: - raise NotImplementedError() - - @property - def delete_customer_repricing_config(self) -> Callable[ - [service.DeleteCustomerRepricingConfigRequest], - Union[ - empty_pb2.Empty, - Awaitable[empty_pb2.Empty] - ]]: - raise NotImplementedError() - - @property - def get_channel_partner_repricing_config(self) -> Callable[ - [service.GetChannelPartnerRepricingConfigRequest], - Union[ - repricing.ChannelPartnerRepricingConfig, - Awaitable[repricing.ChannelPartnerRepricingConfig] - ]]: - raise NotImplementedError() - - @property - def list_channel_partner_repricing_configs(self) -> Callable[ - [service.ListChannelPartnerRepricingConfigsRequest], - Union[ - service.ListChannelPartnerRepricingConfigsResponse, - Awaitable[service.ListChannelPartnerRepricingConfigsResponse] - ]]: - raise NotImplementedError() - - @property - def create_channel_partner_repricing_config(self) -> Callable[ - [service.CreateChannelPartnerRepricingConfigRequest], - Union[ - repricing.ChannelPartnerRepricingConfig, - Awaitable[repricing.ChannelPartnerRepricingConfig] - ]]: - raise NotImplementedError() - - @property - def update_channel_partner_repricing_config(self) -> Callable[ - [service.UpdateChannelPartnerRepricingConfigRequest], - Union[ - repricing.ChannelPartnerRepricingConfig, - Awaitable[repricing.ChannelPartnerRepricingConfig] - ]]: - raise NotImplementedError() - - @property - def delete_channel_partner_repricing_config(self) -> Callable[ - [service.DeleteChannelPartnerRepricingConfigRequest], - Union[ - empty_pb2.Empty, - Awaitable[empty_pb2.Empty] - ]]: - raise NotImplementedError() - - @property - def lookup_offer(self) -> Callable[ - [service.LookupOfferRequest], - Union[ - offers.Offer, - Awaitable[offers.Offer] - ]]: - raise NotImplementedError() - - @property - def list_products(self) -> Callable[ - [service.ListProductsRequest], - Union[ - service.ListProductsResponse, - Awaitable[service.ListProductsResponse] - ]]: - raise NotImplementedError() - - @property - def list_skus(self) -> Callable[ - [service.ListSkusRequest], - Union[ - service.ListSkusResponse, - Awaitable[service.ListSkusResponse] - ]]: - raise NotImplementedError() - - @property - def list_offers(self) -> Callable[ - [service.ListOffersRequest], - Union[ - service.ListOffersResponse, - Awaitable[service.ListOffersResponse] - ]]: - raise NotImplementedError() - - @property - def list_purchasable_skus(self) -> Callable[ - [service.ListPurchasableSkusRequest], - Union[ - service.ListPurchasableSkusResponse, - Awaitable[service.ListPurchasableSkusResponse] - ]]: - raise NotImplementedError() - - @property - def list_purchasable_offers(self) -> Callable[ - [service.ListPurchasableOffersRequest], - Union[ - service.ListPurchasableOffersResponse, - Awaitable[service.ListPurchasableOffersResponse] - ]]: - raise NotImplementedError() - - @property - def register_subscriber(self) -> Callable[ - [service.RegisterSubscriberRequest], - Union[ - service.RegisterSubscriberResponse, - Awaitable[service.RegisterSubscriberResponse] - ]]: - raise NotImplementedError() - - @property - def unregister_subscriber(self) -> Callable[ - [service.UnregisterSubscriberRequest], - Union[ - service.UnregisterSubscriberResponse, - Awaitable[service.UnregisterSubscriberResponse] - ]]: - raise NotImplementedError() - - @property - def list_subscribers(self) -> Callable[ - [service.ListSubscribersRequest], - Union[ - service.ListSubscribersResponse, - Awaitable[service.ListSubscribersResponse] - ]]: - raise NotImplementedError() - - @property - def list_operations( - self, - ) -> Callable[ - [operations_pb2.ListOperationsRequest], - Union[operations_pb2.ListOperationsResponse, Awaitable[operations_pb2.ListOperationsResponse]], - ]: - raise NotImplementedError() - - @property - def get_operation( - self, - ) -> Callable[ - [operations_pb2.GetOperationRequest], - Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], - ]: - raise NotImplementedError() - - @property - def cancel_operation( - self, - ) -> Callable[ - [operations_pb2.CancelOperationRequest], - None, - ]: - raise NotImplementedError() - - @property - def delete_operation( - self, - ) -> Callable[ - [operations_pb2.DeleteOperationRequest], - None, - ]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ( - 'CloudChannelServiceTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py deleted file mode 100644 index 2acce35..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py +++ /dev/null @@ -1,2459 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 -import google.auth # type: ignore -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.cloud.channel_v1.types import channel_partner_links -from google.cloud.channel_v1.types import customers -from google.cloud.channel_v1.types import entitlements -from google.cloud.channel_v1.types import offers -from google.cloud.channel_v1.types import repricing -from google.cloud.channel_v1.types import service -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from .base import CloudChannelServiceTransport, DEFAULT_CLIENT_INFO - - -class CloudChannelServiceGrpcTransport(CloudChannelServiceTransport): - """gRPC backend transport for CloudChannelService. - - CloudChannelService lets Google cloud resellers and distributors - manage their customers, channel partners, entitlements, and reports. - - Using this service: - - 1. Resellers and distributors can manage a customer entity. - 2. Distributors can register an authorized reseller in their channel - and provide them with delegated admin access. - 3. Resellers and distributors can manage customer entitlements. - - CloudChannelService exposes the following resources: - - - [Customer][google.cloud.channel.v1.Customer]s: An entity—usually - an enterprise—managed by a reseller or distributor. - - - [Entitlement][google.cloud.channel.v1.Entitlement]s: An entity - that provides a customer with the means to use a service. - Entitlements are created or updated as a result of a successful - fulfillment. - - - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s: - An entity that identifies links between distributors and their - indirect resellers in a channel. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - _stubs: Dict[str, Callable] - - def __init__(self, *, - host: str = 'cloudchannel.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - - else: - if api_mtls_endpoint: - host = api_mtls_endpoint - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel(cls, - host: str = 'cloudchannel.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is mutually exclusive with credentials. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_customers(self) -> Callable[ - [service.ListCustomersRequest], - service.ListCustomersResponse]: - r"""Return a callable for the list customers method over gRPC. - - List [Customer][google.cloud.channel.v1.Customer]s. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: List of - [Customer][google.cloud.channel.v1.Customer]s, or an empty list - if there are no customers. - - Returns: - Callable[[~.ListCustomersRequest], - ~.ListCustomersResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_customers' not in self._stubs: - self._stubs['list_customers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListCustomers', - request_serializer=service.ListCustomersRequest.serialize, - response_deserializer=service.ListCustomersResponse.deserialize, - ) - return self._stubs['list_customers'] - - @property - def get_customer(self) -> Callable[ - [service.GetCustomerRequest], - customers.Customer]: - r"""Return a callable for the get customer method over gRPC. - - Returns the requested - [Customer][google.cloud.channel.v1.Customer] resource. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer resource doesn't exist. Usually the - result of an invalid name parameter. - - Return value: The [Customer][google.cloud.channel.v1.Customer] - resource. - - Returns: - Callable[[~.GetCustomerRequest], - ~.Customer]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_customer' not in self._stubs: - self._stubs['get_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetCustomer', - request_serializer=service.GetCustomerRequest.serialize, - response_deserializer=customers.Customer.deserialize, - ) - return self._stubs['get_customer'] - - @property - def check_cloud_identity_accounts_exist(self) -> Callable[ - [service.CheckCloudIdentityAccountsExistRequest], - service.CheckCloudIdentityAccountsExistResponse]: - r"""Return a callable for the check cloud identity accounts - exist method over gRPC. - - Confirms the existence of Cloud Identity accounts based on the - domain and if the Cloud Identity accounts are owned by the - reseller. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - INVALID_VALUE: Invalid domain value in the request. - - Return value: A list of - [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] - resources for the domain (may be empty) - - Note: in the v1alpha1 version of the API, a NOT_FOUND error - returns if no - [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] - resources match the domain. - - Returns: - Callable[[~.CheckCloudIdentityAccountsExistRequest], - ~.CheckCloudIdentityAccountsExistResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'check_cloud_identity_accounts_exist' not in self._stubs: - self._stubs['check_cloud_identity_accounts_exist'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CheckCloudIdentityAccountsExist', - request_serializer=service.CheckCloudIdentityAccountsExistRequest.serialize, - response_deserializer=service.CheckCloudIdentityAccountsExistResponse.deserialize, - ) - return self._stubs['check_cloud_identity_accounts_exist'] - - @property - def create_customer(self) -> Callable[ - [service.CreateCustomerRequest], - customers.Customer]: - r"""Return a callable for the create customer method over gRPC. - - Creates a new [Customer][google.cloud.channel.v1.Customer] - resource under the reseller or distributor account. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - Domain field value doesn't match the primary email domain. - - Return value: The newly created - [Customer][google.cloud.channel.v1.Customer] resource. - - Returns: - Callable[[~.CreateCustomerRequest], - ~.Customer]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_customer' not in self._stubs: - self._stubs['create_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateCustomer', - request_serializer=service.CreateCustomerRequest.serialize, - response_deserializer=customers.Customer.deserialize, - ) - return self._stubs['create_customer'] - - @property - def update_customer(self) -> Callable[ - [service.UpdateCustomerRequest], - customers.Customer]: - r"""Return a callable for the update customer method over gRPC. - - Updates an existing [Customer][google.cloud.channel.v1.Customer] - resource for the reseller or distributor. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] - resource found for the name in the request. - - Return value: The updated - [Customer][google.cloud.channel.v1.Customer] resource. - - Returns: - Callable[[~.UpdateCustomerRequest], - ~.Customer]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_customer' not in self._stubs: - self._stubs['update_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UpdateCustomer', - request_serializer=service.UpdateCustomerRequest.serialize, - response_deserializer=customers.Customer.deserialize, - ) - return self._stubs['update_customer'] - - @property - def delete_customer(self) -> Callable[ - [service.DeleteCustomerRequest], - empty_pb2.Empty]: - r"""Return a callable for the delete customer method over gRPC. - - Deletes the given [Customer][google.cloud.channel.v1.Customer] - permanently. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The customer has existing entitlements. - - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] - resource found for the name in the request. - - Returns: - Callable[[~.DeleteCustomerRequest], - ~.Empty]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_customer' not in self._stubs: - self._stubs['delete_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/DeleteCustomer', - request_serializer=service.DeleteCustomerRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['delete_customer'] - - @property - def import_customer(self) -> Callable[ - [service.ImportCustomerRequest], - customers.Customer]: - r"""Return a callable for the import customer method over gRPC. - - Imports a [Customer][google.cloud.channel.v1.Customer] from the - Cloud Identity associated with the provided Cloud Identity ID or - domain before a TransferEntitlements call. If a linked Customer - already exists and overwrite_if_exists is true, it will update - that Customer's data. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - NOT_FOUND: Cloud Identity doesn't exist or was deleted. - - INVALID_ARGUMENT: Required parameters are missing, or the - auth_token is expired or invalid. - - ALREADY_EXISTS: A customer already exists and has conflicting - critical fields. Requires an overwrite. - - Return value: The [Customer][google.cloud.channel.v1.Customer]. - - Returns: - Callable[[~.ImportCustomerRequest], - ~.Customer]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'import_customer' not in self._stubs: - self._stubs['import_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ImportCustomer', - request_serializer=service.ImportCustomerRequest.serialize, - response_deserializer=customers.Customer.deserialize, - ) - return self._stubs['import_customer'] - - @property - def provision_cloud_identity(self) -> Callable[ - [service.ProvisionCloudIdentityRequest], - operations_pb2.Operation]: - r"""Return a callable for the provision cloud identity method over gRPC. - - Creates a Cloud Identity for the given customer using the - customer's information, or the information provided here. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer was not found. - - ALREADY_EXISTS: The customer's primary email already exists. - Retry after changing the customer's primary contact email. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - contains an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ProvisionCloudIdentityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'provision_cloud_identity' not in self._stubs: - self._stubs['provision_cloud_identity'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ProvisionCloudIdentity', - request_serializer=service.ProvisionCloudIdentityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['provision_cloud_identity'] - - @property - def list_entitlements(self) -> Callable[ - [service.ListEntitlementsRequest], - service.ListEntitlementsResponse]: - r"""Return a callable for the list entitlements method over gRPC. - - Lists [Entitlement][google.cloud.channel.v1.Entitlement]s - belonging to a customer. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: A list of the customer's - [Entitlement][google.cloud.channel.v1.Entitlement]s. - - Returns: - Callable[[~.ListEntitlementsRequest], - ~.ListEntitlementsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_entitlements' not in self._stubs: - self._stubs['list_entitlements'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListEntitlements', - request_serializer=service.ListEntitlementsRequest.serialize, - response_deserializer=service.ListEntitlementsResponse.deserialize, - ) - return self._stubs['list_entitlements'] - - @property - def list_transferable_skus(self) -> Callable[ - [service.ListTransferableSkusRequest], - service.ListTransferableSkusResponse]: - r"""Return a callable for the list transferable skus method over gRPC. - - List [TransferableSku][google.cloud.channel.v1.TransferableSku]s - of a customer based on the Cloud Identity ID or Customer Name in - the request. - - Use this method to list the entitlements information of an - unowned customer. You should provide the customer's Cloud - Identity ID or Customer Name. - - Possible error codes: - - - PERMISSION_DENIED: - - - The customer doesn't belong to the reseller and has no - auth token. - - The supplied auth token is invalid. - - The reseller account making the request is different from - the reseller account in the query. - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: A list of the customer's - [TransferableSku][google.cloud.channel.v1.TransferableSku]. - - Returns: - Callable[[~.ListTransferableSkusRequest], - ~.ListTransferableSkusResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_transferable_skus' not in self._stubs: - self._stubs['list_transferable_skus'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListTransferableSkus', - request_serializer=service.ListTransferableSkusRequest.serialize, - response_deserializer=service.ListTransferableSkusResponse.deserialize, - ) - return self._stubs['list_transferable_skus'] - - @property - def list_transferable_offers(self) -> Callable[ - [service.ListTransferableOffersRequest], - service.ListTransferableOffersResponse]: - r"""Return a callable for the list transferable offers method over gRPC. - - List - [TransferableOffer][google.cloud.channel.v1.TransferableOffer]s - of a customer based on Cloud Identity ID or Customer Name in the - request. - - Use this method when a reseller gets the entitlement information - of an unowned customer. The reseller should provide the - customer's Cloud Identity ID or Customer Name. - - Possible error codes: - - - PERMISSION_DENIED: - - - The customer doesn't belong to the reseller and has no - auth token. - - The customer provided incorrect reseller information when - generating auth token. - - The reseller account making the request is different from - the reseller account in the query. - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: List of - [TransferableOffer][google.cloud.channel.v1.TransferableOffer] - for the given customer and SKU. - - Returns: - Callable[[~.ListTransferableOffersRequest], - ~.ListTransferableOffersResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_transferable_offers' not in self._stubs: - self._stubs['list_transferable_offers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListTransferableOffers', - request_serializer=service.ListTransferableOffersRequest.serialize, - response_deserializer=service.ListTransferableOffersResponse.deserialize, - ) - return self._stubs['list_transferable_offers'] - - @property - def get_entitlement(self) -> Callable[ - [service.GetEntitlementRequest], - entitlements.Entitlement]: - r"""Return a callable for the get entitlement method over gRPC. - - Returns the requested - [Entitlement][google.cloud.channel.v1.Entitlement] resource. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer entitlement was not found. - - Return value: The requested - [Entitlement][google.cloud.channel.v1.Entitlement] resource. - - Returns: - Callable[[~.GetEntitlementRequest], - ~.Entitlement]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_entitlement' not in self._stubs: - self._stubs['get_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetEntitlement', - request_serializer=service.GetEntitlementRequest.serialize, - response_deserializer=entitlements.Entitlement.deserialize, - ) - return self._stubs['get_entitlement'] - - @property - def create_entitlement(self) -> Callable[ - [service.CreateEntitlementRequest], - operations_pb2.Operation]: - r"""Return a callable for the create entitlement method over gRPC. - - Creates an entitlement for a customer. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - There is already a customer entitlement for a SKU from the - same product family. - - - INVALID_VALUE: Make sure the OfferId is valid. If it is, - contact Google Channel support for further troubleshooting. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: - - - The SKU was already purchased for the customer. - - The customer's primary email already exists. Retry after - changing the customer's primary contact email. - - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The domain required for purchasing a SKU has not been - verified. - - A pre-requisite SKU required to purchase an Add-On SKU is - missing. For example, Google Workspace Business Starter is - required to purchase Vault or Drive. - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.CreateEntitlementRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_entitlement' not in self._stubs: - self._stubs['create_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateEntitlement', - request_serializer=service.CreateEntitlementRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_entitlement'] - - @property - def change_parameters(self) -> Callable[ - [service.ChangeParametersRequest], - operations_pb2.Operation]: - r"""Return a callable for the change parameters method over gRPC. - - Change parameters of the entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. For example, the number of seats being changed is - greater than the allowed number of max seats, or decreasing - seats for a commitment based plan. - - NOT_FOUND: Entitlement resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ChangeParametersRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'change_parameters' not in self._stubs: - self._stubs['change_parameters'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ChangeParameters', - request_serializer=service.ChangeParametersRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['change_parameters'] - - @property - def change_renewal_settings(self) -> Callable[ - [service.ChangeRenewalSettingsRequest], - operations_pb2.Operation]: - r"""Return a callable for the change renewal settings method over gRPC. - - Updates the renewal settings for an existing customer - entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for - a commitment plan. Can't enable or disable renewals for - non-commitment plans. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ChangeRenewalSettingsRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'change_renewal_settings' not in self._stubs: - self._stubs['change_renewal_settings'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ChangeRenewalSettings', - request_serializer=service.ChangeRenewalSettingsRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['change_renewal_settings'] - - @property - def change_offer(self) -> Callable[ - [service.ChangeOfferRequest], - operations_pb2.Operation]: - r"""Return a callable for the change offer method over gRPC. - - Updates the Offer for an existing customer entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Offer or Entitlement resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ChangeOfferRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'change_offer' not in self._stubs: - self._stubs['change_offer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ChangeOffer', - request_serializer=service.ChangeOfferRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['change_offer'] - - @property - def start_paid_service(self) -> Callable[ - [service.StartPaidServiceRequest], - operations_pb2.Operation]: - r"""Return a callable for the start paid service method over gRPC. - - Starts paid service for a trial entitlement. - - Starts paid service for a trial entitlement immediately. This - method is only applicable if a plan is set up for a trial - entitlement but has some trial days remaining. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for - entitlement on trial plans. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.StartPaidServiceRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'start_paid_service' not in self._stubs: - self._stubs['start_paid_service'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/StartPaidService', - request_serializer=service.StartPaidServiceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['start_paid_service'] - - @property - def suspend_entitlement(self) -> Callable[ - [service.SuspendEntitlementRequest], - operations_pb2.Operation]: - r"""Return a callable for the suspend entitlement method over gRPC. - - Suspends a previously fulfilled entitlement. - - An entitlement suspension is a long-running operation. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - NOT_ACTIVE: Entitlement is not active. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.SuspendEntitlementRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'suspend_entitlement' not in self._stubs: - self._stubs['suspend_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/SuspendEntitlement', - request_serializer=service.SuspendEntitlementRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['suspend_entitlement'] - - @property - def cancel_entitlement(self) -> Callable[ - [service.CancelEntitlementRequest], - operations_pb2.Operation]: - r"""Return a callable for the cancel entitlement method over gRPC. - - Cancels a previously fulfilled entitlement. - - An entitlement cancellation is a long-running operation. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - FAILED_PRECONDITION: There are Google Cloud projects linked - to the Google Cloud entitlement's Cloud Billing subaccount. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google - Workspace add-ons, or entitlements for Google Cloud's - development platform. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The response will - contain google.protobuf.Empty on success. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.CancelEntitlementRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'cancel_entitlement' not in self._stubs: - self._stubs['cancel_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CancelEntitlement', - request_serializer=service.CancelEntitlementRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['cancel_entitlement'] - - @property - def activate_entitlement(self) -> Callable[ - [service.ActivateEntitlementRequest], - operations_pb2.Operation]: - r"""Return a callable for the activate entitlement method over gRPC. - - Activates a previously suspended entitlement. Entitlements - suspended for pending ToS acceptance can't be activated using - this method. - - An entitlement activation is a long-running operation and it - updates the state of the customer entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - SUSPENSION_NOT_RESELLER_INITIATED: Can only activate - reseller-initiated suspensions and entitlements that have - accepted the TOS. - - NOT_SUSPENDED: Can only activate suspended entitlements not - in an ACTIVE state. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ActivateEntitlementRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'activate_entitlement' not in self._stubs: - self._stubs['activate_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ActivateEntitlement', - request_serializer=service.ActivateEntitlementRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['activate_entitlement'] - - @property - def transfer_entitlements(self) -> Callable[ - [service.TransferEntitlementsRequest], - operations_pb2.Operation]: - r"""Return a callable for the transfer entitlements method over gRPC. - - Transfers customer entitlements to new reseller. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: The SKU was already transferred for the - customer. - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The SKU requires domain verification to transfer, but the - domain is not verified. - - An Add-On SKU (example, Vault or Drive) is missing the - pre-requisite SKU (example, G Suite Basic). - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - Specify all transferring entitlements. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.TransferEntitlementsRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'transfer_entitlements' not in self._stubs: - self._stubs['transfer_entitlements'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/TransferEntitlements', - request_serializer=service.TransferEntitlementsRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['transfer_entitlements'] - - @property - def transfer_entitlements_to_google(self) -> Callable[ - [service.TransferEntitlementsToGoogleRequest], - operations_pb2.Operation]: - r"""Return a callable for the transfer entitlements to - google method over gRPC. - - Transfers customer entitlements from their current reseller to - Google. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: The SKU was already transferred for the - customer. - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The SKU requires domain verification to transfer, but the - domain is not verified. - - An Add-On SKU (example, Vault or Drive) is missing the - pre-requisite SKU (example, G Suite Basic). - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The response will - contain google.protobuf.Empty on success. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.TransferEntitlementsToGoogleRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'transfer_entitlements_to_google' not in self._stubs: - self._stubs['transfer_entitlements_to_google'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/TransferEntitlementsToGoogle', - request_serializer=service.TransferEntitlementsToGoogleRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['transfer_entitlements_to_google'] - - @property - def list_channel_partner_links(self) -> Callable[ - [service.ListChannelPartnerLinksRequest], - service.ListChannelPartnerLinksResponse]: - r"""Return a callable for the list channel partner links method over gRPC. - - List - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s - belonging to a distributor. You must be a distributor to call - this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: The list of the distributor account's - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resources. - - Returns: - Callable[[~.ListChannelPartnerLinksRequest], - ~.ListChannelPartnerLinksResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_channel_partner_links' not in self._stubs: - self._stubs['list_channel_partner_links'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListChannelPartnerLinks', - request_serializer=service.ListChannelPartnerLinksRequest.serialize, - response_deserializer=service.ListChannelPartnerLinksResponse.deserialize, - ) - return self._stubs['list_channel_partner_links'] - - @property - def get_channel_partner_link(self) -> Callable[ - [service.GetChannelPartnerLinkRequest], - channel_partner_links.ChannelPartnerLink]: - r"""Return a callable for the get channel partner link method over gRPC. - - Returns the requested - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. You must be a distributor to call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: ChannelPartnerLink resource not found because of - an invalid channel partner link name. - - Return value: The - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - Returns: - Callable[[~.GetChannelPartnerLinkRequest], - ~.ChannelPartnerLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_channel_partner_link' not in self._stubs: - self._stubs['get_channel_partner_link'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetChannelPartnerLink', - request_serializer=service.GetChannelPartnerLinkRequest.serialize, - response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, - ) - return self._stubs['get_channel_partner_link'] - - @property - def create_channel_partner_link(self) -> Callable[ - [service.CreateChannelPartnerLinkRequest], - channel_partner_links.ChannelPartnerLink]: - r"""Return a callable for the create channel partner link method over gRPC. - - Initiates a channel partner link between a distributor and a - reseller, or between resellers in an n-tier reseller channel. - Invited partners need to follow the invite_link_uri provided in - the response to accept. After accepting the invitation, a link - is set up between the two parties. You must be a distributor to - call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - ALREADY_EXISTS: The ChannelPartnerLink sent in the request - already exists. - - NOT_FOUND: No Cloud Identity customer exists for provided - domain. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The new - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - Returns: - Callable[[~.CreateChannelPartnerLinkRequest], - ~.ChannelPartnerLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_channel_partner_link' not in self._stubs: - self._stubs['create_channel_partner_link'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerLink', - request_serializer=service.CreateChannelPartnerLinkRequest.serialize, - response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, - ) - return self._stubs['create_channel_partner_link'] - - @property - def update_channel_partner_link(self) -> Callable[ - [service.UpdateChannelPartnerLinkRequest], - channel_partner_links.ChannelPartnerLink]: - r"""Return a callable for the update channel partner link method over gRPC. - - Updates a channel partner link. Distributors call this method to - change a link's status. For example, to suspend a partner link. - You must be a distributor to call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - Link state cannot change from invited to active or - suspended. - - Cannot send reseller_cloud_identity_id, invite_url, or - name in update mask. - - - NOT_FOUND: ChannelPartnerLink resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The updated - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - Returns: - Callable[[~.UpdateChannelPartnerLinkRequest], - ~.ChannelPartnerLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_channel_partner_link' not in self._stubs: - self._stubs['update_channel_partner_link'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerLink', - request_serializer=service.UpdateChannelPartnerLinkRequest.serialize, - response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, - ) - return self._stubs['update_channel_partner_link'] - - @property - def get_customer_repricing_config(self) -> Callable[ - [service.GetCustomerRepricingConfigRequest], - repricing.CustomerRepricingConfig]: - r"""Return a callable for the get customer repricing config method over gRPC. - - Gets information about how a Reseller modifies their bill before - sending it to a Customer. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - was not found. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.GetCustomerRepricingConfigRequest], - ~.CustomerRepricingConfig]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_customer_repricing_config' not in self._stubs: - self._stubs['get_customer_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetCustomerRepricingConfig', - request_serializer=service.GetCustomerRepricingConfigRequest.serialize, - response_deserializer=repricing.CustomerRepricingConfig.deserialize, - ) - return self._stubs['get_customer_repricing_config'] - - @property - def list_customer_repricing_configs(self) -> Callable[ - [service.ListCustomerRepricingConfigsRequest], - service.ListCustomerRepricingConfigsResponse]: - r"""Return a callable for the list customer repricing - configs method over gRPC. - - Lists information about how a Reseller modifies their bill - before sending it to a Customer. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resources. The data for each resource is displayed in the - ascending order of: - - - customer ID - - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] - - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - - [CustomerRepricingConfig.update_time][google.cloud.channel.v1.CustomerRepricingConfig.update_time] - - If unsuccessful, returns an error. - - Returns: - Callable[[~.ListCustomerRepricingConfigsRequest], - ~.ListCustomerRepricingConfigsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_customer_repricing_configs' not in self._stubs: - self._stubs['list_customer_repricing_configs'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListCustomerRepricingConfigs', - request_serializer=service.ListCustomerRepricingConfigsRequest.serialize, - response_deserializer=service.ListCustomerRepricingConfigsResponse.deserialize, - ) - return self._stubs['list_customer_repricing_configs'] - - @property - def create_customer_repricing_config(self) -> Callable[ - [service.CreateCustomerRepricingConfigRequest], - repricing.CustomerRepricingConfig]: - r"""Return a callable for the create customer repricing - config method over gRPC. - - Creates a CustomerRepricingConfig. Call this method to set - modifications for a specific customer's bill. You can only - create configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. If needed, you can create a config for the - current month, with some restrictions. - - When creating a config for a future month, make sure there are - no existing configs for that - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The following restrictions are for creating configs in the - current month. - - - This functionality is reserved for recovering from an - erroneous config, and should not be used for regular business - cases. - - The new config will not modify exports used with other - configs. Changes to the config may be immediate, but may take - up to 24 hours. - - There is a limit of ten configs for any - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] - or - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The contained - [CustomerRepricingConfig.repricing_config][google.cloud.channel.v1.CustomerRepricingConfig.repricing_config] - vaule must be different from the value used in the current - config for a - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement]. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.CreateCustomerRepricingConfigRequest], - ~.CustomerRepricingConfig]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_customer_repricing_config' not in self._stubs: - self._stubs['create_customer_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateCustomerRepricingConfig', - request_serializer=service.CreateCustomerRepricingConfigRequest.serialize, - response_deserializer=repricing.CustomerRepricingConfig.deserialize, - ) - return self._stubs['create_customer_repricing_config'] - - @property - def update_customer_repricing_config(self) -> Callable[ - [service.UpdateCustomerRepricingConfigRequest], - repricing.CustomerRepricingConfig]: - r"""Return a callable for the update customer repricing - config method over gRPC. - - Updates a CustomerRepricingConfig. Call this method to set - modifications for a specific customer's bill. This method - overwrites the existing CustomerRepricingConfig. - - You can only update configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. To make changes to configs for the current - month, use - [CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig], - taking note of its restrictions. You cannot update the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - When updating a config in the future: - - - This config must already exist. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.UpdateCustomerRepricingConfigRequest], - ~.CustomerRepricingConfig]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_customer_repricing_config' not in self._stubs: - self._stubs['update_customer_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UpdateCustomerRepricingConfig', - request_serializer=service.UpdateCustomerRepricingConfigRequest.serialize, - response_deserializer=repricing.CustomerRepricingConfig.deserialize, - ) - return self._stubs['update_customer_repricing_config'] - - @property - def delete_customer_repricing_config(self) -> Callable[ - [service.DeleteCustomerRepricingConfigRequest], - empty_pb2.Empty]: - r"""Return a callable for the delete customer repricing - config method over gRPC. - - Deletes the given - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - permanently. You can only delete configs if their - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is set to a date after the current month. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - is active or in the past. - - NOT_FOUND: No - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - found for the name in the request. - - Returns: - Callable[[~.DeleteCustomerRepricingConfigRequest], - ~.Empty]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_customer_repricing_config' not in self._stubs: - self._stubs['delete_customer_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/DeleteCustomerRepricingConfig', - request_serializer=service.DeleteCustomerRepricingConfigRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['delete_customer_repricing_config'] - - @property - def get_channel_partner_repricing_config(self) -> Callable[ - [service.GetChannelPartnerRepricingConfigRequest], - repricing.ChannelPartnerRepricingConfig]: - r"""Return a callable for the get channel partner repricing - config method over gRPC. - - Gets information about how a Distributor modifies their bill - before sending it to a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - was not found. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.GetChannelPartnerRepricingConfigRequest], - ~.ChannelPartnerRepricingConfig]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_channel_partner_repricing_config' not in self._stubs: - self._stubs['get_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetChannelPartnerRepricingConfig', - request_serializer=service.GetChannelPartnerRepricingConfigRequest.serialize, - response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, - ) - return self._stubs['get_channel_partner_repricing_config'] - - @property - def list_channel_partner_repricing_configs(self) -> Callable[ - [service.ListChannelPartnerRepricingConfigsRequest], - service.ListChannelPartnerRepricingConfigsResponse]: - r"""Return a callable for the list channel partner repricing - configs method over gRPC. - - Lists information about how a Reseller modifies their bill - before sending it to a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resources. The data for each resource is displayed in the - ascending order of: - - - channel partner ID - - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - - [ChannelPartnerRepricingConfig.update_time][google.cloud.channel.v1.ChannelPartnerRepricingConfig.update_time] - - If unsuccessful, returns an error. - - Returns: - Callable[[~.ListChannelPartnerRepricingConfigsRequest], - ~.ListChannelPartnerRepricingConfigsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_channel_partner_repricing_configs' not in self._stubs: - self._stubs['list_channel_partner_repricing_configs'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListChannelPartnerRepricingConfigs', - request_serializer=service.ListChannelPartnerRepricingConfigsRequest.serialize, - response_deserializer=service.ListChannelPartnerRepricingConfigsResponse.deserialize, - ) - return self._stubs['list_channel_partner_repricing_configs'] - - @property - def create_channel_partner_repricing_config(self) -> Callable[ - [service.CreateChannelPartnerRepricingConfigRequest], - repricing.ChannelPartnerRepricingConfig]: - r"""Return a callable for the create channel partner - repricing config method over gRPC. - - Creates a ChannelPartnerRepricingConfig. Call this method to set - modifications for a specific ChannelPartner's bill. You can only - create configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. If needed, you can create a config for the - current month, with some restrictions. - - When creating a config for a future month, make sure there are - no existing configs for that - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The following restrictions are for creating configs in the - current month. - - - This functionality is reserved for recovering from an - erroneous config, and should not be used for regular business - cases. - - The new config will not modify exports used with other - configs. Changes to the config may be immediate, but may take - up to 24 hours. - - There is a limit of ten configs for any ChannelPartner or - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The contained - [ChannelPartnerRepricingConfig.repricing_config][google.cloud.channel.v1.ChannelPartnerRepricingConfig.repricing_config] - vaule must be different from the value used in the current - config for a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.CreateChannelPartnerRepricingConfigRequest], - ~.ChannelPartnerRepricingConfig]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_channel_partner_repricing_config' not in self._stubs: - self._stubs['create_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerRepricingConfig', - request_serializer=service.CreateChannelPartnerRepricingConfigRequest.serialize, - response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, - ) - return self._stubs['create_channel_partner_repricing_config'] - - @property - def update_channel_partner_repricing_config(self) -> Callable[ - [service.UpdateChannelPartnerRepricingConfigRequest], - repricing.ChannelPartnerRepricingConfig]: - r"""Return a callable for the update channel partner - repricing config method over gRPC. - - Updates a ChannelPartnerRepricingConfig. Call this method to set - modifications for a specific ChannelPartner's bill. This method - overwrites the existing CustomerRepricingConfig. - - You can only update configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. To make changes to configs for the current - month, use - [CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig], - taking note of its restrictions. You cannot update the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - When updating a config in the future: - - - This config must already exist. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.UpdateChannelPartnerRepricingConfigRequest], - ~.ChannelPartnerRepricingConfig]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_channel_partner_repricing_config' not in self._stubs: - self._stubs['update_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerRepricingConfig', - request_serializer=service.UpdateChannelPartnerRepricingConfigRequest.serialize, - response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, - ) - return self._stubs['update_channel_partner_repricing_config'] - - @property - def delete_channel_partner_repricing_config(self) -> Callable[ - [service.DeleteChannelPartnerRepricingConfigRequest], - empty_pb2.Empty]: - r"""Return a callable for the delete channel partner - repricing config method over gRPC. - - Deletes the given - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - permanently. You can only delete configs if their - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is set to a date after the current month. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - is active or in the past. - - NOT_FOUND: No - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - found for the name in the request. - - Returns: - Callable[[~.DeleteChannelPartnerRepricingConfigRequest], - ~.Empty]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_channel_partner_repricing_config' not in self._stubs: - self._stubs['delete_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/DeleteChannelPartnerRepricingConfig', - request_serializer=service.DeleteChannelPartnerRepricingConfigRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['delete_channel_partner_repricing_config'] - - @property - def lookup_offer(self) -> Callable[ - [service.LookupOfferRequest], - offers.Offer]: - r"""Return a callable for the lookup offer method over gRPC. - - Returns the requested [Offer][google.cloud.channel.v1.Offer] - resource. - - Possible error codes: - - - PERMISSION_DENIED: The entitlement doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement or offer was not found. - - Return value: The [Offer][google.cloud.channel.v1.Offer] - resource. - - Returns: - Callable[[~.LookupOfferRequest], - ~.Offer]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'lookup_offer' not in self._stubs: - self._stubs['lookup_offer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/LookupOffer', - request_serializer=service.LookupOfferRequest.serialize, - response_deserializer=offers.Offer.deserialize, - ) - return self._stubs['lookup_offer'] - - @property - def list_products(self) -> Callable[ - [service.ListProductsRequest], - service.ListProductsResponse]: - r"""Return a callable for the list products method over gRPC. - - Lists the Products the reseller is authorized to sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListProductsRequest], - ~.ListProductsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_products' not in self._stubs: - self._stubs['list_products'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListProducts', - request_serializer=service.ListProductsRequest.serialize, - response_deserializer=service.ListProductsResponse.deserialize, - ) - return self._stubs['list_products'] - - @property - def list_skus(self) -> Callable[ - [service.ListSkusRequest], - service.ListSkusResponse]: - r"""Return a callable for the list skus method over gRPC. - - Lists the SKUs for a product the reseller is authorized to sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListSkusRequest], - ~.ListSkusResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_skus' not in self._stubs: - self._stubs['list_skus'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListSkus', - request_serializer=service.ListSkusRequest.serialize, - response_deserializer=service.ListSkusResponse.deserialize, - ) - return self._stubs['list_skus'] - - @property - def list_offers(self) -> Callable[ - [service.ListOffersRequest], - service.ListOffersResponse]: - r"""Return a callable for the list offers method over gRPC. - - Lists the Offers the reseller can sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListOffersRequest], - ~.ListOffersResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_offers' not in self._stubs: - self._stubs['list_offers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListOffers', - request_serializer=service.ListOffersRequest.serialize, - response_deserializer=service.ListOffersResponse.deserialize, - ) - return self._stubs['list_offers'] - - @property - def list_purchasable_skus(self) -> Callable[ - [service.ListPurchasableSkusRequest], - service.ListPurchasableSkusResponse]: - r"""Return a callable for the list purchasable skus method over gRPC. - - Lists the following: - - - SKUs that you can purchase for a customer - - SKUs that you can upgrade or downgrade for an entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListPurchasableSkusRequest], - ~.ListPurchasableSkusResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_purchasable_skus' not in self._stubs: - self._stubs['list_purchasable_skus'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListPurchasableSkus', - request_serializer=service.ListPurchasableSkusRequest.serialize, - response_deserializer=service.ListPurchasableSkusResponse.deserialize, - ) - return self._stubs['list_purchasable_skus'] - - @property - def list_purchasable_offers(self) -> Callable[ - [service.ListPurchasableOffersRequest], - service.ListPurchasableOffersResponse]: - r"""Return a callable for the list purchasable offers method over gRPC. - - Lists the following: - - - Offers that you can purchase for a customer. - - Offers that you can change for an entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListPurchasableOffersRequest], - ~.ListPurchasableOffersResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_purchasable_offers' not in self._stubs: - self._stubs['list_purchasable_offers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListPurchasableOffers', - request_serializer=service.ListPurchasableOffersRequest.serialize, - response_deserializer=service.ListPurchasableOffersResponse.deserialize, - ) - return self._stubs['list_purchasable_offers'] - - @property - def register_subscriber(self) -> Callable[ - [service.RegisterSubscriberRequest], - service.RegisterSubscriberResponse]: - r"""Return a callable for the register subscriber method over gRPC. - - Registers a service account with subscriber privileges on the - Cloud Pub/Sub topic for this Channel Services account. After you - create a subscriber, you get the events through - [SubscriberEvent][google.cloud.channel.v1.SubscriberEvent] - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The topic name with the registered service email - address. - - Returns: - Callable[[~.RegisterSubscriberRequest], - ~.RegisterSubscriberResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'register_subscriber' not in self._stubs: - self._stubs['register_subscriber'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/RegisterSubscriber', - request_serializer=service.RegisterSubscriberRequest.serialize, - response_deserializer=service.RegisterSubscriberResponse.deserialize, - ) - return self._stubs['register_subscriber'] - - @property - def unregister_subscriber(self) -> Callable[ - [service.UnregisterSubscriberRequest], - service.UnregisterSubscriberResponse]: - r"""Return a callable for the unregister subscriber method over gRPC. - - Unregisters a service account with subscriber privileges on the - Cloud Pub/Sub topic created for this Channel Services account. - If there are no service accounts left with subscriber - privileges, this deletes the topic. You can call ListSubscribers - to check for these accounts. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The topic resource doesn't exist. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The topic name that unregistered the service email - address. Returns a success response if the service email address - wasn't registered with the topic. - - Returns: - Callable[[~.UnregisterSubscriberRequest], - ~.UnregisterSubscriberResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'unregister_subscriber' not in self._stubs: - self._stubs['unregister_subscriber'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UnregisterSubscriber', - request_serializer=service.UnregisterSubscriberRequest.serialize, - response_deserializer=service.UnregisterSubscriberResponse.deserialize, - ) - return self._stubs['unregister_subscriber'] - - @property - def list_subscribers(self) -> Callable[ - [service.ListSubscribersRequest], - service.ListSubscribersResponse]: - r"""Return a callable for the list subscribers method over gRPC. - - Lists service accounts with subscriber privileges on the Cloud - Pub/Sub topic created for this Channel Services account. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The topic resource doesn't exist. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: A list of service email addresses. - - Returns: - Callable[[~.ListSubscribersRequest], - ~.ListSubscribersResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_subscribers' not in self._stubs: - self._stubs['list_subscribers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListSubscribers', - request_serializer=service.ListSubscribersRequest.serialize, - response_deserializer=service.ListSubscribersResponse.deserialize, - ) - return self._stubs['list_subscribers'] - - def close(self): - self.grpc_channel.close() - - @property - def delete_operation( - self, - ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: - r"""Return a callable for the delete_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/DeleteOperation", - request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["delete_operation"] - - @property - def cancel_operation( - self, - ) -> Callable[[operations_pb2.CancelOperationRequest], None]: - r"""Return a callable for the cancel_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/CancelOperation", - request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["cancel_operation"] - - @property - def get_operation( - self, - ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: - r"""Return a callable for the get_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/GetOperation", - request_serializer=operations_pb2.GetOperationRequest.SerializeToString, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["get_operation"] - - @property - def list_operations( - self, - ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: - r"""Return a callable for the list_operations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/ListOperations", - request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, - response_deserializer=operations_pb2.ListOperationsResponse.FromString, - ) - return self._stubs["list_operations"] - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ( - 'CloudChannelServiceGrpcTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py b/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py deleted file mode 100644 index 01da4aa..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py +++ /dev/null @@ -1,2458 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore -from grpc.experimental import aio # type: ignore - -from google.cloud.channel_v1.types import channel_partner_links -from google.cloud.channel_v1.types import customers -from google.cloud.channel_v1.types import entitlements -from google.cloud.channel_v1.types import offers -from google.cloud.channel_v1.types import repricing -from google.cloud.channel_v1.types import service -from google.longrunning import operations_pb2 -from google.longrunning import operations_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from .base import CloudChannelServiceTransport, DEFAULT_CLIENT_INFO -from .grpc import CloudChannelServiceGrpcTransport - - -class CloudChannelServiceGrpcAsyncIOTransport(CloudChannelServiceTransport): - """gRPC AsyncIO backend transport for CloudChannelService. - - CloudChannelService lets Google cloud resellers and distributors - manage their customers, channel partners, entitlements, and reports. - - Using this service: - - 1. Resellers and distributors can manage a customer entity. - 2. Distributors can register an authorized reseller in their channel - and provide them with delegated admin access. - 3. Resellers and distributors can manage customer entitlements. - - CloudChannelService exposes the following resources: - - - [Customer][google.cloud.channel.v1.Customer]s: An entity—usually - an enterprise—managed by a reseller or distributor. - - - [Entitlement][google.cloud.channel.v1.Entitlement]s: An entity - that provides a customer with the means to use a service. - Entitlements are created or updated as a result of a successful - fulfillment. - - - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s: - An entity that identifies links between distributors and their - indirect resellers in a channel. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel(cls, - host: str = 'cloudchannel.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - def __init__(self, *, - host: str = 'cloudchannel.googleapis.com', - credentials: ga_credentials.Credentials = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): - The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - else: - if api_mtls_endpoint: - host = api_mtls_endpoint - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def list_customers(self) -> Callable[ - [service.ListCustomersRequest], - Awaitable[service.ListCustomersResponse]]: - r"""Return a callable for the list customers method over gRPC. - - List [Customer][google.cloud.channel.v1.Customer]s. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: List of - [Customer][google.cloud.channel.v1.Customer]s, or an empty list - if there are no customers. - - Returns: - Callable[[~.ListCustomersRequest], - Awaitable[~.ListCustomersResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_customers' not in self._stubs: - self._stubs['list_customers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListCustomers', - request_serializer=service.ListCustomersRequest.serialize, - response_deserializer=service.ListCustomersResponse.deserialize, - ) - return self._stubs['list_customers'] - - @property - def get_customer(self) -> Callable[ - [service.GetCustomerRequest], - Awaitable[customers.Customer]]: - r"""Return a callable for the get customer method over gRPC. - - Returns the requested - [Customer][google.cloud.channel.v1.Customer] resource. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer resource doesn't exist. Usually the - result of an invalid name parameter. - - Return value: The [Customer][google.cloud.channel.v1.Customer] - resource. - - Returns: - Callable[[~.GetCustomerRequest], - Awaitable[~.Customer]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_customer' not in self._stubs: - self._stubs['get_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetCustomer', - request_serializer=service.GetCustomerRequest.serialize, - response_deserializer=customers.Customer.deserialize, - ) - return self._stubs['get_customer'] - - @property - def check_cloud_identity_accounts_exist(self) -> Callable[ - [service.CheckCloudIdentityAccountsExistRequest], - Awaitable[service.CheckCloudIdentityAccountsExistResponse]]: - r"""Return a callable for the check cloud identity accounts - exist method over gRPC. - - Confirms the existence of Cloud Identity accounts based on the - domain and if the Cloud Identity accounts are owned by the - reseller. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - INVALID_VALUE: Invalid domain value in the request. - - Return value: A list of - [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] - resources for the domain (may be empty) - - Note: in the v1alpha1 version of the API, a NOT_FOUND error - returns if no - [CloudIdentityCustomerAccount][google.cloud.channel.v1.CloudIdentityCustomerAccount] - resources match the domain. - - Returns: - Callable[[~.CheckCloudIdentityAccountsExistRequest], - Awaitable[~.CheckCloudIdentityAccountsExistResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'check_cloud_identity_accounts_exist' not in self._stubs: - self._stubs['check_cloud_identity_accounts_exist'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CheckCloudIdentityAccountsExist', - request_serializer=service.CheckCloudIdentityAccountsExistRequest.serialize, - response_deserializer=service.CheckCloudIdentityAccountsExistResponse.deserialize, - ) - return self._stubs['check_cloud_identity_accounts_exist'] - - @property - def create_customer(self) -> Callable[ - [service.CreateCustomerRequest], - Awaitable[customers.Customer]]: - r"""Return a callable for the create customer method over gRPC. - - Creates a new [Customer][google.cloud.channel.v1.Customer] - resource under the reseller or distributor account. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - Domain field value doesn't match the primary email domain. - - Return value: The newly created - [Customer][google.cloud.channel.v1.Customer] resource. - - Returns: - Callable[[~.CreateCustomerRequest], - Awaitable[~.Customer]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_customer' not in self._stubs: - self._stubs['create_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateCustomer', - request_serializer=service.CreateCustomerRequest.serialize, - response_deserializer=customers.Customer.deserialize, - ) - return self._stubs['create_customer'] - - @property - def update_customer(self) -> Callable[ - [service.UpdateCustomerRequest], - Awaitable[customers.Customer]]: - r"""Return a callable for the update customer method over gRPC. - - Updates an existing [Customer][google.cloud.channel.v1.Customer] - resource for the reseller or distributor. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] - resource found for the name in the request. - - Return value: The updated - [Customer][google.cloud.channel.v1.Customer] resource. - - Returns: - Callable[[~.UpdateCustomerRequest], - Awaitable[~.Customer]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_customer' not in self._stubs: - self._stubs['update_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UpdateCustomer', - request_serializer=service.UpdateCustomerRequest.serialize, - response_deserializer=customers.Customer.deserialize, - ) - return self._stubs['update_customer'] - - @property - def delete_customer(self) -> Callable[ - [service.DeleteCustomerRequest], - Awaitable[empty_pb2.Empty]]: - r"""Return a callable for the delete customer method over gRPC. - - Deletes the given [Customer][google.cloud.channel.v1.Customer] - permanently. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The customer has existing entitlements. - - NOT_FOUND: No [Customer][google.cloud.channel.v1.Customer] - resource found for the name in the request. - - Returns: - Callable[[~.DeleteCustomerRequest], - Awaitable[~.Empty]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_customer' not in self._stubs: - self._stubs['delete_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/DeleteCustomer', - request_serializer=service.DeleteCustomerRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['delete_customer'] - - @property - def import_customer(self) -> Callable[ - [service.ImportCustomerRequest], - Awaitable[customers.Customer]]: - r"""Return a callable for the import customer method over gRPC. - - Imports a [Customer][google.cloud.channel.v1.Customer] from the - Cloud Identity associated with the provided Cloud Identity ID or - domain before a TransferEntitlements call. If a linked Customer - already exists and overwrite_if_exists is true, it will update - that Customer's data. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - NOT_FOUND: Cloud Identity doesn't exist or was deleted. - - INVALID_ARGUMENT: Required parameters are missing, or the - auth_token is expired or invalid. - - ALREADY_EXISTS: A customer already exists and has conflicting - critical fields. Requires an overwrite. - - Return value: The [Customer][google.cloud.channel.v1.Customer]. - - Returns: - Callable[[~.ImportCustomerRequest], - Awaitable[~.Customer]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'import_customer' not in self._stubs: - self._stubs['import_customer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ImportCustomer', - request_serializer=service.ImportCustomerRequest.serialize, - response_deserializer=customers.Customer.deserialize, - ) - return self._stubs['import_customer'] - - @property - def provision_cloud_identity(self) -> Callable[ - [service.ProvisionCloudIdentityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the provision cloud identity method over gRPC. - - Creates a Cloud Identity for the given customer using the - customer's information, or the information provided here. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer was not found. - - ALREADY_EXISTS: The customer's primary email already exists. - Retry after changing the customer's primary contact email. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - contains an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ProvisionCloudIdentityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'provision_cloud_identity' not in self._stubs: - self._stubs['provision_cloud_identity'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ProvisionCloudIdentity', - request_serializer=service.ProvisionCloudIdentityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['provision_cloud_identity'] - - @property - def list_entitlements(self) -> Callable[ - [service.ListEntitlementsRequest], - Awaitable[service.ListEntitlementsResponse]]: - r"""Return a callable for the list entitlements method over gRPC. - - Lists [Entitlement][google.cloud.channel.v1.Entitlement]s - belonging to a customer. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: A list of the customer's - [Entitlement][google.cloud.channel.v1.Entitlement]s. - - Returns: - Callable[[~.ListEntitlementsRequest], - Awaitable[~.ListEntitlementsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_entitlements' not in self._stubs: - self._stubs['list_entitlements'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListEntitlements', - request_serializer=service.ListEntitlementsRequest.serialize, - response_deserializer=service.ListEntitlementsResponse.deserialize, - ) - return self._stubs['list_entitlements'] - - @property - def list_transferable_skus(self) -> Callable[ - [service.ListTransferableSkusRequest], - Awaitable[service.ListTransferableSkusResponse]]: - r"""Return a callable for the list transferable skus method over gRPC. - - List [TransferableSku][google.cloud.channel.v1.TransferableSku]s - of a customer based on the Cloud Identity ID or Customer Name in - the request. - - Use this method to list the entitlements information of an - unowned customer. You should provide the customer's Cloud - Identity ID or Customer Name. - - Possible error codes: - - - PERMISSION_DENIED: - - - The customer doesn't belong to the reseller and has no - auth token. - - The supplied auth token is invalid. - - The reseller account making the request is different from - the reseller account in the query. - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: A list of the customer's - [TransferableSku][google.cloud.channel.v1.TransferableSku]. - - Returns: - Callable[[~.ListTransferableSkusRequest], - Awaitable[~.ListTransferableSkusResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_transferable_skus' not in self._stubs: - self._stubs['list_transferable_skus'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListTransferableSkus', - request_serializer=service.ListTransferableSkusRequest.serialize, - response_deserializer=service.ListTransferableSkusResponse.deserialize, - ) - return self._stubs['list_transferable_skus'] - - @property - def list_transferable_offers(self) -> Callable[ - [service.ListTransferableOffersRequest], - Awaitable[service.ListTransferableOffersResponse]]: - r"""Return a callable for the list transferable offers method over gRPC. - - List - [TransferableOffer][google.cloud.channel.v1.TransferableOffer]s - of a customer based on Cloud Identity ID or Customer Name in the - request. - - Use this method when a reseller gets the entitlement information - of an unowned customer. The reseller should provide the - customer's Cloud Identity ID or Customer Name. - - Possible error codes: - - - PERMISSION_DENIED: - - - The customer doesn't belong to the reseller and has no - auth token. - - The customer provided incorrect reseller information when - generating auth token. - - The reseller account making the request is different from - the reseller account in the query. - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: List of - [TransferableOffer][google.cloud.channel.v1.TransferableOffer] - for the given customer and SKU. - - Returns: - Callable[[~.ListTransferableOffersRequest], - Awaitable[~.ListTransferableOffersResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_transferable_offers' not in self._stubs: - self._stubs['list_transferable_offers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListTransferableOffers', - request_serializer=service.ListTransferableOffersRequest.serialize, - response_deserializer=service.ListTransferableOffersResponse.deserialize, - ) - return self._stubs['list_transferable_offers'] - - @property - def get_entitlement(self) -> Callable[ - [service.GetEntitlementRequest], - Awaitable[entitlements.Entitlement]]: - r"""Return a callable for the get entitlement method over gRPC. - - Returns the requested - [Entitlement][google.cloud.channel.v1.Entitlement] resource. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer entitlement was not found. - - Return value: The requested - [Entitlement][google.cloud.channel.v1.Entitlement] resource. - - Returns: - Callable[[~.GetEntitlementRequest], - Awaitable[~.Entitlement]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_entitlement' not in self._stubs: - self._stubs['get_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetEntitlement', - request_serializer=service.GetEntitlementRequest.serialize, - response_deserializer=entitlements.Entitlement.deserialize, - ) - return self._stubs['get_entitlement'] - - @property - def create_entitlement(self) -> Callable[ - [service.CreateEntitlementRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create entitlement method over gRPC. - - Creates an entitlement for a customer. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - There is already a customer entitlement for a SKU from the - same product family. - - - INVALID_VALUE: Make sure the OfferId is valid. If it is, - contact Google Channel support for further troubleshooting. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: - - - The SKU was already purchased for the customer. - - The customer's primary email already exists. Retry after - changing the customer's primary contact email. - - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The domain required for purchasing a SKU has not been - verified. - - A pre-requisite SKU required to purchase an Add-On SKU is - missing. For example, Google Workspace Business Starter is - required to purchase Vault or Drive. - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.CreateEntitlementRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_entitlement' not in self._stubs: - self._stubs['create_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateEntitlement', - request_serializer=service.CreateEntitlementRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['create_entitlement'] - - @property - def change_parameters(self) -> Callable[ - [service.ChangeParametersRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the change parameters method over gRPC. - - Change parameters of the entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. For example, the number of seats being changed is - greater than the allowed number of max seats, or decreasing - seats for a commitment based plan. - - NOT_FOUND: Entitlement resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ChangeParametersRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'change_parameters' not in self._stubs: - self._stubs['change_parameters'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ChangeParameters', - request_serializer=service.ChangeParametersRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['change_parameters'] - - @property - def change_renewal_settings(self) -> Callable[ - [service.ChangeRenewalSettingsRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the change renewal settings method over gRPC. - - Updates the renewal settings for an existing customer - entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for - a commitment plan. Can't enable or disable renewals for - non-commitment plans. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ChangeRenewalSettingsRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'change_renewal_settings' not in self._stubs: - self._stubs['change_renewal_settings'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ChangeRenewalSettings', - request_serializer=service.ChangeRenewalSettingsRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['change_renewal_settings'] - - @property - def change_offer(self) -> Callable[ - [service.ChangeOfferRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the change offer method over gRPC. - - Updates the Offer for an existing customer entitlement. - - An entitlement update is a long-running operation and it updates - the entitlement as a result of fulfillment. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Offer or Entitlement resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ChangeOfferRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'change_offer' not in self._stubs: - self._stubs['change_offer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ChangeOffer', - request_serializer=service.ChangeOfferRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['change_offer'] - - @property - def start_paid_service(self) -> Callable[ - [service.StartPaidServiceRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the start paid service method over gRPC. - - Starts paid service for a trial entitlement. - - Starts paid service for a trial entitlement immediately. This - method is only applicable if a plan is set up for a trial - entitlement but has some trial days remaining. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for - entitlement on trial plans. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.StartPaidServiceRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'start_paid_service' not in self._stubs: - self._stubs['start_paid_service'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/StartPaidService', - request_serializer=service.StartPaidServiceRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['start_paid_service'] - - @property - def suspend_entitlement(self) -> Callable[ - [service.SuspendEntitlementRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the suspend entitlement method over gRPC. - - Suspends a previously fulfilled entitlement. - - An entitlement suspension is a long-running operation. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - NOT_ACTIVE: Entitlement is not active. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.SuspendEntitlementRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'suspend_entitlement' not in self._stubs: - self._stubs['suspend_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/SuspendEntitlement', - request_serializer=service.SuspendEntitlementRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['suspend_entitlement'] - - @property - def cancel_entitlement(self) -> Callable[ - [service.CancelEntitlementRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the cancel entitlement method over gRPC. - - Cancels a previously fulfilled entitlement. - - An entitlement cancellation is a long-running operation. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - FAILED_PRECONDITION: There are Google Cloud projects linked - to the Google Cloud entitlement's Cloud Billing subaccount. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google - Workspace add-ons, or entitlements for Google Cloud's - development platform. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The response will - contain google.protobuf.Empty on success. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.CancelEntitlementRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'cancel_entitlement' not in self._stubs: - self._stubs['cancel_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CancelEntitlement', - request_serializer=service.CancelEntitlementRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['cancel_entitlement'] - - @property - def activate_entitlement(self) -> Callable[ - [service.ActivateEntitlementRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the activate entitlement method over gRPC. - - Activates a previously suspended entitlement. Entitlements - suspended for pending ToS acceptance can't be activated using - this method. - - An entitlement activation is a long-running operation and it - updates the state of the customer entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement resource not found. - - SUSPENSION_NOT_RESELLER_INITIATED: Can only activate - reseller-initiated suspensions and entitlements that have - accepted the TOS. - - NOT_SUSPENDED: Can only activate suspended entitlements not - in an ACTIVE state. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.ActivateEntitlementRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'activate_entitlement' not in self._stubs: - self._stubs['activate_entitlement'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ActivateEntitlement', - request_serializer=service.ActivateEntitlementRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['activate_entitlement'] - - @property - def transfer_entitlements(self) -> Callable[ - [service.TransferEntitlementsRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the transfer entitlements method over gRPC. - - Transfers customer entitlements to new reseller. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: The SKU was already transferred for the - customer. - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The SKU requires domain verification to transfer, but the - domain is not verified. - - An Add-On SKU (example, Vault or Drive) is missing the - pre-requisite SKU (example, G Suite Basic). - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - Specify all transferring entitlements. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.TransferEntitlementsRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'transfer_entitlements' not in self._stubs: - self._stubs['transfer_entitlements'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/TransferEntitlements', - request_serializer=service.TransferEntitlementsRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['transfer_entitlements'] - - @property - def transfer_entitlements_to_google(self) -> Callable[ - [service.TransferEntitlementsToGoogleRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the transfer entitlements to - google method over gRPC. - - Transfers customer entitlements from their current reseller to - Google. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The customer or offer resource was not found. - - ALREADY_EXISTS: The SKU was already transferred for the - customer. - - CONDITION_NOT_MET or FAILED_PRECONDITION: - - - The SKU requires domain verification to transfer, but the - domain is not verified. - - An Add-On SKU (example, Vault or Drive) is missing the - pre-requisite SKU (example, G Suite Basic). - - (Developer accounts only) Reseller and resold domain must - meet the following naming requirements: - - - Domain names must start with goog-test. - - Domain names must include the reseller domain. - - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The ID of a long-running operation. - - To get the results of the operation, call the GetOperation - method of CloudChannelOperationsService. The response will - contain google.protobuf.Empty on success. The Operation metadata - will contain an instance of - [OperationMetadata][google.cloud.channel.v1.OperationMetadata]. - - Returns: - Callable[[~.TransferEntitlementsToGoogleRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'transfer_entitlements_to_google' not in self._stubs: - self._stubs['transfer_entitlements_to_google'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/TransferEntitlementsToGoogle', - request_serializer=service.TransferEntitlementsToGoogleRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['transfer_entitlements_to_google'] - - @property - def list_channel_partner_links(self) -> Callable[ - [service.ListChannelPartnerLinksRequest], - Awaitable[service.ListChannelPartnerLinksResponse]]: - r"""Return a callable for the list channel partner links method over gRPC. - - List - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]s - belonging to a distributor. You must be a distributor to call - this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Return value: The list of the distributor account's - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resources. - - Returns: - Callable[[~.ListChannelPartnerLinksRequest], - Awaitable[~.ListChannelPartnerLinksResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_channel_partner_links' not in self._stubs: - self._stubs['list_channel_partner_links'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListChannelPartnerLinks', - request_serializer=service.ListChannelPartnerLinksRequest.serialize, - response_deserializer=service.ListChannelPartnerLinksResponse.deserialize, - ) - return self._stubs['list_channel_partner_links'] - - @property - def get_channel_partner_link(self) -> Callable[ - [service.GetChannelPartnerLinkRequest], - Awaitable[channel_partner_links.ChannelPartnerLink]]: - r"""Return a callable for the get channel partner link method over gRPC. - - Returns the requested - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. You must be a distributor to call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: ChannelPartnerLink resource not found because of - an invalid channel partner link name. - - Return value: The - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - Returns: - Callable[[~.GetChannelPartnerLinkRequest], - Awaitable[~.ChannelPartnerLink]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_channel_partner_link' not in self._stubs: - self._stubs['get_channel_partner_link'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetChannelPartnerLink', - request_serializer=service.GetChannelPartnerLinkRequest.serialize, - response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, - ) - return self._stubs['get_channel_partner_link'] - - @property - def create_channel_partner_link(self) -> Callable[ - [service.CreateChannelPartnerLinkRequest], - Awaitable[channel_partner_links.ChannelPartnerLink]]: - r"""Return a callable for the create channel partner link method over gRPC. - - Initiates a channel partner link between a distributor and a - reseller, or between resellers in an n-tier reseller channel. - Invited partners need to follow the invite_link_uri provided in - the response to accept. After accepting the invitation, a link - is set up between the two parties. You must be a distributor to - call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - ALREADY_EXISTS: The ChannelPartnerLink sent in the request - already exists. - - NOT_FOUND: No Cloud Identity customer exists for provided - domain. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The new - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - Returns: - Callable[[~.CreateChannelPartnerLinkRequest], - Awaitable[~.ChannelPartnerLink]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_channel_partner_link' not in self._stubs: - self._stubs['create_channel_partner_link'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerLink', - request_serializer=service.CreateChannelPartnerLinkRequest.serialize, - response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, - ) - return self._stubs['create_channel_partner_link'] - - @property - def update_channel_partner_link(self) -> Callable[ - [service.UpdateChannelPartnerLinkRequest], - Awaitable[channel_partner_links.ChannelPartnerLink]]: - r"""Return a callable for the update channel partner link method over gRPC. - - Updates a channel partner link. Distributors call this method to - change a link's status. For example, to suspend a partner link. - You must be a distributor to call this method. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request is - different from the reseller account in the API request. - - INVALID_ARGUMENT: - - - Required request parameters are missing or invalid. - - Link state cannot change from invited to active or - suspended. - - Cannot send reseller_cloud_identity_id, invite_url, or - name in update mask. - - - NOT_FOUND: ChannelPartnerLink resource not found. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The updated - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - resource. - - Returns: - Callable[[~.UpdateChannelPartnerLinkRequest], - Awaitable[~.ChannelPartnerLink]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_channel_partner_link' not in self._stubs: - self._stubs['update_channel_partner_link'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerLink', - request_serializer=service.UpdateChannelPartnerLinkRequest.serialize, - response_deserializer=channel_partner_links.ChannelPartnerLink.deserialize, - ) - return self._stubs['update_channel_partner_link'] - - @property - def get_customer_repricing_config(self) -> Callable[ - [service.GetCustomerRepricingConfigRequest], - Awaitable[repricing.CustomerRepricingConfig]]: - r"""Return a callable for the get customer repricing config method over gRPC. - - Gets information about how a Reseller modifies their bill before - sending it to a Customer. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - was not found. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.GetCustomerRepricingConfigRequest], - Awaitable[~.CustomerRepricingConfig]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_customer_repricing_config' not in self._stubs: - self._stubs['get_customer_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetCustomerRepricingConfig', - request_serializer=service.GetCustomerRepricingConfigRequest.serialize, - response_deserializer=repricing.CustomerRepricingConfig.deserialize, - ) - return self._stubs['get_customer_repricing_config'] - - @property - def list_customer_repricing_configs(self) -> Callable[ - [service.ListCustomerRepricingConfigsRequest], - Awaitable[service.ListCustomerRepricingConfigsResponse]]: - r"""Return a callable for the list customer repricing - configs method over gRPC. - - Lists information about how a Reseller modifies their bill - before sending it to a Customer. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resources. The data for each resource is displayed in the - ascending order of: - - - customer ID - - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] - - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - - [CustomerRepricingConfig.update_time][google.cloud.channel.v1.CustomerRepricingConfig.update_time] - - If unsuccessful, returns an error. - - Returns: - Callable[[~.ListCustomerRepricingConfigsRequest], - Awaitable[~.ListCustomerRepricingConfigsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_customer_repricing_configs' not in self._stubs: - self._stubs['list_customer_repricing_configs'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListCustomerRepricingConfigs', - request_serializer=service.ListCustomerRepricingConfigsRequest.serialize, - response_deserializer=service.ListCustomerRepricingConfigsResponse.deserialize, - ) - return self._stubs['list_customer_repricing_configs'] - - @property - def create_customer_repricing_config(self) -> Callable[ - [service.CreateCustomerRepricingConfigRequest], - Awaitable[repricing.CustomerRepricingConfig]]: - r"""Return a callable for the create customer repricing - config method over gRPC. - - Creates a CustomerRepricingConfig. Call this method to set - modifications for a specific customer's bill. You can only - create configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. If needed, you can create a config for the - current month, with some restrictions. - - When creating a config for a future month, make sure there are - no existing configs for that - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The following restrictions are for creating configs in the - current month. - - - This functionality is reserved for recovering from an - erroneous config, and should not be used for regular business - cases. - - The new config will not modify exports used with other - configs. Changes to the config may be immediate, but may take - up to 24 hours. - - There is a limit of ten configs for any - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement] - or - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The contained - [CustomerRepricingConfig.repricing_config][google.cloud.channel.v1.CustomerRepricingConfig.repricing_config] - vaule must be different from the value used in the current - config for a - [RepricingConfig.EntitlementGranularity.entitlement][google.cloud.channel.v1.RepricingConfig.EntitlementGranularity.entitlement]. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.CreateCustomerRepricingConfigRequest], - Awaitable[~.CustomerRepricingConfig]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_customer_repricing_config' not in self._stubs: - self._stubs['create_customer_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateCustomerRepricingConfig', - request_serializer=service.CreateCustomerRepricingConfigRequest.serialize, - response_deserializer=repricing.CustomerRepricingConfig.deserialize, - ) - return self._stubs['create_customer_repricing_config'] - - @property - def update_customer_repricing_config(self) -> Callable[ - [service.UpdateCustomerRepricingConfigRequest], - Awaitable[repricing.CustomerRepricingConfig]]: - r"""Return a callable for the update customer repricing - config method over gRPC. - - Updates a CustomerRepricingConfig. Call this method to set - modifications for a specific customer's bill. This method - overwrites the existing CustomerRepricingConfig. - - You can only update configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. To make changes to configs for the current - month, use - [CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig], - taking note of its restrictions. You cannot update the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - When updating a config in the future: - - - This config must already exist. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.UpdateCustomerRepricingConfigRequest], - Awaitable[~.CustomerRepricingConfig]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_customer_repricing_config' not in self._stubs: - self._stubs['update_customer_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UpdateCustomerRepricingConfig', - request_serializer=service.UpdateCustomerRepricingConfigRequest.serialize, - response_deserializer=repricing.CustomerRepricingConfig.deserialize, - ) - return self._stubs['update_customer_repricing_config'] - - @property - def delete_customer_repricing_config(self) -> Callable[ - [service.DeleteCustomerRepricingConfigRequest], - Awaitable[empty_pb2.Empty]]: - r"""Return a callable for the delete customer repricing - config method over gRPC. - - Deletes the given - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - permanently. You can only delete configs if their - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is set to a date after the current month. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - is active or in the past. - - NOT_FOUND: No - [CustomerRepricingConfig][google.cloud.channel.v1.CustomerRepricingConfig] - found for the name in the request. - - Returns: - Callable[[~.DeleteCustomerRepricingConfigRequest], - Awaitable[~.Empty]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_customer_repricing_config' not in self._stubs: - self._stubs['delete_customer_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/DeleteCustomerRepricingConfig', - request_serializer=service.DeleteCustomerRepricingConfigRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['delete_customer_repricing_config'] - - @property - def get_channel_partner_repricing_config(self) -> Callable[ - [service.GetChannelPartnerRepricingConfigRequest], - Awaitable[repricing.ChannelPartnerRepricingConfig]]: - r"""Return a callable for the get channel partner repricing - config method over gRPC. - - Gets information about how a Distributor modifies their bill - before sending it to a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - was not found. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.GetChannelPartnerRepricingConfigRequest], - Awaitable[~.ChannelPartnerRepricingConfig]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_channel_partner_repricing_config' not in self._stubs: - self._stubs['get_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/GetChannelPartnerRepricingConfig', - request_serializer=service.GetChannelPartnerRepricingConfigRequest.serialize, - response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, - ) - return self._stubs['get_channel_partner_repricing_config'] - - @property - def list_channel_partner_repricing_configs(self) -> Callable[ - [service.ListChannelPartnerRepricingConfigsRequest], - Awaitable[service.ListChannelPartnerRepricingConfigsResponse]]: - r"""Return a callable for the list channel partner repricing - configs method over gRPC. - - Lists information about how a Reseller modifies their bill - before sending it to a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resources. The data for each resource is displayed in the - ascending order of: - - - channel partner ID - - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - - [ChannelPartnerRepricingConfig.update_time][google.cloud.channel.v1.ChannelPartnerRepricingConfig.update_time] - - If unsuccessful, returns an error. - - Returns: - Callable[[~.ListChannelPartnerRepricingConfigsRequest], - Awaitable[~.ListChannelPartnerRepricingConfigsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_channel_partner_repricing_configs' not in self._stubs: - self._stubs['list_channel_partner_repricing_configs'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListChannelPartnerRepricingConfigs', - request_serializer=service.ListChannelPartnerRepricingConfigsRequest.serialize, - response_deserializer=service.ListChannelPartnerRepricingConfigsResponse.deserialize, - ) - return self._stubs['list_channel_partner_repricing_configs'] - - @property - def create_channel_partner_repricing_config(self) -> Callable[ - [service.CreateChannelPartnerRepricingConfigRequest], - Awaitable[repricing.ChannelPartnerRepricingConfig]]: - r"""Return a callable for the create channel partner - repricing config method over gRPC. - - Creates a ChannelPartnerRepricingConfig. Call this method to set - modifications for a specific ChannelPartner's bill. You can only - create configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. If needed, you can create a config for the - current month, with some restrictions. - - When creating a config for a future month, make sure there are - no existing configs for that - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The following restrictions are for creating configs in the - current month. - - - This functionality is reserved for recovering from an - erroneous config, and should not be used for regular business - cases. - - The new config will not modify exports used with other - configs. Changes to the config may be immediate, but may take - up to 24 hours. - - There is a limit of ten configs for any ChannelPartner or - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - The contained - [ChannelPartnerRepricingConfig.repricing_config][google.cloud.channel.v1.ChannelPartnerRepricingConfig.repricing_config] - vaule must be different from the value used in the current - config for a ChannelPartner. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.CreateChannelPartnerRepricingConfigRequest], - Awaitable[~.ChannelPartnerRepricingConfig]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_channel_partner_repricing_config' not in self._stubs: - self._stubs['create_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/CreateChannelPartnerRepricingConfig', - request_serializer=service.CreateChannelPartnerRepricingConfigRequest.serialize, - response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, - ) - return self._stubs['create_channel_partner_repricing_config'] - - @property - def update_channel_partner_repricing_config(self) -> Callable[ - [service.UpdateChannelPartnerRepricingConfigRequest], - Awaitable[repricing.ChannelPartnerRepricingConfig]]: - r"""Return a callable for the update channel partner - repricing config method over gRPC. - - Updates a ChannelPartnerRepricingConfig. Call this method to set - modifications for a specific ChannelPartner's bill. This method - overwrites the existing CustomerRepricingConfig. - - You can only update configs if the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is a future month. To make changes to configs for the current - month, use - [CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig], - taking note of its restrictions. You cannot update the - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month]. - - When updating a config in the future: - - - This config must already exist. - - Possible Error Codes: - - - PERMISSION_DENIED: If the account making the request and the - account being queried are different. - - INVALID_ARGUMENT: Missing or invalid required parameters in - the request. Also displays if the updated config is for the - current month or past months. - - NOT_FOUND: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - specified does not exist or is not associated with the given - account. - - INTERNAL: Any non-user error related to technical issues in - the backend. In this case, contact Cloud Channel support. - - Return Value: If successful, the updated - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - resource, otherwise returns an error. - - Returns: - Callable[[~.UpdateChannelPartnerRepricingConfigRequest], - Awaitable[~.ChannelPartnerRepricingConfig]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_channel_partner_repricing_config' not in self._stubs: - self._stubs['update_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UpdateChannelPartnerRepricingConfig', - request_serializer=service.UpdateChannelPartnerRepricingConfigRequest.serialize, - response_deserializer=repricing.ChannelPartnerRepricingConfig.deserialize, - ) - return self._stubs['update_channel_partner_repricing_config'] - - @property - def delete_channel_partner_repricing_config(self) -> Callable[ - [service.DeleteChannelPartnerRepricingConfigRequest], - Awaitable[empty_pb2.Empty]]: - r"""Return a callable for the delete channel partner - repricing config method over gRPC. - - Deletes the given - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - permanently. You can only delete configs if their - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - is set to a date after the current month. - - Possible error codes: - - - PERMISSION_DENIED: The account making the request does not - own this customer. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - FAILED_PRECONDITION: The - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - is active or in the past. - - NOT_FOUND: No - [ChannelPartnerRepricingConfig][google.cloud.channel.v1.ChannelPartnerRepricingConfig] - found for the name in the request. - - Returns: - Callable[[~.DeleteChannelPartnerRepricingConfigRequest], - Awaitable[~.Empty]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_channel_partner_repricing_config' not in self._stubs: - self._stubs['delete_channel_partner_repricing_config'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/DeleteChannelPartnerRepricingConfig', - request_serializer=service.DeleteChannelPartnerRepricingConfigRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs['delete_channel_partner_repricing_config'] - - @property - def lookup_offer(self) -> Callable[ - [service.LookupOfferRequest], - Awaitable[offers.Offer]]: - r"""Return a callable for the lookup offer method over gRPC. - - Returns the requested [Offer][google.cloud.channel.v1.Offer] - resource. - - Possible error codes: - - - PERMISSION_DENIED: The entitlement doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: Entitlement or offer was not found. - - Return value: The [Offer][google.cloud.channel.v1.Offer] - resource. - - Returns: - Callable[[~.LookupOfferRequest], - Awaitable[~.Offer]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'lookup_offer' not in self._stubs: - self._stubs['lookup_offer'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/LookupOffer', - request_serializer=service.LookupOfferRequest.serialize, - response_deserializer=offers.Offer.deserialize, - ) - return self._stubs['lookup_offer'] - - @property - def list_products(self) -> Callable[ - [service.ListProductsRequest], - Awaitable[service.ListProductsResponse]]: - r"""Return a callable for the list products method over gRPC. - - Lists the Products the reseller is authorized to sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListProductsRequest], - Awaitable[~.ListProductsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_products' not in self._stubs: - self._stubs['list_products'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListProducts', - request_serializer=service.ListProductsRequest.serialize, - response_deserializer=service.ListProductsResponse.deserialize, - ) - return self._stubs['list_products'] - - @property - def list_skus(self) -> Callable[ - [service.ListSkusRequest], - Awaitable[service.ListSkusResponse]]: - r"""Return a callable for the list skus method over gRPC. - - Lists the SKUs for a product the reseller is authorized to sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListSkusRequest], - Awaitable[~.ListSkusResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_skus' not in self._stubs: - self._stubs['list_skus'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListSkus', - request_serializer=service.ListSkusRequest.serialize, - response_deserializer=service.ListSkusResponse.deserialize, - ) - return self._stubs['list_skus'] - - @property - def list_offers(self) -> Callable[ - [service.ListOffersRequest], - Awaitable[service.ListOffersResponse]]: - r"""Return a callable for the list offers method over gRPC. - - Lists the Offers the reseller can sell. - - Possible error codes: - - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListOffersRequest], - Awaitable[~.ListOffersResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_offers' not in self._stubs: - self._stubs['list_offers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListOffers', - request_serializer=service.ListOffersRequest.serialize, - response_deserializer=service.ListOffersResponse.deserialize, - ) - return self._stubs['list_offers'] - - @property - def list_purchasable_skus(self) -> Callable[ - [service.ListPurchasableSkusRequest], - Awaitable[service.ListPurchasableSkusResponse]]: - r"""Return a callable for the list purchasable skus method over gRPC. - - Lists the following: - - - SKUs that you can purchase for a customer - - SKUs that you can upgrade or downgrade for an entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListPurchasableSkusRequest], - Awaitable[~.ListPurchasableSkusResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_purchasable_skus' not in self._stubs: - self._stubs['list_purchasable_skus'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListPurchasableSkus', - request_serializer=service.ListPurchasableSkusRequest.serialize, - response_deserializer=service.ListPurchasableSkusResponse.deserialize, - ) - return self._stubs['list_purchasable_skus'] - - @property - def list_purchasable_offers(self) -> Callable[ - [service.ListPurchasableOffersRequest], - Awaitable[service.ListPurchasableOffersResponse]]: - r"""Return a callable for the list purchasable offers method over gRPC. - - Lists the following: - - - Offers that you can purchase for a customer. - - Offers that you can change for an entitlement. - - Possible error codes: - - - PERMISSION_DENIED: The customer doesn't belong to the - reseller - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - Returns: - Callable[[~.ListPurchasableOffersRequest], - Awaitable[~.ListPurchasableOffersResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_purchasable_offers' not in self._stubs: - self._stubs['list_purchasable_offers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListPurchasableOffers', - request_serializer=service.ListPurchasableOffersRequest.serialize, - response_deserializer=service.ListPurchasableOffersResponse.deserialize, - ) - return self._stubs['list_purchasable_offers'] - - @property - def register_subscriber(self) -> Callable[ - [service.RegisterSubscriberRequest], - Awaitable[service.RegisterSubscriberResponse]]: - r"""Return a callable for the register subscriber method over gRPC. - - Registers a service account with subscriber privileges on the - Cloud Pub/Sub topic for this Channel Services account. After you - create a subscriber, you get the events through - [SubscriberEvent][google.cloud.channel.v1.SubscriberEvent] - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The topic name with the registered service email - address. - - Returns: - Callable[[~.RegisterSubscriberRequest], - Awaitable[~.RegisterSubscriberResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'register_subscriber' not in self._stubs: - self._stubs['register_subscriber'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/RegisterSubscriber', - request_serializer=service.RegisterSubscriberRequest.serialize, - response_deserializer=service.RegisterSubscriberResponse.deserialize, - ) - return self._stubs['register_subscriber'] - - @property - def unregister_subscriber(self) -> Callable[ - [service.UnregisterSubscriberRequest], - Awaitable[service.UnregisterSubscriberResponse]]: - r"""Return a callable for the unregister subscriber method over gRPC. - - Unregisters a service account with subscriber privileges on the - Cloud Pub/Sub topic created for this Channel Services account. - If there are no service accounts left with subscriber - privileges, this deletes the topic. You can call ListSubscribers - to check for these accounts. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The topic resource doesn't exist. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: The topic name that unregistered the service email - address. Returns a success response if the service email address - wasn't registered with the topic. - - Returns: - Callable[[~.UnregisterSubscriberRequest], - Awaitable[~.UnregisterSubscriberResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'unregister_subscriber' not in self._stubs: - self._stubs['unregister_subscriber'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/UnregisterSubscriber', - request_serializer=service.UnregisterSubscriberRequest.serialize, - response_deserializer=service.UnregisterSubscriberResponse.deserialize, - ) - return self._stubs['unregister_subscriber'] - - @property - def list_subscribers(self) -> Callable[ - [service.ListSubscribersRequest], - Awaitable[service.ListSubscribersResponse]]: - r"""Return a callable for the list subscribers method over gRPC. - - Lists service accounts with subscriber privileges on the Cloud - Pub/Sub topic created for this Channel Services account. - - Possible error codes: - - - PERMISSION_DENIED: The reseller account making the request - and the provided reseller account are different, or the - impersonated user is not a super admin. - - INVALID_ARGUMENT: Required request parameters are missing or - invalid. - - NOT_FOUND: The topic resource doesn't exist. - - INTERNAL: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - UNKNOWN: Any non-user error related to a technical issue in - the backend. Contact Cloud Channel support. - - Return value: A list of service email addresses. - - Returns: - Callable[[~.ListSubscribersRequest], - Awaitable[~.ListSubscribersResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_subscribers' not in self._stubs: - self._stubs['list_subscribers'] = self.grpc_channel.unary_unary( - '/google.cloud.channel.v1.CloudChannelService/ListSubscribers', - request_serializer=service.ListSubscribersRequest.serialize, - response_deserializer=service.ListSubscribersResponse.deserialize, - ) - return self._stubs['list_subscribers'] - - def close(self): - return self.grpc_channel.close() - - @property - def delete_operation( - self, - ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: - r"""Return a callable for the delete_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "delete_operation" not in self._stubs: - self._stubs["delete_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/DeleteOperation", - request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["delete_operation"] - - @property - def cancel_operation( - self, - ) -> Callable[[operations_pb2.CancelOperationRequest], None]: - r"""Return a callable for the cancel_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/CancelOperation", - request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, - response_deserializer=None, - ) - return self._stubs["cancel_operation"] - - @property - def get_operation( - self, - ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: - r"""Return a callable for the get_operation method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_operation" not in self._stubs: - self._stubs["get_operation"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/GetOperation", - request_serializer=operations_pb2.GetOperationRequest.SerializeToString, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs["get_operation"] - - @property - def list_operations( - self, - ) -> Callable[[operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse]: - r"""Return a callable for the list_operations method over gRPC. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_operations" not in self._stubs: - self._stubs["list_operations"] = self.grpc_channel.unary_unary( - "/google.longrunning.Operations/ListOperations", - request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, - response_deserializer=operations_pb2.ListOperationsResponse.FromString, - ) - return self._stubs["list_operations"] - - -__all__ = ( - 'CloudChannelServiceGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/__init__.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/__init__.py deleted file mode 100644 index 0f834fb..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/__init__.py +++ /dev/null @@ -1,296 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .channel_partner_links import ( - ChannelPartnerLink, - ChannelPartnerLinkState, - ChannelPartnerLinkView, -) -from .common import ( - AdminUser, - CloudIdentityInfo, - EduData, - Value, -) -from .customers import ( - ContactInfo, - Customer, -) -from .entitlements import ( - AssociationInfo, - CommitmentSettings, - Entitlement, - Parameter, - ProvisionedService, - RenewalSettings, - TransferableSku, - TransferEligibility, - TrialSettings, -) -from .offers import ( - Constraints, - CustomerConstraints, - Offer, - ParameterDefinition, - Period, - Plan, - Price, - PriceByResource, - PricePhase, - PriceTier, - PaymentPlan, - PaymentType, - PeriodType, - PromotionalOrderType, - ResourceType, -) -from .operations import ( - OperationMetadata, -) -from .products import ( - MarketingInfo, - Media, - Product, - Sku, - MediaType, -) -from .reports_service import ( - Column, - DateRange, - FetchReportResultsRequest, - FetchReportResultsResponse, - ListReportsRequest, - ListReportsResponse, - Report, - ReportJob, - ReportResultsMetadata, - ReportStatus, - ReportValue, - Row, - RunReportJobRequest, - RunReportJobResponse, -) -from .repricing import ( - ChannelPartnerRepricingConfig, - CustomerRepricingConfig, - PercentageAdjustment, - RepricingAdjustment, - RepricingConfig, - RebillingBasis, -) -from .service import ( - ActivateEntitlementRequest, - CancelEntitlementRequest, - ChangeOfferRequest, - ChangeParametersRequest, - ChangeRenewalSettingsRequest, - CheckCloudIdentityAccountsExistRequest, - CheckCloudIdentityAccountsExistResponse, - CloudIdentityCustomerAccount, - CreateChannelPartnerLinkRequest, - CreateChannelPartnerRepricingConfigRequest, - CreateCustomerRepricingConfigRequest, - CreateCustomerRequest, - CreateEntitlementRequest, - DeleteChannelPartnerRepricingConfigRequest, - DeleteCustomerRepricingConfigRequest, - DeleteCustomerRequest, - GetChannelPartnerLinkRequest, - GetChannelPartnerRepricingConfigRequest, - GetCustomerRepricingConfigRequest, - GetCustomerRequest, - GetEntitlementRequest, - ImportCustomerRequest, - ListChannelPartnerLinksRequest, - ListChannelPartnerLinksResponse, - ListChannelPartnerRepricingConfigsRequest, - ListChannelPartnerRepricingConfigsResponse, - ListCustomerRepricingConfigsRequest, - ListCustomerRepricingConfigsResponse, - ListCustomersRequest, - ListCustomersResponse, - ListEntitlementsRequest, - ListEntitlementsResponse, - ListOffersRequest, - ListOffersResponse, - ListProductsRequest, - ListProductsResponse, - ListPurchasableOffersRequest, - ListPurchasableOffersResponse, - ListPurchasableSkusRequest, - ListPurchasableSkusResponse, - ListSkusRequest, - ListSkusResponse, - ListSubscribersRequest, - ListSubscribersResponse, - ListTransferableOffersRequest, - ListTransferableOffersResponse, - ListTransferableSkusRequest, - ListTransferableSkusResponse, - LookupOfferRequest, - ProvisionCloudIdentityRequest, - PurchasableOffer, - PurchasableSku, - RegisterSubscriberRequest, - RegisterSubscriberResponse, - StartPaidServiceRequest, - SuspendEntitlementRequest, - TransferableOffer, - TransferEntitlementsRequest, - TransferEntitlementsResponse, - TransferEntitlementsToGoogleRequest, - UnregisterSubscriberRequest, - UnregisterSubscriberResponse, - UpdateChannelPartnerLinkRequest, - UpdateChannelPartnerRepricingConfigRequest, - UpdateCustomerRepricingConfigRequest, - UpdateCustomerRequest, -) -from .subscriber_event import ( - CustomerEvent, - EntitlementEvent, - SubscriberEvent, -) - -__all__ = ( - 'ChannelPartnerLink', - 'ChannelPartnerLinkState', - 'ChannelPartnerLinkView', - 'AdminUser', - 'CloudIdentityInfo', - 'EduData', - 'Value', - 'ContactInfo', - 'Customer', - 'AssociationInfo', - 'CommitmentSettings', - 'Entitlement', - 'Parameter', - 'ProvisionedService', - 'RenewalSettings', - 'TransferableSku', - 'TransferEligibility', - 'TrialSettings', - 'Constraints', - 'CustomerConstraints', - 'Offer', - 'ParameterDefinition', - 'Period', - 'Plan', - 'Price', - 'PriceByResource', - 'PricePhase', - 'PriceTier', - 'PaymentPlan', - 'PaymentType', - 'PeriodType', - 'PromotionalOrderType', - 'ResourceType', - 'OperationMetadata', - 'MarketingInfo', - 'Media', - 'Product', - 'Sku', - 'MediaType', - 'Column', - 'DateRange', - 'FetchReportResultsRequest', - 'FetchReportResultsResponse', - 'ListReportsRequest', - 'ListReportsResponse', - 'Report', - 'ReportJob', - 'ReportResultsMetadata', - 'ReportStatus', - 'ReportValue', - 'Row', - 'RunReportJobRequest', - 'RunReportJobResponse', - 'ChannelPartnerRepricingConfig', - 'CustomerRepricingConfig', - 'PercentageAdjustment', - 'RepricingAdjustment', - 'RepricingConfig', - 'RebillingBasis', - 'ActivateEntitlementRequest', - 'CancelEntitlementRequest', - 'ChangeOfferRequest', - 'ChangeParametersRequest', - 'ChangeRenewalSettingsRequest', - 'CheckCloudIdentityAccountsExistRequest', - 'CheckCloudIdentityAccountsExistResponse', - 'CloudIdentityCustomerAccount', - 'CreateChannelPartnerLinkRequest', - 'CreateChannelPartnerRepricingConfigRequest', - 'CreateCustomerRepricingConfigRequest', - 'CreateCustomerRequest', - 'CreateEntitlementRequest', - 'DeleteChannelPartnerRepricingConfigRequest', - 'DeleteCustomerRepricingConfigRequest', - 'DeleteCustomerRequest', - 'GetChannelPartnerLinkRequest', - 'GetChannelPartnerRepricingConfigRequest', - 'GetCustomerRepricingConfigRequest', - 'GetCustomerRequest', - 'GetEntitlementRequest', - 'ImportCustomerRequest', - 'ListChannelPartnerLinksRequest', - 'ListChannelPartnerLinksResponse', - 'ListChannelPartnerRepricingConfigsRequest', - 'ListChannelPartnerRepricingConfigsResponse', - 'ListCustomerRepricingConfigsRequest', - 'ListCustomerRepricingConfigsResponse', - 'ListCustomersRequest', - 'ListCustomersResponse', - 'ListEntitlementsRequest', - 'ListEntitlementsResponse', - 'ListOffersRequest', - 'ListOffersResponse', - 'ListProductsRequest', - 'ListProductsResponse', - 'ListPurchasableOffersRequest', - 'ListPurchasableOffersResponse', - 'ListPurchasableSkusRequest', - 'ListPurchasableSkusResponse', - 'ListSkusRequest', - 'ListSkusResponse', - 'ListSubscribersRequest', - 'ListSubscribersResponse', - 'ListTransferableOffersRequest', - 'ListTransferableOffersResponse', - 'ListTransferableSkusRequest', - 'ListTransferableSkusResponse', - 'LookupOfferRequest', - 'ProvisionCloudIdentityRequest', - 'PurchasableOffer', - 'PurchasableSku', - 'RegisterSubscriberRequest', - 'RegisterSubscriberResponse', - 'StartPaidServiceRequest', - 'SuspendEntitlementRequest', - 'TransferableOffer', - 'TransferEntitlementsRequest', - 'TransferEntitlementsResponse', - 'TransferEntitlementsToGoogleRequest', - 'UnregisterSubscriberRequest', - 'UnregisterSubscriberResponse', - 'UpdateChannelPartnerLinkRequest', - 'UpdateChannelPartnerRepricingConfigRequest', - 'UpdateCustomerRepricingConfigRequest', - 'UpdateCustomerRequest', - 'CustomerEvent', - 'EntitlementEvent', - 'SubscriberEvent', -) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/channel_partner_links.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/channel_partner_links.py deleted file mode 100644 index 922b062..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/channel_partner_links.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.channel_v1.types import common -from google.protobuf import timestamp_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'ChannelPartnerLinkView', - 'ChannelPartnerLinkState', - 'ChannelPartnerLink', - }, -) - - -class ChannelPartnerLinkView(proto.Enum): - r"""The level of granularity the - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink] - will display. - """ - UNSPECIFIED = 0 - BASIC = 1 - FULL = 2 - - -class ChannelPartnerLinkState(proto.Enum): - r"""ChannelPartnerLinkState represents state of a channel partner - link. - """ - CHANNEL_PARTNER_LINK_STATE_UNSPECIFIED = 0 - INVITED = 1 - ACTIVE = 2 - REVOKED = 3 - SUSPENDED = 4 - - -class ChannelPartnerLink(proto.Message): - r"""Entity representing a link between distributors and their - indirect resellers in an n-tier resale channel. - - Attributes: - name (str): - Output only. Resource name for the channel partner link, in - the format accounts/{account_id}/channelPartnerLinks/{id}. - reseller_cloud_identity_id (str): - Required. Cloud Identity ID of the linked - reseller. - link_state (google.cloud.channel_v1.types.ChannelPartnerLinkState): - Required. State of the channel partner link. - invite_link_uri (str): - Output only. URI of the web page where - partner accepts the link invitation. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Timestamp of when the channel - partner link is created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Timestamp of when the channel - partner link is updated. - public_id (str): - Output only. Public identifier that a - customer must use to generate a transfer token - to move to this distributor-reseller - combination. - channel_partner_cloud_identity_info (google.cloud.channel_v1.types.CloudIdentityInfo): - Output only. Cloud Identity info of the - channel partner (IR). - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - reseller_cloud_identity_id = proto.Field( - proto.STRING, - number=2, - ) - link_state = proto.Field( - proto.ENUM, - number=3, - enum='ChannelPartnerLinkState', - ) - invite_link_uri = proto.Field( - proto.STRING, - number=4, - ) - create_time = proto.Field( - proto.MESSAGE, - number=5, - message=timestamp_pb2.Timestamp, - ) - update_time = proto.Field( - proto.MESSAGE, - number=6, - message=timestamp_pb2.Timestamp, - ) - public_id = proto.Field( - proto.STRING, - number=7, - ) - channel_partner_cloud_identity_info = proto.Field( - proto.MESSAGE, - number=8, - message=common.CloudIdentityInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/common.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/common.py deleted file mode 100644 index 36e671a..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/common.py +++ /dev/null @@ -1,236 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.protobuf import any_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'EduData', - 'CloudIdentityInfo', - 'Value', - 'AdminUser', - }, -) - - -class EduData(proto.Message): - r"""Required Edu Attributes - - Attributes: - institute_type (google.cloud.channel_v1.types.EduData.InstituteType): - Designated institute type of customer. - institute_size (google.cloud.channel_v1.types.EduData.InstituteSize): - Size of the institute. - website (str): - Web address for the edu customer's - institution. - """ - class InstituteType(proto.Enum): - r"""Enum to specify the institute type.""" - INSTITUTE_TYPE_UNSPECIFIED = 0 - K12 = 1 - UNIVERSITY = 2 - - class InstituteSize(proto.Enum): - r"""Number of students and staff the institute has.""" - INSTITUTE_SIZE_UNSPECIFIED = 0 - SIZE_1_100 = 1 - SIZE_101_500 = 2 - SIZE_501_1000 = 3 - SIZE_1001_2000 = 4 - SIZE_2001_5000 = 5 - SIZE_5001_10000 = 6 - SIZE_10001_OR_MORE = 7 - - institute_type = proto.Field( - proto.ENUM, - number=1, - enum=InstituteType, - ) - institute_size = proto.Field( - proto.ENUM, - number=2, - enum=InstituteSize, - ) - website = proto.Field( - proto.STRING, - number=3, - ) - - -class CloudIdentityInfo(proto.Message): - r"""Cloud Identity information for the Cloud Channel Customer. - - Attributes: - customer_type (google.cloud.channel_v1.types.CloudIdentityInfo.CustomerType): - CustomerType indicates verification type - needed for using services. - primary_domain (str): - Output only. The primary domain name. - is_domain_verified (bool): - Output only. Whether the domain is verified. This field is - not returned for a Customer's cloud_identity_info resource. - Partners can use the domains.get() method of the Workspace - SDK's Directory API, or listen to the - PRIMARY_DOMAIN_VERIFIED Pub/Sub event in to track domain - verification of their resolve Workspace customers. - alternate_email (str): - The alternate email. - phone_number (str): - Phone number associated with the Cloud - Identity. - language_code (str): - Language code. - admin_console_uri (str): - Output only. URI of Customer's Admin console - dashboard. - edu_data (google.cloud.channel_v1.types.EduData): - Edu information about the customer. - """ - class CustomerType(proto.Enum): - r"""CustomerType of the customer""" - CUSTOMER_TYPE_UNSPECIFIED = 0 - DOMAIN = 1 - TEAM = 2 - - customer_type = proto.Field( - proto.ENUM, - number=1, - enum=CustomerType, - ) - primary_domain = proto.Field( - proto.STRING, - number=9, - ) - is_domain_verified = proto.Field( - proto.BOOL, - number=4, - ) - alternate_email = proto.Field( - proto.STRING, - number=6, - ) - phone_number = proto.Field( - proto.STRING, - number=7, - ) - language_code = proto.Field( - proto.STRING, - number=8, - ) - admin_console_uri = proto.Field( - proto.STRING, - number=10, - ) - edu_data = proto.Field( - proto.MESSAGE, - number=22, - message='EduData', - ) - - -class Value(proto.Message): - r"""Data type and value of a parameter. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - int64_value (int): - Represents an int64 value. - - This field is a member of `oneof`_ ``kind``. - string_value (str): - Represents a string value. - - This field is a member of `oneof`_ ``kind``. - double_value (float): - Represents a double value. - - This field is a member of `oneof`_ ``kind``. - proto_value (google.protobuf.any_pb2.Any): - Represents an 'Any' proto value. - - This field is a member of `oneof`_ ``kind``. - bool_value (bool): - Represents a boolean value. - - This field is a member of `oneof`_ ``kind``. - """ - - int64_value = proto.Field( - proto.INT64, - number=1, - oneof='kind', - ) - string_value = proto.Field( - proto.STRING, - number=2, - oneof='kind', - ) - double_value = proto.Field( - proto.DOUBLE, - number=3, - oneof='kind', - ) - proto_value = proto.Field( - proto.MESSAGE, - number=4, - oneof='kind', - message=any_pb2.Any, - ) - bool_value = proto.Field( - proto.BOOL, - number=5, - oneof='kind', - ) - - -class AdminUser(proto.Message): - r"""Information needed to create an Admin User for Google - Workspace. - - Attributes: - email (str): - Primary email of the admin user. - given_name (str): - Given name of the admin user. - family_name (str): - Family name of the admin user. - """ - - email = proto.Field( - proto.STRING, - number=1, - ) - given_name = proto.Field( - proto.STRING, - number=2, - ) - family_name = proto.Field( - proto.STRING, - number=3, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/customers.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/customers.py deleted file mode 100644 index b008c82..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/customers.py +++ /dev/null @@ -1,194 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.channel_v1.types import common -from google.protobuf import timestamp_pb2 # type: ignore -from google.type import postal_address_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'Customer', - 'ContactInfo', - }, -) - - -class Customer(proto.Message): - r"""Entity representing a customer of a reseller or distributor. - - Attributes: - name (str): - Output only. Resource name of the customer. Format: - accounts/{account_id}/customers/{customer_id} - org_display_name (str): - Required. Name of the organization that the - customer entity represents. - org_postal_address (google.type.postal_address_pb2.PostalAddress): - Required. The organization address for the - customer. To enforce US laws and embargoes, we - require a region and zip code. You must provide - valid addresses for every customer. To set the - customer's language, use the Customer-level - language code. - primary_contact_info (google.cloud.channel_v1.types.ContactInfo): - Primary contact info. - alternate_email (str): - Secondary contact email. You need to provide - an alternate email to create different domains - if a primary contact email already exists. Users - will receive a notification with credentials - when you create an admin.google.com account. - Secondary emails are also recovery email - addresses. Alternate emails are optional when - you create Team customers. - domain (str): - Required. The customer's primary domain. Must - match the primary contact email's domain. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time when the customer was - created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Time when the customer was - updated. - cloud_identity_id (str): - Output only. The customer's Cloud Identity ID - if the customer has a Cloud Identity resource. - language_code (str): - Optional. The BCP-47 language code, such as "en-US" or - "sr-Latn". For more information, see - https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - cloud_identity_info (google.cloud.channel_v1.types.CloudIdentityInfo): - Output only. Cloud Identity information for - the customer. Populated only if a Cloud Identity - account exists for this customer. - channel_partner_id (str): - Cloud Identity ID of the customer's channel - partner. Populated only if a channel partner - exists for this customer. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - org_display_name = proto.Field( - proto.STRING, - number=2, - ) - org_postal_address = proto.Field( - proto.MESSAGE, - number=3, - message=postal_address_pb2.PostalAddress, - ) - primary_contact_info = proto.Field( - proto.MESSAGE, - number=4, - message='ContactInfo', - ) - alternate_email = proto.Field( - proto.STRING, - number=5, - ) - domain = proto.Field( - proto.STRING, - number=6, - ) - create_time = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - update_time = proto.Field( - proto.MESSAGE, - number=8, - message=timestamp_pb2.Timestamp, - ) - cloud_identity_id = proto.Field( - proto.STRING, - number=9, - ) - language_code = proto.Field( - proto.STRING, - number=10, - ) - cloud_identity_info = proto.Field( - proto.MESSAGE, - number=12, - message=common.CloudIdentityInfo, - ) - channel_partner_id = proto.Field( - proto.STRING, - number=13, - ) - - -class ContactInfo(proto.Message): - r"""Contact information for a customer account. - - Attributes: - first_name (str): - The customer account contact's first name. - Optional for Team customers. - last_name (str): - The customer account contact's last name. - Optional for Team customers. - display_name (str): - Output only. The customer account contact's - display name, formatted as a combination of the - customer's first and last name. - email (str): - The customer account's contact email. - Required for entitlements that create - admin.google.com accounts, and serves as the - customer's username for those accounts. Use this - email to invite Team customers. - title (str): - Optional. The customer account contact's job - title. - phone (str): - The customer account's contact phone number. - """ - - first_name = proto.Field( - proto.STRING, - number=1, - ) - last_name = proto.Field( - proto.STRING, - number=2, - ) - display_name = proto.Field( - proto.STRING, - number=4, - ) - email = proto.Field( - proto.STRING, - number=5, - ) - title = proto.Field( - proto.STRING, - number=6, - ) - phone = proto.Field( - proto.STRING, - number=7, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/entitlements.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/entitlements.py deleted file mode 100644 index 00021bf..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/entitlements.py +++ /dev/null @@ -1,418 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.channel_v1.types import common -from google.cloud.channel_v1.types import offers -from google.cloud.channel_v1.types import products -from google.protobuf import timestamp_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'Entitlement', - 'Parameter', - 'AssociationInfo', - 'ProvisionedService', - 'CommitmentSettings', - 'RenewalSettings', - 'TrialSettings', - 'TransferableSku', - 'TransferEligibility', - }, -) - - -class Entitlement(proto.Message): - r"""An entitlement is a representation of a customer's ability to - use a service. - - Attributes: - name (str): - Output only. Resource name of an entitlement in the form: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which the - entitlement is created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which the - entitlement is updated. - offer (str): - Required. The offer resource name for which the entitlement - is to be created. Takes the form: - accounts/{account_id}/offers/{offer_id}. - commitment_settings (google.cloud.channel_v1.types.CommitmentSettings): - Commitment settings for a commitment-based - Offer. Required for commitment based offers. - provisioning_state (google.cloud.channel_v1.types.Entitlement.ProvisioningState): - Output only. Current provisioning state of - the entitlement. - provisioned_service (google.cloud.channel_v1.types.ProvisionedService): - Output only. Service provisioning details for - the entitlement. - suspension_reasons (Sequence[google.cloud.channel_v1.types.Entitlement.SuspensionReason]): - Output only. Enumerable of all current - suspension reasons for an entitlement. - purchase_order_id (str): - Optional. This purchase order (PO) - information is for resellers to use for their - company tracking usage. If a purchaseOrderId - value is given, it appears in the API responses - and shows up in the invoice. The property - accepts up to 80 plain text characters. This is - only supported for Google Workspace - entitlements. - trial_settings (google.cloud.channel_v1.types.TrialSettings): - Output only. Settings for trial offers. - association_info (google.cloud.channel_v1.types.AssociationInfo): - Association information to other - entitlements. - parameters (Sequence[google.cloud.channel_v1.types.Parameter]): - Extended entitlement parameters. When creating an - entitlement, valid parameter names and values are defined in - the - [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions]. - - The response may include the following output-only - Parameters: - - - assigned_units: The number of licenses assigned to users. - - - max_units: The maximum assignable units for a flexible - offer. - - - num_units: The total commitment for commitment-based - offers. - """ - class ProvisioningState(proto.Enum): - r"""Indicates the current provisioning state of the entitlement.""" - PROVISIONING_STATE_UNSPECIFIED = 0 - ACTIVE = 1 - SUSPENDED = 5 - - class SuspensionReason(proto.Enum): - r"""Suspension reason for an entitlement if - [provisioning_state][google.cloud.channel.v1.Entitlement.provisioning_state] - = SUSPENDED. - """ - SUSPENSION_REASON_UNSPECIFIED = 0 - RESELLER_INITIATED = 1 - TRIAL_ENDED = 2 - RENEWAL_WITH_TYPE_CANCEL = 3 - PENDING_TOS_ACCEPTANCE = 4 - OTHER = 100 - - name = proto.Field( - proto.STRING, - number=1, - ) - create_time = proto.Field( - proto.MESSAGE, - number=5, - message=timestamp_pb2.Timestamp, - ) - update_time = proto.Field( - proto.MESSAGE, - number=6, - message=timestamp_pb2.Timestamp, - ) - offer = proto.Field( - proto.STRING, - number=8, - ) - commitment_settings = proto.Field( - proto.MESSAGE, - number=12, - message='CommitmentSettings', - ) - provisioning_state = proto.Field( - proto.ENUM, - number=13, - enum=ProvisioningState, - ) - provisioned_service = proto.Field( - proto.MESSAGE, - number=16, - message='ProvisionedService', - ) - suspension_reasons = proto.RepeatedField( - proto.ENUM, - number=18, - enum=SuspensionReason, - ) - purchase_order_id = proto.Field( - proto.STRING, - number=19, - ) - trial_settings = proto.Field( - proto.MESSAGE, - number=21, - message='TrialSettings', - ) - association_info = proto.Field( - proto.MESSAGE, - number=23, - message='AssociationInfo', - ) - parameters = proto.RepeatedField( - proto.MESSAGE, - number=26, - message='Parameter', - ) - - -class Parameter(proto.Message): - r"""Definition for extended entitlement parameters. - - Attributes: - name (str): - Name of the parameter. - value (google.cloud.channel_v1.types.Value): - Value of the parameter. - editable (bool): - Output only. Specifies whether this parameter is allowed to - be changed. For example, for a Google Workspace Business - Starter entitlement in commitment plan, num_units is - editable when entitlement is active. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - value = proto.Field( - proto.MESSAGE, - number=2, - message=common.Value, - ) - editable = proto.Field( - proto.BOOL, - number=3, - ) - - -class AssociationInfo(proto.Message): - r"""Association links that an entitlement has to other - entitlements. - - Attributes: - base_entitlement (str): - The name of the base entitlement, for which - this entitlement is an add-on. - """ - - base_entitlement = proto.Field( - proto.STRING, - number=1, - ) - - -class ProvisionedService(proto.Message): - r"""Service provisioned for an entitlement. - - Attributes: - provisioning_id (str): - Output only. Provisioning ID of the - entitlement. For Google Workspace, this is the - underlying Subscription ID. For Google Cloud - Platform, this is the Billing Account ID of the - billing subaccount.". - product_id (str): - Output only. The product pertaining to the - provisioning resource as specified in the Offer. - sku_id (str): - Output only. The SKU pertaining to the - provisioning resource as specified in the Offer. - """ - - provisioning_id = proto.Field( - proto.STRING, - number=1, - ) - product_id = proto.Field( - proto.STRING, - number=2, - ) - sku_id = proto.Field( - proto.STRING, - number=3, - ) - - -class CommitmentSettings(proto.Message): - r"""Commitment settings for commitment-based offers. - - Attributes: - start_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Commitment start timestamp. - end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Commitment end timestamp. - renewal_settings (google.cloud.channel_v1.types.RenewalSettings): - Optional. Renewal settings applicable for a - commitment-based Offer. - """ - - start_time = proto.Field( - proto.MESSAGE, - number=1, - message=timestamp_pb2.Timestamp, - ) - end_time = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - renewal_settings = proto.Field( - proto.MESSAGE, - number=4, - message='RenewalSettings', - ) - - -class RenewalSettings(proto.Message): - r"""Renewal settings for renewable Offers. - - Attributes: - enable_renewal (bool): - If false, the plan will be completed at the - end date. - resize_unit_count (bool): - If true and enable_renewal = true, the unit (for example - seats or licenses) will be set to the number of active units - at renewal time. - payment_plan (google.cloud.channel_v1.types.PaymentPlan): - Describes how a reseller will be billed. - payment_cycle (google.cloud.channel_v1.types.Period): - Describes how frequently the reseller will be - billed, such as once per month. - """ - - enable_renewal = proto.Field( - proto.BOOL, - number=1, - ) - resize_unit_count = proto.Field( - proto.BOOL, - number=2, - ) - payment_plan = proto.Field( - proto.ENUM, - number=5, - enum=offers.PaymentPlan, - ) - payment_cycle = proto.Field( - proto.MESSAGE, - number=6, - message=offers.Period, - ) - - -class TrialSettings(proto.Message): - r"""Settings for trial offers. - - Attributes: - trial (bool): - Determines if the entitlement is in a trial or not: - - - ``true`` - The entitlement is in trial. - - ``false`` - The entitlement is not in trial. - end_time (google.protobuf.timestamp_pb2.Timestamp): - Date when the trial ends. The value is in milliseconds using - the UNIX Epoch format. See an example `Epoch - converter `__. - """ - - trial = proto.Field( - proto.BOOL, - number=1, - ) - end_time = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - - -class TransferableSku(proto.Message): - r"""TransferableSku represents information a reseller needs to - view existing provisioned services for a customer that they do - not own. Read-only. - - Attributes: - transfer_eligibility (google.cloud.channel_v1.types.TransferEligibility): - Describes the transfer eligibility of a SKU. - sku (google.cloud.channel_v1.types.Sku): - The SKU pertaining to the provisioning - resource as specified in the Offer. - legacy_sku (google.cloud.channel_v1.types.Sku): - Optional. The customer to transfer has an - entitlement with the populated legacy SKU. - """ - - transfer_eligibility = proto.Field( - proto.MESSAGE, - number=9, - message='TransferEligibility', - ) - sku = proto.Field( - proto.MESSAGE, - number=11, - message=products.Sku, - ) - legacy_sku = proto.Field( - proto.MESSAGE, - number=12, - message=products.Sku, - ) - - -class TransferEligibility(proto.Message): - r"""Specifies transfer eligibility of a SKU. - - Attributes: - is_eligible (bool): - Whether reseller is eligible to transfer the - SKU. - description (str): - Localized description if reseller is not - eligible to transfer the SKU. - ineligibility_reason (google.cloud.channel_v1.types.TransferEligibility.Reason): - Specified the reason for ineligibility. - """ - class Reason(proto.Enum): - r"""Reason of ineligibility.""" - REASON_UNSPECIFIED = 0 - PENDING_TOS_ACCEPTANCE = 1 - SKU_NOT_ELIGIBLE = 2 - SKU_SUSPENDED = 3 - - is_eligible = proto.Field( - proto.BOOL, - number=1, - ) - description = proto.Field( - proto.STRING, - number=2, - ) - ineligibility_reason = proto.Field( - proto.ENUM, - number=3, - enum=Reason, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/offers.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/offers.py deleted file mode 100644 index 51750c5..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/offers.py +++ /dev/null @@ -1,503 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.channel_v1.types import common -from google.cloud.channel_v1.types import products -from google.protobuf import timestamp_pb2 # type: ignore -from google.type import money_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'PromotionalOrderType', - 'PaymentPlan', - 'PaymentType', - 'ResourceType', - 'PeriodType', - 'Offer', - 'ParameterDefinition', - 'Constraints', - 'CustomerConstraints', - 'Plan', - 'PriceByResource', - 'Price', - 'PricePhase', - 'PriceTier', - 'Period', - }, -) - - -class PromotionalOrderType(proto.Enum): - r"""Constraints type for Promotional offers.""" - PROMOTIONAL_TYPE_UNSPECIFIED = 0 - NEW_UPGRADE = 1 - TRANSFER = 2 - PROMOTION_SWITCH = 3 - - -class PaymentPlan(proto.Enum): - r"""Describes how the reseller will be billed.""" - PAYMENT_PLAN_UNSPECIFIED = 0 - COMMITMENT = 1 - FLEXIBLE = 2 - FREE = 3 - TRIAL = 4 - OFFLINE = 5 - - -class PaymentType(proto.Enum): - r"""Specifies when the payment needs to happen.""" - PAYMENT_TYPE_UNSPECIFIED = 0 - PREPAY = 1 - POSTPAY = 2 - - -class ResourceType(proto.Enum): - r"""Represents the type for a monetizable resource(any entity on - which billing happens). For example, this could be MINUTES for - Google Voice and GB for Google Drive. One SKU can map to - multiple monetizable resources. - """ - RESOURCE_TYPE_UNSPECIFIED = 0 - SEAT = 1 - MAU = 2 - GB = 3 - LICENSED_USER = 4 - MINUTES = 5 - IAAS_USAGE = 6 - SUBSCRIPTION = 7 - - -class PeriodType(proto.Enum): - r"""Period Type.""" - PERIOD_TYPE_UNSPECIFIED = 0 - DAY = 1 - MONTH = 2 - YEAR = 3 - - -class Offer(proto.Message): - r"""Represents an offer made to resellers for purchase. An offer is - associated with a [Sku][google.cloud.channel.v1.Sku], has a plan for - payment, a price, and defines the constraints for buying. - - Attributes: - name (str): - Resource Name of the Offer. Format: - accounts/{account_id}/offers/{offer_id} - marketing_info (google.cloud.channel_v1.types.MarketingInfo): - Marketing information for the Offer. - sku (google.cloud.channel_v1.types.Sku): - SKU the offer is associated with. - plan (google.cloud.channel_v1.types.Plan): - Describes the payment plan for the Offer. - constraints (google.cloud.channel_v1.types.Constraints): - Constraints on transacting the Offer. - price_by_resources (Sequence[google.cloud.channel_v1.types.PriceByResource]): - Price for each monetizable resource type. - start_time (google.protobuf.timestamp_pb2.Timestamp): - Start of the Offer validity time. - end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. End of the Offer validity time. - parameter_definitions (Sequence[google.cloud.channel_v1.types.ParameterDefinition]): - Parameters required to use current Offer to - purchase. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - marketing_info = proto.Field( - proto.MESSAGE, - number=2, - message=products.MarketingInfo, - ) - sku = proto.Field( - proto.MESSAGE, - number=3, - message=products.Sku, - ) - plan = proto.Field( - proto.MESSAGE, - number=4, - message='Plan', - ) - constraints = proto.Field( - proto.MESSAGE, - number=5, - message='Constraints', - ) - price_by_resources = proto.RepeatedField( - proto.MESSAGE, - number=6, - message='PriceByResource', - ) - start_time = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - end_time = proto.Field( - proto.MESSAGE, - number=8, - message=timestamp_pb2.Timestamp, - ) - parameter_definitions = proto.RepeatedField( - proto.MESSAGE, - number=9, - message='ParameterDefinition', - ) - - -class ParameterDefinition(proto.Message): - r"""Parameter's definition. Specifies what parameter is required - to use the current Offer to purchase. - - Attributes: - name (str): - Name of the parameter. - parameter_type (google.cloud.channel_v1.types.ParameterDefinition.ParameterType): - Data type of the parameter. Minimal value, - Maximum value and allowed values will use - specified data type here. - min_value (google.cloud.channel_v1.types.Value): - Minimal value of the parameter, if - applicable. Inclusive. For example, minimal - commitment when purchasing Anthos is 0.01. - Applicable to INT64 and DOUBLE parameter types. - max_value (google.cloud.channel_v1.types.Value): - Maximum value of the parameter, if - applicable. Inclusive. For example, maximum - seats when purchasing Google Workspace Business - Standard. Applicable to INT64 and DOUBLE - parameter types. - allowed_values (Sequence[google.cloud.channel_v1.types.Value]): - If not empty, parameter values must be drawn from this list. - For example, [us-west1, us-west2, ...] Applicable to STRING - parameter type. - optional (bool): - If set to true, parameter is optional to - purchase this Offer. - """ - class ParameterType(proto.Enum): - r"""Data type of the parameter.""" - PARAMETER_TYPE_UNSPECIFIED = 0 - INT64 = 1 - STRING = 2 - DOUBLE = 3 - - name = proto.Field( - proto.STRING, - number=1, - ) - parameter_type = proto.Field( - proto.ENUM, - number=2, - enum=ParameterType, - ) - min_value = proto.Field( - proto.MESSAGE, - number=3, - message=common.Value, - ) - max_value = proto.Field( - proto.MESSAGE, - number=4, - message=common.Value, - ) - allowed_values = proto.RepeatedField( - proto.MESSAGE, - number=5, - message=common.Value, - ) - optional = proto.Field( - proto.BOOL, - number=6, - ) - - -class Constraints(proto.Message): - r"""Represents the constraints for buying the Offer. - - Attributes: - customer_constraints (google.cloud.channel_v1.types.CustomerConstraints): - Represents constraints required to purchase - the Offer for a customer. - """ - - customer_constraints = proto.Field( - proto.MESSAGE, - number=1, - message='CustomerConstraints', - ) - - -class CustomerConstraints(proto.Message): - r"""Represents constraints required to purchase the Offer for a - customer. - - Attributes: - allowed_regions (Sequence[str]): - Allowed geographical regions of the customer. - allowed_customer_types (Sequence[google.cloud.channel_v1.types.CloudIdentityInfo.CustomerType]): - Allowed Customer Type. - promotional_order_types (Sequence[google.cloud.channel_v1.types.PromotionalOrderType]): - Allowed Promotional Order Type. Present for - Promotional offers. - """ - - allowed_regions = proto.RepeatedField( - proto.STRING, - number=1, - ) - allowed_customer_types = proto.RepeatedField( - proto.ENUM, - number=2, - enum=common.CloudIdentityInfo.CustomerType, - ) - promotional_order_types = proto.RepeatedField( - proto.ENUM, - number=3, - enum='PromotionalOrderType', - ) - - -class Plan(proto.Message): - r"""The payment plan for the Offer. Describes how to make a - payment. - - Attributes: - payment_plan (google.cloud.channel_v1.types.PaymentPlan): - Describes how a reseller will be billed. - payment_type (google.cloud.channel_v1.types.PaymentType): - Specifies when the payment needs to happen. - payment_cycle (google.cloud.channel_v1.types.Period): - Describes how frequently the reseller will be - billed, such as once per month. - trial_period (google.cloud.channel_v1.types.Period): - Present for Offers with a trial period. - For trial-only Offers, a paid service needs to - start before the trial period ends for continued - service. - For Regular Offers with a trial period, the - regular pricing goes into effect when trial - period ends, or if paid service is started - before the end of the trial period. - billing_account (str): - Reseller Billing account to charge after an - offer transaction. Only present for Google Cloud - Platform offers. - """ - - payment_plan = proto.Field( - proto.ENUM, - number=1, - enum='PaymentPlan', - ) - payment_type = proto.Field( - proto.ENUM, - number=2, - enum='PaymentType', - ) - payment_cycle = proto.Field( - proto.MESSAGE, - number=3, - message='Period', - ) - trial_period = proto.Field( - proto.MESSAGE, - number=4, - message='Period', - ) - billing_account = proto.Field( - proto.STRING, - number=5, - ) - - -class PriceByResource(proto.Message): - r"""Represents price by resource type. - - Attributes: - resource_type (google.cloud.channel_v1.types.ResourceType): - Resource Type. Example: SEAT - price (google.cloud.channel_v1.types.Price): - Price of the Offer. Present if there are no - price phases. - price_phases (Sequence[google.cloud.channel_v1.types.PricePhase]): - Specifies the price by time range. - """ - - resource_type = proto.Field( - proto.ENUM, - number=1, - enum='ResourceType', - ) - price = proto.Field( - proto.MESSAGE, - number=2, - message='Price', - ) - price_phases = proto.RepeatedField( - proto.MESSAGE, - number=3, - message='PricePhase', - ) - - -class Price(proto.Message): - r"""Represents the price of the Offer. - - Attributes: - base_price (google.type.money_pb2.Money): - Base price. - discount (float): - Discount percentage, represented as decimal. - For example, a 20% discount will be represent as - 0.2. - effective_price (google.type.money_pb2.Money): - Effective Price after applying the discounts. - external_price_uri (str): - Link to external price list, such as link to - Google Voice rate card. - """ - - base_price = proto.Field( - proto.MESSAGE, - number=1, - message=money_pb2.Money, - ) - discount = proto.Field( - proto.DOUBLE, - number=2, - ) - effective_price = proto.Field( - proto.MESSAGE, - number=3, - message=money_pb2.Money, - ) - external_price_uri = proto.Field( - proto.STRING, - number=4, - ) - - -class PricePhase(proto.Message): - r"""Specifies the price by the duration of months. - For example, a 20% discount for the first six months, then a 10% - discount starting on the seventh month. - - Attributes: - period_type (google.cloud.channel_v1.types.PeriodType): - Defines the phase period type. - first_period (int): - Defines first period for the phase. - last_period (int): - Defines first period for the phase. - price (google.cloud.channel_v1.types.Price): - Price of the phase. Present if there are no - price tiers. - price_tiers (Sequence[google.cloud.channel_v1.types.PriceTier]): - Price by the resource tiers. - """ - - period_type = proto.Field( - proto.ENUM, - number=1, - enum='PeriodType', - ) - first_period = proto.Field( - proto.INT32, - number=2, - ) - last_period = proto.Field( - proto.INT32, - number=3, - ) - price = proto.Field( - proto.MESSAGE, - number=4, - message='Price', - ) - price_tiers = proto.RepeatedField( - proto.MESSAGE, - number=5, - message='PriceTier', - ) - - -class PriceTier(proto.Message): - r"""Defines price at resource tier level. For example, an offer with - following definition : - - - Tier 1: Provide 25% discount for all seats between 1 and 25. - - Tier 2: Provide 10% discount for all seats between 26 and 100. - - Tier 3: Provide flat 15% discount for all seats above 100. - - Each of these tiers is represented as a PriceTier. - - Attributes: - first_resource (int): - First resource for which the tier price - applies. - last_resource (int): - Last resource for which the tier price - applies. - price (google.cloud.channel_v1.types.Price): - Price of the tier. - """ - - first_resource = proto.Field( - proto.INT32, - number=1, - ) - last_resource = proto.Field( - proto.INT32, - number=2, - ) - price = proto.Field( - proto.MESSAGE, - number=3, - message='Price', - ) - - -class Period(proto.Message): - r"""Represents period in days/months/years. - - Attributes: - duration (int): - Total duration of Period Type defined. - period_type (google.cloud.channel_v1.types.PeriodType): - Period Type. - """ - - duration = proto.Field( - proto.INT32, - number=1, - ) - period_type = proto.Field( - proto.ENUM, - number=2, - enum='PeriodType', - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/operations.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/operations.py deleted file mode 100644 index 16098fc..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/operations.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'OperationMetadata', - }, -) - - -class OperationMetadata(proto.Message): - r"""Provides contextual information about a - [google.longrunning.Operation][google.longrunning.Operation]. - - Attributes: - operation_type (google.cloud.channel_v1.types.OperationMetadata.OperationType): - The RPC that initiated this Long Running - Operation. - """ - class OperationType(proto.Enum): - r"""RPCs that return a Long Running Operation.""" - OPERATION_TYPE_UNSPECIFIED = 0 - CREATE_ENTITLEMENT = 1 - CHANGE_RENEWAL_SETTINGS = 3 - START_PAID_SERVICE = 5 - ACTIVATE_ENTITLEMENT = 7 - SUSPEND_ENTITLEMENT = 8 - CANCEL_ENTITLEMENT = 9 - TRANSFER_ENTITLEMENTS = 10 - TRANSFER_ENTITLEMENTS_TO_GOOGLE = 11 - CHANGE_OFFER = 14 - CHANGE_PARAMETERS = 15 - PROVISION_CLOUD_IDENTITY = 16 - - operation_type = proto.Field( - proto.ENUM, - number=1, - enum=OperationType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/products.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/products.py deleted file mode 100644 index a4f6312..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/products.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'MediaType', - 'Product', - 'Sku', - 'MarketingInfo', - 'Media', - }, -) - - -class MediaType(proto.Enum): - r"""Type of media used.""" - MEDIA_TYPE_UNSPECIFIED = 0 - MEDIA_TYPE_IMAGE = 1 - - -class Product(proto.Message): - r"""A Product is the entity a customer uses when placing an - order. For example, Google Workspace, Google Voice, etc. - - Attributes: - name (str): - Resource Name of the Product. Format: products/{product_id} - marketing_info (google.cloud.channel_v1.types.MarketingInfo): - Marketing information for the product. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - marketing_info = proto.Field( - proto.MESSAGE, - number=2, - message='MarketingInfo', - ) - - -class Sku(proto.Message): - r"""Represents a product's purchasable Stock Keeping Unit (SKU). - SKUs represent the different variations of the product. For - example, Google Workspace Business Standard and Google Workspace - Business Plus are Google Workspace product SKUs. - - Attributes: - name (str): - Resource Name of the SKU. Format: - products/{product_id}/skus/{sku_id} - marketing_info (google.cloud.channel_v1.types.MarketingInfo): - Marketing information for the SKU. - product (google.cloud.channel_v1.types.Product): - Product the SKU is associated with. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - marketing_info = proto.Field( - proto.MESSAGE, - number=2, - message='MarketingInfo', - ) - product = proto.Field( - proto.MESSAGE, - number=3, - message='Product', - ) - - -class MarketingInfo(proto.Message): - r"""Represents the marketing information for a Product, SKU or - Offer. - - Attributes: - display_name (str): - Human readable name. - description (str): - Human readable description. Description can - contain HTML. - default_logo (google.cloud.channel_v1.types.Media): - Default logo. - """ - - display_name = proto.Field( - proto.STRING, - number=1, - ) - description = proto.Field( - proto.STRING, - number=2, - ) - default_logo = proto.Field( - proto.MESSAGE, - number=3, - message='Media', - ) - - -class Media(proto.Message): - r"""Represents media information. - - Attributes: - title (str): - Title of the media. - content (str): - URL of the media. - type_ (google.cloud.channel_v1.types.MediaType): - Type of the media. - """ - - title = proto.Field( - proto.STRING, - number=1, - ) - content = proto.Field( - proto.STRING, - number=2, - ) - type_ = proto.Field( - proto.ENUM, - number=3, - enum='MediaType', - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/repricing.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/repricing.py deleted file mode 100644 index 66758cd..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/repricing.py +++ /dev/null @@ -1,247 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.protobuf import timestamp_pb2 # type: ignore -from google.type import date_pb2 # type: ignore -from google.type import decimal_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'RebillingBasis', - 'CustomerRepricingConfig', - 'ChannelPartnerRepricingConfig', - 'RepricingConfig', - 'RepricingAdjustment', - 'PercentageAdjustment', - }, -) - - -class RebillingBasis(proto.Enum): - r"""Specifies the different costs that the modified bill can be - based on. - """ - REBILLING_BASIS_UNSPECIFIED = 0 - COST_AT_LIST = 1 - DIRECT_CUSTOMER_COST = 2 - - -class CustomerRepricingConfig(proto.Message): - r"""Configuration for how a reseller will reprice a Customer. - - Attributes: - name (str): - Output only. Resource name of the CustomerRepricingConfig. - Format: - accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. - repricing_config (google.cloud.channel_v1.types.RepricingConfig): - Required. The configuration for bill - modifications made by a reseller before sending - it to customers. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Timestamp of an update to the repricing rule. - If ``update_time`` is after - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - then it indicates this was set mid-month. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - repricing_config = proto.Field( - proto.MESSAGE, - number=2, - message='RepricingConfig', - ) - update_time = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - - -class ChannelPartnerRepricingConfig(proto.Message): - r"""Configuration for how a distributor will rebill a channel - partner (also known as a distributor-authorized reseller). - - Attributes: - name (str): - Output only. Resource name of the - ChannelPartnerRepricingConfig. Format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}. - repricing_config (google.cloud.channel_v1.types.RepricingConfig): - Required. The configuration for bill - modifications made by a reseller before sending - it to ChannelPartner. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. Timestamp of an update to the repricing rule. - If ``update_time`` is after - [RepricingConfig.effective_invoice_month][google.cloud.channel.v1.RepricingConfig.effective_invoice_month] - then it indicates this was set mid-month. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - repricing_config = proto.Field( - proto.MESSAGE, - number=2, - message='RepricingConfig', - ) - update_time = proto.Field( - proto.MESSAGE, - number=3, - message=timestamp_pb2.Timestamp, - ) - - -class RepricingConfig(proto.Message): - r"""Configuration for repricing a Google bill over a period of - time. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - entitlement_granularity (google.cloud.channel_v1.types.RepricingConfig.EntitlementGranularity): - Applies the repricing configuration at the - entitlement level. This is the only supported - value for CustomerRepricingConfig. - - This field is a member of `oneof`_ ``granularity``. - channel_partner_granularity (google.cloud.channel_v1.types.RepricingConfig.ChannelPartnerGranularity): - Applies the repricing configuration at the - channel partner level. This is the only - supported value for - ChannelPartnerRepricingConfig. - - This field is a member of `oneof`_ ``granularity``. - effective_invoice_month (google.type.date_pb2.Date): - Required. The YearMonth when these - adjustments activate. The Day field needs to be - "0" since we only accept YearMonth repricing - boundaries. - adjustment (google.cloud.channel_v1.types.RepricingAdjustment): - Required. Information about the adjustment. - rebilling_basis (google.cloud.channel_v1.types.RebillingBasis): - Required. The - [RebillingBasis][google.cloud.channel.v1.RebillingBasis] to - use for this bill. Specifies the relative cost based on - repricing costs you will apply. - """ - - class EntitlementGranularity(proto.Message): - r"""Applies the repricing configuration at the entitlement level. - - Attributes: - entitlement (str): - Resource name of the entitlement. Format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - """ - - entitlement = proto.Field( - proto.STRING, - number=1, - ) - - class ChannelPartnerGranularity(proto.Message): - r"""Applies the repricing configuration at the channel partner - level. The channel partner value is derived from the resource - name. Takes an empty json object. - - """ - - entitlement_granularity = proto.Field( - proto.MESSAGE, - number=4, - oneof='granularity', - message=EntitlementGranularity, - ) - channel_partner_granularity = proto.Field( - proto.MESSAGE, - number=5, - oneof='granularity', - message=ChannelPartnerGranularity, - ) - effective_invoice_month = proto.Field( - proto.MESSAGE, - number=1, - message=date_pb2.Date, - ) - adjustment = proto.Field( - proto.MESSAGE, - number=2, - message='RepricingAdjustment', - ) - rebilling_basis = proto.Field( - proto.ENUM, - number=3, - enum='RebillingBasis', - ) - - -class RepricingAdjustment(proto.Message): - r"""A type that represents the various adjustments you can apply - to a bill. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - percentage_adjustment (google.cloud.channel_v1.types.PercentageAdjustment): - Flat markup or markdown on an entire bill. - - This field is a member of `oneof`_ ``adjustment``. - """ - - percentage_adjustment = proto.Field( - proto.MESSAGE, - number=2, - oneof='adjustment', - message='PercentageAdjustment', - ) - - -class PercentageAdjustment(proto.Message): - r"""An adjustment that applies a flat markup or markdown to an - entire bill. - - Attributes: - percentage (google.type.decimal_pb2.Decimal): - The percentage of the bill to adjust. - For example: - Mark down by 1% => "-1.00" - Mark up by 1% => "1.00" - Pass-Through => "0.00". - """ - - percentage = proto.Field( - proto.MESSAGE, - number=2, - message=decimal_pb2.Decimal, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/service.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/service.py deleted file mode 100644 index 4d07ae8..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/service.py +++ /dev/null @@ -1,2391 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - -from google.cloud.channel_v1.types import channel_partner_links as gcc_channel_partner_links -from google.cloud.channel_v1.types import common -from google.cloud.channel_v1.types import customers as gcc_customers -from google.cloud.channel_v1.types import entitlements as gcc_entitlements -from google.cloud.channel_v1.types import offers as gcc_offers -from google.cloud.channel_v1.types import products as gcc_products -from google.cloud.channel_v1.types import repricing -from google.protobuf import field_mask_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'CheckCloudIdentityAccountsExistRequest', - 'CloudIdentityCustomerAccount', - 'CheckCloudIdentityAccountsExistResponse', - 'ListCustomersRequest', - 'ListCustomersResponse', - 'GetCustomerRequest', - 'CreateCustomerRequest', - 'UpdateCustomerRequest', - 'DeleteCustomerRequest', - 'ImportCustomerRequest', - 'ProvisionCloudIdentityRequest', - 'ListEntitlementsRequest', - 'ListEntitlementsResponse', - 'ListTransferableSkusRequest', - 'ListTransferableSkusResponse', - 'ListTransferableOffersRequest', - 'ListTransferableOffersResponse', - 'TransferableOffer', - 'GetEntitlementRequest', - 'ListChannelPartnerLinksRequest', - 'ListChannelPartnerLinksResponse', - 'GetChannelPartnerLinkRequest', - 'CreateChannelPartnerLinkRequest', - 'UpdateChannelPartnerLinkRequest', - 'GetCustomerRepricingConfigRequest', - 'ListCustomerRepricingConfigsRequest', - 'ListCustomerRepricingConfigsResponse', - 'CreateCustomerRepricingConfigRequest', - 'UpdateCustomerRepricingConfigRequest', - 'DeleteCustomerRepricingConfigRequest', - 'GetChannelPartnerRepricingConfigRequest', - 'ListChannelPartnerRepricingConfigsRequest', - 'ListChannelPartnerRepricingConfigsResponse', - 'CreateChannelPartnerRepricingConfigRequest', - 'UpdateChannelPartnerRepricingConfigRequest', - 'DeleteChannelPartnerRepricingConfigRequest', - 'CreateEntitlementRequest', - 'TransferEntitlementsRequest', - 'TransferEntitlementsResponse', - 'TransferEntitlementsToGoogleRequest', - 'ChangeParametersRequest', - 'ChangeRenewalSettingsRequest', - 'ChangeOfferRequest', - 'StartPaidServiceRequest', - 'CancelEntitlementRequest', - 'SuspendEntitlementRequest', - 'ActivateEntitlementRequest', - 'LookupOfferRequest', - 'ListProductsRequest', - 'ListProductsResponse', - 'ListSkusRequest', - 'ListSkusResponse', - 'ListOffersRequest', - 'ListOffersResponse', - 'ListPurchasableSkusRequest', - 'ListPurchasableSkusResponse', - 'PurchasableSku', - 'ListPurchasableOffersRequest', - 'ListPurchasableOffersResponse', - 'PurchasableOffer', - 'RegisterSubscriberRequest', - 'RegisterSubscriberResponse', - 'UnregisterSubscriberRequest', - 'UnregisterSubscriberResponse', - 'ListSubscribersRequest', - 'ListSubscribersResponse', - }, -) - - -class CheckCloudIdentityAccountsExistRequest(proto.Message): - r"""Request message for - [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. - - Attributes: - parent (str): - Required. The reseller account's resource name. Parent uses - the format: accounts/{account_id} - domain (str): - Required. Domain to fetch for Cloud Identity - account customer. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - domain = proto.Field( - proto.STRING, - number=2, - ) - - -class CloudIdentityCustomerAccount(proto.Message): - r"""Entity representing a Cloud Identity account that may be - associated with a Channel Services API partner. - - Attributes: - existing (bool): - Returns true if a Cloud Identity account - exists for a specific domain. - owned (bool): - Returns true if the Cloud Identity account is - associated with a customer of the Channel - Services partner. - customer_name (str): - If owned = true, the name of the customer that owns the - Cloud Identity account. Customer_name uses the format: - accounts/{account_id}/customers/{customer_id} - customer_cloud_identity_id (str): - If existing = true, the Cloud Identity ID of - the customer. - """ - - existing = proto.Field( - proto.BOOL, - number=1, - ) - owned = proto.Field( - proto.BOOL, - number=2, - ) - customer_name = proto.Field( - proto.STRING, - number=3, - ) - customer_cloud_identity_id = proto.Field( - proto.STRING, - number=4, - ) - - -class CheckCloudIdentityAccountsExistResponse(proto.Message): - r"""Response message for - [CloudChannelService.CheckCloudIdentityAccountsExist][google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist]. - - Attributes: - cloud_identity_accounts (Sequence[google.cloud.channel_v1.types.CloudIdentityCustomerAccount]): - The Cloud Identity accounts associated with - the domain. - """ - - cloud_identity_accounts = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='CloudIdentityCustomerAccount', - ) - - -class ListCustomersRequest(proto.Message): - r"""Request message for - [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers] - - Attributes: - parent (str): - Required. The resource name of the reseller account to list - customers from. Parent uses the format: - accounts/{account_id}. - page_size (int): - Optional. The maximum number of customers to - return. The service may return fewer than this - value. If unspecified, returns at most 10 - customers. The maximum value is 50. - page_token (str): - Optional. A token identifying a page of results other than - the first page. Obtained through - [ListCustomersResponse.next_page_token][google.cloud.channel.v1.ListCustomersResponse.next_page_token] - of the previous - [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers] - call. - filter (str): - Optional. Filters applied to the - [CloudChannelService.ListCustomers] results. See - https://cloud.google.com/channel/docs/concepts/google-cloud/filter-customers - for more information. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - filter = proto.Field( - proto.STRING, - number=4, - ) - - -class ListCustomersResponse(proto.Message): - r"""Response message for - [CloudChannelService.ListCustomers][google.cloud.channel.v1.CloudChannelService.ListCustomers]. - - Attributes: - customers (Sequence[google.cloud.channel_v1.types.Customer]): - The customers belonging to a reseller or - distributor. - next_page_token (str): - A token to retrieve the next page of results. Pass to - [ListCustomersRequest.page_token][google.cloud.channel.v1.ListCustomersRequest.page_token] - to obtain that page. - """ - - @property - def raw_page(self): - return self - - customers = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=gcc_customers.Customer, - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class GetCustomerRequest(proto.Message): - r"""Request message for - [CloudChannelService.GetCustomer][google.cloud.channel.v1.CloudChannelService.GetCustomer]. - - Attributes: - name (str): - Required. The resource name of the customer to retrieve. - Name uses the format: - accounts/{account_id}/customers/{customer_id} - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateCustomerRequest(proto.Message): - r"""Request message for - [CloudChannelService.CreateCustomer][google.cloud.channel.v1.CloudChannelService.CreateCustomer] - - Attributes: - parent (str): - Required. The resource name of reseller account in which to - create the customer. Parent uses the format: - accounts/{account_id} - customer (google.cloud.channel_v1.types.Customer): - Required. The customer to create. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - customer = proto.Field( - proto.MESSAGE, - number=2, - message=gcc_customers.Customer, - ) - - -class UpdateCustomerRequest(proto.Message): - r"""Request message for - [CloudChannelService.UpdateCustomer][google.cloud.channel.v1.CloudChannelService.UpdateCustomer]. - - Attributes: - customer (google.cloud.channel_v1.types.Customer): - Required. New contents of the customer. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - The update mask that applies to the resource. - Optional. - """ - - customer = proto.Field( - proto.MESSAGE, - number=2, - message=gcc_customers.Customer, - ) - update_mask = proto.Field( - proto.MESSAGE, - number=3, - message=field_mask_pb2.FieldMask, - ) - - -class DeleteCustomerRequest(proto.Message): - r"""Request message for - [CloudChannelService.DeleteCustomer][google.cloud.channel.v1.CloudChannelService.DeleteCustomer]. - - Attributes: - name (str): - Required. The resource name of the customer - to delete. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class ImportCustomerRequest(proto.Message): - r"""Request message for - [CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer] - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - domain (str): - Required. Customer domain. - - This field is a member of `oneof`_ ``customer_identity``. - cloud_identity_id (str): - Required. Customer's Cloud Identity ID - - This field is a member of `oneof`_ ``customer_identity``. - parent (str): - Required. The resource name of the reseller's account. - Parent takes the format: accounts/{account_id} or - accounts/{account_id}/channelPartnerLinks/{channel_partner_id} - auth_token (str): - Optional. The super admin of the resold - customer generates this token to authorize a - reseller to access their Cloud Identity and - purchase entitlements on their behalf. You can - omit this token after authorization. See - https://support.google.com/a/answer/7643790 for - more details. - overwrite_if_exists (bool): - Required. Choose to overwrite an existing - customer if found. This must be set to true if - there is an existing customer with a conflicting - region code or domain. - channel_partner_id (str): - Optional. Cloud Identity ID of a channel - partner who will be the direct reseller for the - customer's order. This field is required for - 2-tier transfer scenarios and can be provided - via the request Parent binding as well. - customer (str): - Optional. Specifies the customer that will receive imported - Cloud Identity information. Format: - accounts/{account_id}/customers/{customer_id} - """ - - domain = proto.Field( - proto.STRING, - number=2, - oneof='customer_identity', - ) - cloud_identity_id = proto.Field( - proto.STRING, - number=3, - oneof='customer_identity', - ) - parent = proto.Field( - proto.STRING, - number=1, - ) - auth_token = proto.Field( - proto.STRING, - number=4, - ) - overwrite_if_exists = proto.Field( - proto.BOOL, - number=5, - ) - channel_partner_id = proto.Field( - proto.STRING, - number=6, - ) - customer = proto.Field( - proto.STRING, - number=7, - ) - - -class ProvisionCloudIdentityRequest(proto.Message): - r"""Request message for - [CloudChannelService.ProvisionCloudIdentity][google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity] - - Attributes: - customer (str): - Required. Resource name of the customer. Format: - accounts/{account_id}/customers/{customer_id} - cloud_identity_info (google.cloud.channel_v1.types.CloudIdentityInfo): - CloudIdentity-specific customer information. - user (google.cloud.channel_v1.types.AdminUser): - Admin user information. - validate_only (bool): - Validate the request and preview the review, - but do not post it. - """ - - customer = proto.Field( - proto.STRING, - number=1, - ) - cloud_identity_info = proto.Field( - proto.MESSAGE, - number=2, - message=common.CloudIdentityInfo, - ) - user = proto.Field( - proto.MESSAGE, - number=3, - message=common.AdminUser, - ) - validate_only = proto.Field( - proto.BOOL, - number=4, - ) - - -class ListEntitlementsRequest(proto.Message): - r"""Request message for - [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements] - - Attributes: - parent (str): - Required. The resource name of the reseller's customer - account to list entitlements for. Parent uses the format: - accounts/{account_id}/customers/{customer_id} - page_size (int): - Optional. Requested page size. Server might - return fewer results than requested. If - unspecified, return at most 50 entitlements. The - maximum value is 100; the server will coerce - values above 100. - page_token (str): - Optional. A token for a page of results other than the first - page. Obtained using - [ListEntitlementsResponse.next_page_token][google.cloud.channel.v1.ListEntitlementsResponse.next_page_token] - of the previous - [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements] - call. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - - -class ListEntitlementsResponse(proto.Message): - r"""Response message for - [CloudChannelService.ListEntitlements][google.cloud.channel.v1.CloudChannelService.ListEntitlements]. - - Attributes: - entitlements (Sequence[google.cloud.channel_v1.types.Entitlement]): - The reseller customer's entitlements. - next_page_token (str): - A token to list the next page of results. Pass to - [ListEntitlementsRequest.page_token][google.cloud.channel.v1.ListEntitlementsRequest.page_token] - to obtain that page. - """ - - @property - def raw_page(self): - return self - - entitlements = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=gcc_entitlements.Entitlement, - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class ListTransferableSkusRequest(proto.Message): - r"""Request message for - [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus] - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - cloud_identity_id (str): - Customer's Cloud Identity ID - - This field is a member of `oneof`_ ``transferred_customer_identity``. - customer_name (str): - A reseller is required to create a customer and use the - resource name of the created customer here. Customer_name - uses the format: - accounts/{account_id}/customers/{customer_id} - - This field is a member of `oneof`_ ``transferred_customer_identity``. - parent (str): - Required. The reseller account's resource name. Parent uses - the format: accounts/{account_id} - page_size (int): - The requested page size. Server might return - fewer results than requested. If unspecified, - returns at most 100 SKUs. The maximum value is - 1000; the server will coerce values above 1000. - Optional. - page_token (str): - A token for a page of results other than the first page. - Obtained using - [ListTransferableSkusResponse.next_page_token][google.cloud.channel.v1.ListTransferableSkusResponse.next_page_token] - of the previous - [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus] - call. Optional. - auth_token (str): - Optional. The super admin of the resold - customer generates this token to authorize a - reseller to access their Cloud Identity and - purchase entitlements on their behalf. You can - omit this token after authorization. See - https://support.google.com/a/answer/7643790 for - more details. - language_code (str): - The BCP-47 language code. For example, - "en-US". The response will localize in the - corresponding language code, if specified. The - default value is "en-US". - Optional. - """ - - cloud_identity_id = proto.Field( - proto.STRING, - number=4, - oneof='transferred_customer_identity', - ) - customer_name = proto.Field( - proto.STRING, - number=7, - oneof='transferred_customer_identity', - ) - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - auth_token = proto.Field( - proto.STRING, - number=5, - ) - language_code = proto.Field( - proto.STRING, - number=6, - ) - - -class ListTransferableSkusResponse(proto.Message): - r"""Response message for - [CloudChannelService.ListTransferableSkus][google.cloud.channel.v1.CloudChannelService.ListTransferableSkus]. - - Attributes: - transferable_skus (Sequence[google.cloud.channel_v1.types.TransferableSku]): - Information about existing SKUs for a - customer that needs a transfer. - next_page_token (str): - A token to retrieve the next page of results. Pass to - [ListTransferableSkusRequest.page_token][google.cloud.channel.v1.ListTransferableSkusRequest.page_token] - to obtain that page. - """ - - @property - def raw_page(self): - return self - - transferable_skus = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=gcc_entitlements.TransferableSku, - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class ListTransferableOffersRequest(proto.Message): - r"""Request message for - [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers] - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - cloud_identity_id (str): - Customer's Cloud Identity ID - - This field is a member of `oneof`_ ``transferred_customer_identity``. - customer_name (str): - A reseller should create a customer and use - the resource name of that customer here. - - This field is a member of `oneof`_ ``transferred_customer_identity``. - parent (str): - Required. The resource name of the reseller's - account. - page_size (int): - Requested page size. Server might return - fewer results than requested. If unspecified, - returns at most 100 offers. The maximum value is - 1000; the server will coerce values above 1000. - page_token (str): - A token for a page of results other than the first page. - Obtained using - [ListTransferableOffersResponse.next_page_token][google.cloud.channel.v1.ListTransferableOffersResponse.next_page_token] - of the previous - [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers] - call. - sku (str): - Required. The SKU to look up Offers for. - language_code (str): - Optional. The BCP-47 language code. For - example, "en-US". The response will localize in - the corresponding language code, if specified. - The default value is "en-US". - """ - - cloud_identity_id = proto.Field( - proto.STRING, - number=4, - oneof='transferred_customer_identity', - ) - customer_name = proto.Field( - proto.STRING, - number=5, - oneof='transferred_customer_identity', - ) - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - sku = proto.Field( - proto.STRING, - number=6, - ) - language_code = proto.Field( - proto.STRING, - number=7, - ) - - -class ListTransferableOffersResponse(proto.Message): - r"""Response message for - [CloudChannelService.ListTransferableOffers][google.cloud.channel.v1.CloudChannelService.ListTransferableOffers]. - - Attributes: - transferable_offers (Sequence[google.cloud.channel_v1.types.TransferableOffer]): - Information about Offers for a customer that - can be used for transfer. - next_page_token (str): - A token to retrieve the next page of results. Pass to - [ListTransferableOffersRequest.page_token][google.cloud.channel.v1.ListTransferableOffersRequest.page_token] - to obtain that page. - """ - - @property - def raw_page(self): - return self - - transferable_offers = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='TransferableOffer', - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class TransferableOffer(proto.Message): - r"""TransferableOffer represents an Offer that can be used in - Transfer. Read-only. - - Attributes: - offer (google.cloud.channel_v1.types.Offer): - Offer with parameter constraints updated to - allow the Transfer. - """ - - offer = proto.Field( - proto.MESSAGE, - number=1, - message=gcc_offers.Offer, - ) - - -class GetEntitlementRequest(proto.Message): - r"""Request message for - [CloudChannelService.GetEntitlement][google.cloud.channel.v1.CloudChannelService.GetEntitlement]. - - Attributes: - name (str): - Required. The resource name of the entitlement to retrieve. - Name uses the format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class ListChannelPartnerLinksRequest(proto.Message): - r"""Request message for - [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks] - - Attributes: - parent (str): - Required. The resource name of the reseller account for - listing channel partner links. Parent uses the format: - accounts/{account_id} - page_size (int): - Optional. Requested page size. Server might - return fewer results than requested. If - unspecified, server will pick a default size - (25). The maximum value is 200; the server will - coerce values above 200. - page_token (str): - Optional. A token for a page of results other than the first - page. Obtained using - [ListChannelPartnerLinksResponse.next_page_token][google.cloud.channel.v1.ListChannelPartnerLinksResponse.next_page_token] - of the previous - [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks] - call. - view (google.cloud.channel_v1.types.ChannelPartnerLinkView): - Optional. The level of granularity the - ChannelPartnerLink will display. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - view = proto.Field( - proto.ENUM, - number=4, - enum=gcc_channel_partner_links.ChannelPartnerLinkView, - ) - - -class ListChannelPartnerLinksResponse(proto.Message): - r"""Response message for - [CloudChannelService.ListChannelPartnerLinks][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks]. - - Attributes: - channel_partner_links (Sequence[google.cloud.channel_v1.types.ChannelPartnerLink]): - The Channel partner links for a reseller. - next_page_token (str): - A token to retrieve the next page of results. Pass to - [ListChannelPartnerLinksRequest.page_token][google.cloud.channel.v1.ListChannelPartnerLinksRequest.page_token] - to obtain that page. - """ - - @property - def raw_page(self): - return self - - channel_partner_links = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=gcc_channel_partner_links.ChannelPartnerLink, - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class GetChannelPartnerLinkRequest(proto.Message): - r"""Request message for - [CloudChannelService.GetChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink]. - - Attributes: - name (str): - Required. The resource name of the channel partner link to - retrieve. Name uses the format: - accounts/{account_id}/channelPartnerLinks/{id} where {id} is - the Cloud Identity ID of the partner. - view (google.cloud.channel_v1.types.ChannelPartnerLinkView): - Optional. The level of granularity the - ChannelPartnerLink will display. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - view = proto.Field( - proto.ENUM, - number=2, - enum=gcc_channel_partner_links.ChannelPartnerLinkView, - ) - - -class CreateChannelPartnerLinkRequest(proto.Message): - r"""Request message for - [CloudChannelService.CreateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink] - - Attributes: - parent (str): - Required. Create a channel partner link for the provided - reseller account's resource name. Parent uses the format: - accounts/{account_id} - channel_partner_link (google.cloud.channel_v1.types.ChannelPartnerLink): - Required. The channel partner link to create. Either - channel_partner_link.reseller_cloud_identity_id or domain - can be used to create a link. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - channel_partner_link = proto.Field( - proto.MESSAGE, - number=2, - message=gcc_channel_partner_links.ChannelPartnerLink, - ) - - -class UpdateChannelPartnerLinkRequest(proto.Message): - r"""Request message for - [CloudChannelService.UpdateChannelPartnerLink][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink] - - Attributes: - name (str): - Required. The resource name of the channel partner link to - cancel. Name uses the format: - accounts/{account_id}/channelPartnerLinks/{id} where {id} is - the Cloud Identity ID of the partner. - channel_partner_link (google.cloud.channel_v1.types.ChannelPartnerLink): - Required. The channel partner link to update. Only - channel_partner_link.link_state is allowed for updates. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The update mask that applies to the resource. The - only allowable value for an update mask is - channel_partner_link.link_state. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - channel_partner_link = proto.Field( - proto.MESSAGE, - number=2, - message=gcc_channel_partner_links.ChannelPartnerLink, - ) - update_mask = proto.Field( - proto.MESSAGE, - number=3, - message=field_mask_pb2.FieldMask, - ) - - -class GetCustomerRepricingConfigRequest(proto.Message): - r"""Request message for - [CloudChannelService.GetCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig]. - - Attributes: - name (str): - Required. The resource name of the CustomerRepricingConfig. - Format: - accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class ListCustomerRepricingConfigsRequest(proto.Message): - r"""Request message for - [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. - - Attributes: - parent (str): - Required. The resource name of the customer. Parent uses the - format: accounts/{account_id}/customers/{customer_id}. - Supports accounts/{account_id}/customers/- to retrieve - configs for all customers. - page_size (int): - Optional. The maximum number of repricing - configs to return. The service may return fewer - than this value. If unspecified, returns a - maximum of 50 rules. The maximum value is 100; - values above 100 will be coerced to 100. - page_token (str): - Optional. A token identifying a page of results beyond the - first page. Obtained through - [ListCustomerRepricingConfigsResponse.next_page_token][google.cloud.channel.v1.ListCustomerRepricingConfigsResponse.next_page_token] - of the previous - [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs] - call. - filter (str): - Optional. A filter for - [CloudChannelService.ListCustomerRepricingConfigs] results - (customer only). You can use this filter when you support a - BatchGet-like query. To use the filter, you must set - ``parent=accounts/{account_id}/customers/-``. - - Example: customer = accounts/account_id/customers/c1 OR - customer = accounts/account_id/customers/c2. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - filter = proto.Field( - proto.STRING, - number=4, - ) - - -class ListCustomerRepricingConfigsResponse(proto.Message): - r"""Response message for - [CloudChannelService.ListCustomerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs]. - - Attributes: - customer_repricing_configs (Sequence[google.cloud.channel_v1.types.CustomerRepricingConfig]): - The repricing configs for this channel - partner. - next_page_token (str): - A token to retrieve the next page of results. Pass to - [ListCustomerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListCustomerRepricingConfigsRequest.page_token] - to obtain that page. - """ - - @property - def raw_page(self): - return self - - customer_repricing_configs = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=repricing.CustomerRepricingConfig, - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class CreateCustomerRepricingConfigRequest(proto.Message): - r"""Request message for - [CloudChannelService.CreateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig]. - - Attributes: - parent (str): - Required. The resource name of the customer that will - receive this repricing config. Parent uses the format: - accounts/{account_id}/customers/{customer_id} - customer_repricing_config (google.cloud.channel_v1.types.CustomerRepricingConfig): - Required. The CustomerRepricingConfig object - to update. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - customer_repricing_config = proto.Field( - proto.MESSAGE, - number=2, - message=repricing.CustomerRepricingConfig, - ) - - -class UpdateCustomerRepricingConfigRequest(proto.Message): - r"""Request message for - [CloudChannelService.UpdateCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig]. - - Attributes: - customer_repricing_config (google.cloud.channel_v1.types.CustomerRepricingConfig): - Required. The CustomerRepricingConfig object - to update. - """ - - customer_repricing_config = proto.Field( - proto.MESSAGE, - number=1, - message=repricing.CustomerRepricingConfig, - ) - - -class DeleteCustomerRepricingConfigRequest(proto.Message): - r"""Request message for - [CloudChannelService.DeleteCustomerRepricingConfig][google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig]. - - Attributes: - name (str): - Required. The resource name of the customer repricing config - rule to delete. Format: - accounts/{account_id}/customers/{customer_id}/customerRepricingConfigs/{id}. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class GetChannelPartnerRepricingConfigRequest(proto.Message): - r"""Request message for - [CloudChannelService.GetChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig] - - Attributes: - name (str): - Required. The resource name of the - ChannelPartnerRepricingConfig Format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id}/channelPartnerRepricingConfigs/{id}. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class ListChannelPartnerRepricingConfigsRequest(proto.Message): - r"""Request message for - [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. - - Attributes: - parent (str): - Required. The resource name of the account's - [ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]. - Parent uses the format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id}. - Supports accounts/{account_id}/channelPartnerLinks/- to - retrieve configs for all channel partners. - page_size (int): - Optional. The maximum number of repricing - configs to return. The service may return fewer - than this value. If unspecified, returns a - maximum of 50 rules. The maximum value is 100; - values above 100 will be coerced to 100. - page_token (str): - Optional. A token identifying a page of results beyond the - first page. Obtained through - [ListChannelPartnerRepricingConfigsResponse.next_page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse.next_page_token] - of the previous - [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs] - call. - filter (str): - Optional. A filter for - [CloudChannelService.ListChannelPartnerRepricingConfigs] - results (channel_partner_link only). You can use this filter - when you support a BatchGet-like query. To use the filter, - you must set - ``parent=accounts/{account_id}/channelPartnerLinks/-``. - - Example: - ``channel_partner_link = accounts/account_id/channelPartnerLinks/c1`` - OR - ``channel_partner_link = accounts/account_id/channelPartnerLinks/c2``. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - filter = proto.Field( - proto.STRING, - number=4, - ) - - -class ListChannelPartnerRepricingConfigsResponse(proto.Message): - r"""Response message for - [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. - - Attributes: - channel_partner_repricing_configs (Sequence[google.cloud.channel_v1.types.ChannelPartnerRepricingConfig]): - The repricing configs for this channel - partner. - next_page_token (str): - A token to retrieve the next page of results. Pass to - [ListChannelPartnerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest.page_token] - to obtain that page. - """ - - @property - def raw_page(self): - return self - - channel_partner_repricing_configs = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=repricing.ChannelPartnerRepricingConfig, - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class CreateChannelPartnerRepricingConfigRequest(proto.Message): - r"""Request message for - [CloudChannelService.CreateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig]. - - Attributes: - parent (str): - Required. The resource name of the ChannelPartner that will - receive the repricing config. Parent uses the format: - accounts/{account_id}/channelPartnerLinks/{channel_partner_id} - channel_partner_repricing_config (google.cloud.channel_v1.types.ChannelPartnerRepricingConfig): - Required. The ChannelPartnerRepricingConfig - object to update. - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - channel_partner_repricing_config = proto.Field( - proto.MESSAGE, - number=2, - message=repricing.ChannelPartnerRepricingConfig, - ) - - -class UpdateChannelPartnerRepricingConfigRequest(proto.Message): - r"""Request message for - [CloudChannelService.UpdateChannelPartnerRepricingConfig][google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig]. - - Attributes: - channel_partner_repricing_config (google.cloud.channel_v1.types.ChannelPartnerRepricingConfig): - Required. The ChannelPartnerRepricingConfig - object to update. - """ - - channel_partner_repricing_config = proto.Field( - proto.MESSAGE, - number=1, - message=repricing.ChannelPartnerRepricingConfig, - ) - - -class DeleteChannelPartnerRepricingConfigRequest(proto.Message): - r"""Request message for DeleteChannelPartnerRepricingConfig. - - Attributes: - name (str): - Required. The resource name of the channel - partner repricing config rule to delete. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - - -class CreateEntitlementRequest(proto.Message): - r"""Request message for - [CloudChannelService.CreateEntitlement][google.cloud.channel.v1.CloudChannelService.CreateEntitlement] - - Attributes: - parent (str): - Required. The resource name of the reseller's customer - account in which to create the entitlement. Parent uses the - format: accounts/{account_id}/customers/{customer_id} - entitlement (google.cloud.channel_v1.types.Entitlement): - Required. The entitlement to create. - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - entitlement = proto.Field( - proto.MESSAGE, - number=2, - message=gcc_entitlements.Entitlement, - ) - request_id = proto.Field( - proto.STRING, - number=5, - ) - - -class TransferEntitlementsRequest(proto.Message): - r"""Request message for - [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. - - Attributes: - parent (str): - Required. The resource name of the reseller's customer - account that will receive transferred entitlements. Parent - uses the format: - accounts/{account_id}/customers/{customer_id} - entitlements (Sequence[google.cloud.channel_v1.types.Entitlement]): - Required. The new entitlements to create or - transfer. - auth_token (str): - The super admin of the resold customer - generates this token to authorize a reseller to - access their Cloud Identity and purchase - entitlements on their behalf. You can omit this - token after authorization. See - https://support.google.com/a/answer/7643790 for - more details. - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - entitlements = proto.RepeatedField( - proto.MESSAGE, - number=2, - message=gcc_entitlements.Entitlement, - ) - auth_token = proto.Field( - proto.STRING, - number=4, - ) - request_id = proto.Field( - proto.STRING, - number=6, - ) - - -class TransferEntitlementsResponse(proto.Message): - r"""Response message for - [CloudChannelService.TransferEntitlements][google.cloud.channel.v1.CloudChannelService.TransferEntitlements]. - This is put in the response field of google.longrunning.Operation. - - Attributes: - entitlements (Sequence[google.cloud.channel_v1.types.Entitlement]): - The transferred entitlements. - """ - - entitlements = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=gcc_entitlements.Entitlement, - ) - - -class TransferEntitlementsToGoogleRequest(proto.Message): - r"""Request message for - [CloudChannelService.TransferEntitlementsToGoogle][google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle]. - - Attributes: - parent (str): - Required. The resource name of the reseller's customer - account where the entitlements transfer from. Parent uses - the format: accounts/{account_id}/customers/{customer_id} - entitlements (Sequence[google.cloud.channel_v1.types.Entitlement]): - Required. The entitlements to transfer to - Google. - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - entitlements = proto.RepeatedField( - proto.MESSAGE, - number=2, - message=gcc_entitlements.Entitlement, - ) - request_id = proto.Field( - proto.STRING, - number=3, - ) - - -class ChangeParametersRequest(proto.Message): - r"""Request message for [CloudChannelService.ChangeParametersRequest][]. - - Attributes: - name (str): - Required. The name of the entitlement to update. Name uses - the format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - parameters (Sequence[google.cloud.channel_v1.types.Parameter]): - Required. Entitlement parameters to update. You can only - change editable parameters. - - To view the available Parameters for a request, refer to the - [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions] - from the desired offer. - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - purchase_order_id (str): - Optional. Purchase order ID provided by the - reseller. - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - parameters = proto.RepeatedField( - proto.MESSAGE, - number=2, - message=gcc_entitlements.Parameter, - ) - request_id = proto.Field( - proto.STRING, - number=4, - ) - purchase_order_id = proto.Field( - proto.STRING, - number=5, - ) - - -class ChangeRenewalSettingsRequest(proto.Message): - r"""Request message for - [CloudChannelService.ChangeRenewalSettings][google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings]. - - Attributes: - name (str): - Required. The name of the entitlement to update. Name uses - the format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - renewal_settings (google.cloud.channel_v1.types.RenewalSettings): - Required. New renewal settings. - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - renewal_settings = proto.Field( - proto.MESSAGE, - number=4, - message=gcc_entitlements.RenewalSettings, - ) - request_id = proto.Field( - proto.STRING, - number=5, - ) - - -class ChangeOfferRequest(proto.Message): - r"""Request message for - [CloudChannelService.ChangeOffer][google.cloud.channel.v1.CloudChannelService.ChangeOffer]. - - Attributes: - name (str): - Required. The resource name of the entitlement to update. - Name uses the format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - offer (str): - Required. New Offer. Format: - accounts/{account_id}/offers/{offer_id}. - parameters (Sequence[google.cloud.channel_v1.types.Parameter]): - Optional. Parameters needed to purchase the Offer. To view - the available Parameters refer to the - [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions] - from the desired offer. - purchase_order_id (str): - Optional. Purchase order id provided by the - reseller. - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - offer = proto.Field( - proto.STRING, - number=2, - ) - parameters = proto.RepeatedField( - proto.MESSAGE, - number=3, - message=gcc_entitlements.Parameter, - ) - purchase_order_id = proto.Field( - proto.STRING, - number=5, - ) - request_id = proto.Field( - proto.STRING, - number=6, - ) - - -class StartPaidServiceRequest(proto.Message): - r"""Request message for - [CloudChannelService.StartPaidService][google.cloud.channel.v1.CloudChannelService.StartPaidService]. - - Attributes: - name (str): - Required. The name of the entitlement to start a paid - service for. Name uses the format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - request_id = proto.Field( - proto.STRING, - number=3, - ) - - -class CancelEntitlementRequest(proto.Message): - r"""Request message for - [CloudChannelService.CancelEntitlement][google.cloud.channel.v1.CloudChannelService.CancelEntitlement]. - - Attributes: - name (str): - Required. The resource name of the entitlement to cancel. - Name uses the format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - request_id = proto.Field( - proto.STRING, - number=3, - ) - - -class SuspendEntitlementRequest(proto.Message): - r"""Request message for - [CloudChannelService.SuspendEntitlement][google.cloud.channel.v1.CloudChannelService.SuspendEntitlement]. - - Attributes: - name (str): - Required. The resource name of the entitlement to suspend. - Name uses the format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - request_id = proto.Field( - proto.STRING, - number=3, - ) - - -class ActivateEntitlementRequest(proto.Message): - r"""Request message for - [CloudChannelService.ActivateEntitlement][google.cloud.channel.v1.CloudChannelService.ActivateEntitlement]. - - Attributes: - name (str): - Required. The resource name of the entitlement to activate. - Name uses the format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - request_id (str): - Optional. You can specify an optional unique request ID, and - if you need to retry your request, the server will know to - ignore the request if it's complete. - - For example, you make an initial request and the request - times out. If you make the request again with the same - request ID, the server can check if it received the original - operation with the same request ID. If it did, it will - ignore the second request. - - The request ID must be a valid - `UUID `__ with the - exception that zero UUID is not supported - (``00000000-0000-0000-0000-000000000000``). - """ - - name = proto.Field( - proto.STRING, - number=1, - ) - request_id = proto.Field( - proto.STRING, - number=3, - ) - - -class LookupOfferRequest(proto.Message): - r"""Request message for LookupOffer. - - Attributes: - entitlement (str): - Required. The resource name of the entitlement to retrieve - the Offer. Entitlement uses the format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - """ - - entitlement = proto.Field( - proto.STRING, - number=1, - ) - - -class ListProductsRequest(proto.Message): - r"""Request message for ListProducts. - - Attributes: - account (str): - Required. The resource name of the reseller account. Format: - accounts/{account_id}. - page_size (int): - Optional. Requested page size. Server might - return fewer results than requested. If - unspecified, returns at most 100 Products. The - maximum value is 1000; the server will coerce - values above 1000. - page_token (str): - Optional. A token for a page of results other - than the first page. - language_code (str): - Optional. The BCP-47 language code. For - example, "en-US". The response will localize in - the corresponding language code, if specified. - The default value is "en-US". - """ - - account = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - language_code = proto.Field( - proto.STRING, - number=4, - ) - - -class ListProductsResponse(proto.Message): - r"""Response message for ListProducts. - - Attributes: - products (Sequence[google.cloud.channel_v1.types.Product]): - List of Products requested. - next_page_token (str): - A token to retrieve the next page of results. - """ - - @property - def raw_page(self): - return self - - products = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=gcc_products.Product, - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class ListSkusRequest(proto.Message): - r"""Request message for ListSkus. - - Attributes: - parent (str): - Required. The resource name of the Product to list SKUs for. - Parent uses the format: products/{product_id}. Supports - products/- to retrieve SKUs for all products. - account (str): - Required. Resource name of the reseller. Format: - accounts/{account_id}. - page_size (int): - Optional. Requested page size. Server might - return fewer results than requested. If - unspecified, returns at most 100 SKUs. The - maximum value is 1000; the server will coerce - values above 1000. - page_token (str): - Optional. A token for a page of results other - than the first page. Optional. - language_code (str): - Optional. The BCP-47 language code. For - example, "en-US". The response will localize in - the corresponding language code, if specified. - The default value is "en-US". - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - account = proto.Field( - proto.STRING, - number=2, - ) - page_size = proto.Field( - proto.INT32, - number=3, - ) - page_token = proto.Field( - proto.STRING, - number=4, - ) - language_code = proto.Field( - proto.STRING, - number=5, - ) - - -class ListSkusResponse(proto.Message): - r"""Response message for ListSkus. - - Attributes: - skus (Sequence[google.cloud.channel_v1.types.Sku]): - The list of SKUs requested. - next_page_token (str): - A token to retrieve the next page of results. - """ - - @property - def raw_page(self): - return self - - skus = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=gcc_products.Sku, - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class ListOffersRequest(proto.Message): - r"""Request message for ListOffers. - - Attributes: - parent (str): - Required. The resource name of the reseller account from - which to list Offers. Parent uses the format: - accounts/{account_id}. - page_size (int): - Optional. Requested page size. Server might - return fewer results than requested. If - unspecified, returns at most 500 Offers. The - maximum value is 1000; the server will coerce - values above 1000. - page_token (str): - Optional. A token for a page of results other - than the first page. - filter (str): - Optional. The expression to filter results by - name (name of the Offer), sku.name (name of the - SKU), or sku.product.name (name of the Product). - Example 1: sku.product.name=products/p1 AND - sku.name!=products/p1/skus/s1 Example 2: - name=accounts/a1/offers/o1 - language_code (str): - Optional. The BCP-47 language code. For - example, "en-US". The response will localize in - the corresponding language code, if specified. - The default value is "en-US". - """ - - parent = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - filter = proto.Field( - proto.STRING, - number=4, - ) - language_code = proto.Field( - proto.STRING, - number=5, - ) - - -class ListOffersResponse(proto.Message): - r"""Response message for ListOffers. - - Attributes: - offers (Sequence[google.cloud.channel_v1.types.Offer]): - The list of Offers requested. - next_page_token (str): - A token to retrieve the next page of results. - """ - - @property - def raw_page(self): - return self - - offers = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=gcc_offers.Offer, - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class ListPurchasableSkusRequest(proto.Message): - r"""Request message for ListPurchasableSkus. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - create_entitlement_purchase (google.cloud.channel_v1.types.ListPurchasableSkusRequest.CreateEntitlementPurchase): - List SKUs for CreateEntitlement purchase. - - This field is a member of `oneof`_ ``purchase_option``. - change_offer_purchase (google.cloud.channel_v1.types.ListPurchasableSkusRequest.ChangeOfferPurchase): - List SKUs for ChangeOffer purchase with a new - SKU. - - This field is a member of `oneof`_ ``purchase_option``. - customer (str): - Required. The resource name of the customer to list SKUs - for. Format: accounts/{account_id}/customers/{customer_id}. - page_size (int): - Optional. Requested page size. Server might - return fewer results than requested. If - unspecified, returns at most 100 SKUs. The - maximum value is 1000; the server will coerce - values above 1000. - page_token (str): - Optional. A token for a page of results other - than the first page. - language_code (str): - Optional. The BCP-47 language code. For - example, "en-US". The response will localize in - the corresponding language code, if specified. - The default value is "en-US". - """ - - class CreateEntitlementPurchase(proto.Message): - r"""List SKUs for a new entitlement. Make the purchase using - [CloudChannelService.CreateEntitlement][google.cloud.channel.v1.CloudChannelService.CreateEntitlement]. - - Attributes: - product (str): - Required. List SKUs belonging to this Product. Format: - products/{product_id}. Supports products/- to retrieve SKUs - for all products. - """ - - product = proto.Field( - proto.STRING, - number=1, - ) - - class ChangeOfferPurchase(proto.Message): - r"""List SKUs for upgrading or downgrading an entitlement. Make the - purchase using - [CloudChannelService.ChangeOffer][google.cloud.channel.v1.CloudChannelService.ChangeOffer]. - - Attributes: - entitlement (str): - Required. Resource name of the entitlement. Format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - change_type (google.cloud.channel_v1.types.ListPurchasableSkusRequest.ChangeOfferPurchase.ChangeType): - Required. Change Type for the entitlement. - """ - class ChangeType(proto.Enum): - r"""Change Type enum.""" - CHANGE_TYPE_UNSPECIFIED = 0 - UPGRADE = 1 - DOWNGRADE = 2 - - entitlement = proto.Field( - proto.STRING, - number=1, - ) - change_type = proto.Field( - proto.ENUM, - number=2, - enum='ListPurchasableSkusRequest.ChangeOfferPurchase.ChangeType', - ) - - create_entitlement_purchase = proto.Field( - proto.MESSAGE, - number=2, - oneof='purchase_option', - message=CreateEntitlementPurchase, - ) - change_offer_purchase = proto.Field( - proto.MESSAGE, - number=3, - oneof='purchase_option', - message=ChangeOfferPurchase, - ) - customer = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=4, - ) - page_token = proto.Field( - proto.STRING, - number=5, - ) - language_code = proto.Field( - proto.STRING, - number=6, - ) - - -class ListPurchasableSkusResponse(proto.Message): - r"""Response message for ListPurchasableSkus. - - Attributes: - purchasable_skus (Sequence[google.cloud.channel_v1.types.PurchasableSku]): - The list of SKUs requested. - next_page_token (str): - A token to retrieve the next page of results. - """ - - @property - def raw_page(self): - return self - - purchasable_skus = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='PurchasableSku', - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class PurchasableSku(proto.Message): - r"""SKU that you can purchase. This is used in ListPurchasableSku - API response. - - Attributes: - sku (google.cloud.channel_v1.types.Sku): - SKU - """ - - sku = proto.Field( - proto.MESSAGE, - number=1, - message=gcc_products.Sku, - ) - - -class ListPurchasableOffersRequest(proto.Message): - r"""Request message for ListPurchasableOffers. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - create_entitlement_purchase (google.cloud.channel_v1.types.ListPurchasableOffersRequest.CreateEntitlementPurchase): - List Offers for CreateEntitlement purchase. - - This field is a member of `oneof`_ ``purchase_option``. - change_offer_purchase (google.cloud.channel_v1.types.ListPurchasableOffersRequest.ChangeOfferPurchase): - List Offers for ChangeOffer purchase. - - This field is a member of `oneof`_ ``purchase_option``. - customer (str): - Required. The resource name of the customer to list Offers - for. Format: accounts/{account_id}/customers/{customer_id}. - page_size (int): - Optional. Requested page size. Server might - return fewer results than requested. If - unspecified, returns at most 100 Offers. The - maximum value is 1000; the server will coerce - values above 1000. - page_token (str): - Optional. A token for a page of results other - than the first page. - language_code (str): - Optional. The BCP-47 language code. For - example, "en-US". The response will localize in - the corresponding language code, if specified. - The default value is "en-US". - """ - - class CreateEntitlementPurchase(proto.Message): - r"""List Offers for CreateEntitlement purchase. - - Attributes: - sku (str): - Required. SKU that the result should be restricted to. - Format: products/{product_id}/skus/{sku_id}. - """ - - sku = proto.Field( - proto.STRING, - number=1, - ) - - class ChangeOfferPurchase(proto.Message): - r"""List Offers for ChangeOffer purchase. - - Attributes: - entitlement (str): - Required. Resource name of the entitlement. Format: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - new_sku (str): - Optional. Resource name of the new target SKU. Provide this - SKU when upgrading or downgrading an entitlement. Format: - products/{product_id}/skus/{sku_id} - """ - - entitlement = proto.Field( - proto.STRING, - number=1, - ) - new_sku = proto.Field( - proto.STRING, - number=2, - ) - - create_entitlement_purchase = proto.Field( - proto.MESSAGE, - number=2, - oneof='purchase_option', - message=CreateEntitlementPurchase, - ) - change_offer_purchase = proto.Field( - proto.MESSAGE, - number=3, - oneof='purchase_option', - message=ChangeOfferPurchase, - ) - customer = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=4, - ) - page_token = proto.Field( - proto.STRING, - number=5, - ) - language_code = proto.Field( - proto.STRING, - number=6, - ) - - -class ListPurchasableOffersResponse(proto.Message): - r"""Response message for ListPurchasableOffers. - - Attributes: - purchasable_offers (Sequence[google.cloud.channel_v1.types.PurchasableOffer]): - The list of Offers requested. - next_page_token (str): - A token to retrieve the next page of results. - """ - - @property - def raw_page(self): - return self - - purchasable_offers = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='PurchasableOffer', - ) - next_page_token = proto.Field( - proto.STRING, - number=2, - ) - - -class PurchasableOffer(proto.Message): - r"""Offer that you can purchase for a customer. This is used in - the ListPurchasableOffer API response. - - Attributes: - offer (google.cloud.channel_v1.types.Offer): - Offer. - """ - - offer = proto.Field( - proto.MESSAGE, - number=1, - message=gcc_offers.Offer, - ) - - -class RegisterSubscriberRequest(proto.Message): - r"""Request Message for RegisterSubscriber. - - Attributes: - account (str): - Required. Resource name of the account. - service_account (str): - Required. Service account that provides - subscriber access to the registered topic. - """ - - account = proto.Field( - proto.STRING, - number=1, - ) - service_account = proto.Field( - proto.STRING, - number=2, - ) - - -class RegisterSubscriberResponse(proto.Message): - r"""Response Message for RegisterSubscriber. - - Attributes: - topic (str): - Name of the topic the subscriber will listen - to. - """ - - topic = proto.Field( - proto.STRING, - number=1, - ) - - -class UnregisterSubscriberRequest(proto.Message): - r"""Request Message for UnregisterSubscriber. - - Attributes: - account (str): - Required. Resource name of the account. - service_account (str): - Required. Service account to unregister from - subscriber access to the topic. - """ - - account = proto.Field( - proto.STRING, - number=1, - ) - service_account = proto.Field( - proto.STRING, - number=2, - ) - - -class UnregisterSubscriberResponse(proto.Message): - r"""Response Message for UnregisterSubscriber. - - Attributes: - topic (str): - Name of the topic the service account - subscriber access was removed from. - """ - - topic = proto.Field( - proto.STRING, - number=1, - ) - - -class ListSubscribersRequest(proto.Message): - r"""Request Message for ListSubscribers. - - Attributes: - account (str): - Required. Resource name of the account. - page_size (int): - Optional. The maximum number of service - accounts to return. The service may return fewer - than this value. If unspecified, returns at most - 100 service accounts. The maximum value is 1000; - the server will coerce values above 1000. - page_token (str): - Optional. A page token, received from a previous - ``ListSubscribers`` call. Provide this to retrieve the - subsequent page. - - When paginating, all other parameters provided to - ``ListSubscribers`` must match the call that provided the - page token. - """ - - account = proto.Field( - proto.STRING, - number=1, - ) - page_size = proto.Field( - proto.INT32, - number=2, - ) - page_token = proto.Field( - proto.STRING, - number=3, - ) - - -class ListSubscribersResponse(proto.Message): - r"""Response Message for ListSubscribers. - - Attributes: - topic (str): - Name of the topic registered with the - reseller. - service_accounts (Sequence[str]): - List of service accounts which have - subscriber access to the topic. - next_page_token (str): - A token that can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - """ - - @property - def raw_page(self): - return self - - topic = proto.Field( - proto.STRING, - number=1, - ) - service_accounts = proto.RepeatedField( - proto.STRING, - number=2, - ) - next_page_token = proto.Field( - proto.STRING, - number=3, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/channel_v1/types/subscriber_event.py b/owl-bot-staging/v1/google/cloud/channel_v1/types/subscriber_event.py deleted file mode 100644 index cb10195..0000000 --- a/owl-bot-staging/v1/google/cloud/channel_v1/types/subscriber_event.py +++ /dev/null @@ -1,134 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import proto # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.channel.v1', - manifest={ - 'CustomerEvent', - 'EntitlementEvent', - 'SubscriberEvent', - }, -) - - -class CustomerEvent(proto.Message): - r"""Represents Pub/Sub message content describing customer - update. - - Attributes: - customer (str): - Resource name of the customer. Format: - accounts/{account_id}/customers/{customer_id} - event_type (google.cloud.channel_v1.types.CustomerEvent.Type): - Type of event which happened on the customer. - """ - class Type(proto.Enum): - r"""Type of customer event.""" - TYPE_UNSPECIFIED = 0 - PRIMARY_DOMAIN_CHANGED = 1 - PRIMARY_DOMAIN_VERIFIED = 2 - - customer = proto.Field( - proto.STRING, - number=1, - ) - event_type = proto.Field( - proto.ENUM, - number=2, - enum=Type, - ) - - -class EntitlementEvent(proto.Message): - r"""Represents Pub/Sub message content describing entitlement - update. - - Attributes: - entitlement (str): - Resource name of an entitlement of the form: - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} - event_type (google.cloud.channel_v1.types.EntitlementEvent.Type): - Type of event which happened on the - entitlement. - """ - class Type(proto.Enum): - r"""Type of entitlement event.""" - TYPE_UNSPECIFIED = 0 - CREATED = 1 - PRICE_PLAN_SWITCHED = 3 - COMMITMENT_CHANGED = 4 - RENEWED = 5 - SUSPENDED = 6 - ACTIVATED = 7 - CANCELLED = 8 - SKU_CHANGED = 9 - RENEWAL_SETTING_CHANGED = 10 - PAID_SERVICE_STARTED = 11 - LICENSE_ASSIGNMENT_CHANGED = 12 - LICENSE_CAP_CHANGED = 13 - - entitlement = proto.Field( - proto.STRING, - number=1, - ) - event_type = proto.Field( - proto.ENUM, - number=2, - enum=Type, - ) - - -class SubscriberEvent(proto.Message): - r"""Represents information which resellers will get as part of - notification from Pub/Sub. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - customer_event (google.cloud.channel_v1.types.CustomerEvent): - Customer event sent as part of Pub/Sub event - to partners. - - This field is a member of `oneof`_ ``event``. - entitlement_event (google.cloud.channel_v1.types.EntitlementEvent): - Entitlement event sent as part of Pub/Sub - event to partners. - - This field is a member of `oneof`_ ``event``. - """ - - customer_event = proto.Field( - proto.MESSAGE, - number=1, - oneof='event', - message='CustomerEvent', - ) - entitlement_event = proto.Field( - proto.MESSAGE, - number=2, - oneof='event', - message='EntitlementEvent', - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/mypy.ini b/owl-bot-staging/v1/mypy.ini deleted file mode 100644 index 574c5ae..0000000 --- a/owl-bot-staging/v1/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True diff --git a/owl-bot-staging/v1/noxfile.py b/owl-bot-staging/v1/noxfile.py deleted file mode 100644 index 5af5e43..0000000 --- a/owl-bot-staging/v1/noxfile.py +++ /dev/null @@ -1,179 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -import pathlib -import shutil -import subprocess -import sys - - -import nox # type: ignore - -ALL_PYTHON = [ - "3.7", - "3.8", - "3.9", - "3.10", -] - -CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() - -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" -PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") - -BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.10" - -nox.sessions = [ - "unit", - "cover", - "mypy", - "check_lower_bounds" - # exclude update_lower_bounds from default - "docs", - "blacken", - "lint", - "lint_setup_py", -] - -@nox.session(python=ALL_PYTHON) -def unit(session): - """Run the unit test suite.""" - - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - session.install('-e', '.') - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/channel_v1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)) - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def cover(session): - """Run the final coverage report. - This outputs the coverage report aggregating coverage from the unit - test runs (not system test runs), and then erases coverage data. - """ - session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") - - session.run("coverage", "erase") - - -@nox.session(python=ALL_PYTHON) -def mypy(session): - """Run the type checker.""" - session.install('mypy', 'types-pkg_resources') - session.install('.') - session.run( - 'mypy', - '--explicit-package-bases', - 'google', - ) - - -@nox.session -def update_lower_bounds(session): - """Update lower bounds in constraints.txt to match setup.py""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'update', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - - -@nox.session -def check_lower_bounds(session): - """Check lower bounds in setup.py are reflected in constraints file""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'check', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def docs(session): - """Build the docs for this library.""" - - session.install("-e", ".") - session.install("sphinx==4.0.1", "alabaster", "recommonmark") - - shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) - session.run( - "sphinx-build", - "-W", # warnings as errors - "-T", # show full traceback on exception - "-N", # no colors - "-b", - "html", - "-d", - os.path.join("docs", "_build", "doctrees", ""), - os.path.join("docs", ""), - os.path.join("docs", "_build", "html", ""), - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint(session): - """Run linters. - - Returns a failure if the linters find linting errors or sufficiently - serious code quality issues. - """ - session.install("flake8", BLACK_VERSION) - session.run( - "black", - "--check", - *BLACK_PATHS, - ) - session.run("flake8", "google", "tests", "samples") - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def blacken(session): - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - session.run( - "black", - *BLACK_PATHS, - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint_setup_py(session): - """Verify that setup.py is valid (including RST check).""" - session.install("docutils", "pygments") - session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py deleted file mode 100644 index e51fe9b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ActivateEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_activate_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ActivateEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.activate_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py deleted file mode 100644 index ba7dacb..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ActivateEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_activate_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ActivateEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.activate_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py deleted file mode 100644 index 9b58fcc..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CancelEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_cancel_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.CancelEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.cancel_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py deleted file mode 100644 index d8e3aed..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CancelEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_cancel_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.CancelEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.cancel_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py deleted file mode 100644 index c30881b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ChangeOffer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ChangeOffer_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_change_offer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ChangeOfferRequest( - name="name_value", - offer="offer_value", - ) - - # Make the request - operation = client.change_offer(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ChangeOffer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py deleted file mode 100644 index f155931..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ChangeOffer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ChangeOffer_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_change_offer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ChangeOfferRequest( - name="name_value", - offer="offer_value", - ) - - # Make the request - operation = client.change_offer(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ChangeOffer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py deleted file mode 100644 index 6227a9f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ChangeParameters -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ChangeParameters_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_change_parameters(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ChangeParametersRequest( - name="name_value", - ) - - # Make the request - operation = client.change_parameters(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ChangeParameters_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py deleted file mode 100644 index d5943ca..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ChangeParameters -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ChangeParameters_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_change_parameters(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ChangeParametersRequest( - name="name_value", - ) - - # Make the request - operation = client.change_parameters(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ChangeParameters_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py deleted file mode 100644 index a8117c6..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ChangeRenewalSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_change_renewal_settings(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ChangeRenewalSettingsRequest( - name="name_value", - ) - - # Make the request - operation = client.change_renewal_settings(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py deleted file mode 100644 index 4e99a45..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ChangeRenewalSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_change_renewal_settings(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ChangeRenewalSettingsRequest( - name="name_value", - ) - - # Make the request - operation = client.change_renewal_settings(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py deleted file mode 100644 index 79b8402..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CheckCloudIdentityAccountsExist -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_check_cloud_identity_accounts_exist(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.CheckCloudIdentityAccountsExistRequest( - parent="parent_value", - domain="domain_value", - ) - - # Make the request - response = await client.check_cloud_identity_accounts_exist(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py deleted file mode 100644 index 205b5c3..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CheckCloudIdentityAccountsExist -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_check_cloud_identity_accounts_exist(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.CheckCloudIdentityAccountsExistRequest( - parent="parent_value", - domain="domain_value", - ) - - # Make the request - response = client.check_cloud_identity_accounts_exist(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py deleted file mode 100644 index 0205857..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateChannelPartnerLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_create_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - channel_partner_link = channel_v1.ChannelPartnerLink() - channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" - channel_partner_link.link_state = "SUSPENDED" - - request = channel_v1.CreateChannelPartnerLinkRequest( - parent="parent_value", - channel_partner_link=channel_partner_link, - ) - - # Make the request - response = await client.create_channel_partner_link(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py deleted file mode 100644 index 019526d..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateChannelPartnerLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_create_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - channel_partner_link = channel_v1.ChannelPartnerLink() - channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" - channel_partner_link.link_state = "SUSPENDED" - - request = channel_v1.CreateChannelPartnerLinkRequest( - parent="parent_value", - channel_partner_link=channel_partner_link, - ) - - # Make the request - response = client.create_channel_partner_link(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py deleted file mode 100644 index b0e4e83..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateChannelPartnerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_create_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() - channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.CreateChannelPartnerRepricingConfigRequest( - parent="parent_value", - channel_partner_repricing_config=channel_partner_repricing_config, - ) - - # Make the request - response = await client.create_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py deleted file mode 100644 index fd52745..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateChannelPartnerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_create_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() - channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.CreateChannelPartnerRepricingConfigRequest( - parent="parent_value", - channel_partner_repricing_config=channel_partner_repricing_config, - ) - - # Make the request - response = client.create_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py deleted file mode 100644 index b48c8f4..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateCustomer_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_create_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - customer = channel_v1.Customer() - customer.org_display_name = "org_display_name_value" - customer.domain = "domain_value" - - request = channel_v1.CreateCustomerRequest( - parent="parent_value", - customer=customer, - ) - - # Make the request - response = await client.create_customer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py deleted file mode 100644 index fa85f43..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCustomerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_create_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - customer_repricing_config = channel_v1.CustomerRepricingConfig() - customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.CreateCustomerRepricingConfigRequest( - parent="parent_value", - customer_repricing_config=customer_repricing_config, - ) - - # Make the request - response = await client.create_customer_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py deleted file mode 100644 index 41507df..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCustomerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_create_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - customer_repricing_config = channel_v1.CustomerRepricingConfig() - customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.CreateCustomerRepricingConfigRequest( - parent="parent_value", - customer_repricing_config=customer_repricing_config, - ) - - # Make the request - response = client.create_customer_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py deleted file mode 100644 index 1627123..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateCustomer_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_create_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - customer = channel_v1.Customer() - customer.org_display_name = "org_display_name_value" - customer.domain = "domain_value" - - request = channel_v1.CreateCustomerRequest( - parent="parent_value", - customer=customer, - ) - - # Make the request - response = client.create_customer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py deleted file mode 100644 index dee1522..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_create_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - entitlement = channel_v1.Entitlement() - entitlement.offer = "offer_value" - - request = channel_v1.CreateEntitlementRequest( - parent="parent_value", - entitlement=entitlement, - ) - - # Make the request - operation = client.create_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py deleted file mode 100644 index 39469aa..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_create_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - entitlement = channel_v1.Entitlement() - entitlement.offer = "offer_value" - - request = channel_v1.CreateEntitlementRequest( - parent="parent_value", - entitlement=entitlement, - ) - - # Make the request - operation = client.create_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py deleted file mode 100644 index 1de90da..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteChannelPartnerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_delete_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.DeleteChannelPartnerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - await client.delete_channel_partner_repricing_config(request=request) - - -# [END cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py deleted file mode 100644 index 2bf87ed..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteChannelPartnerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_delete_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.DeleteChannelPartnerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - client.delete_channel_partner_repricing_config(request=request) - - -# [END cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py deleted file mode 100644 index 350f212..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_delete_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.DeleteCustomerRequest( - name="name_value", - ) - - # Make the request - await client.delete_customer(request=request) - - -# [END cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py deleted file mode 100644 index a74e37b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCustomerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_delete_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.DeleteCustomerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - await client.delete_customer_repricing_config(request=request) - - -# [END cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py deleted file mode 100644 index ba4ce79..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCustomerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_delete_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.DeleteCustomerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - client.delete_customer_repricing_config(request=request) - - -# [END cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py deleted file mode 100644 index cc3250a..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_delete_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.DeleteCustomerRequest( - name="name_value", - ) - - # Make the request - client.delete_customer(request=request) - - -# [END cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py deleted file mode 100644 index e5c97fb..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetChannelPartnerLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_get_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetChannelPartnerLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_channel_partner_link(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py deleted file mode 100644 index 2c31f56..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetChannelPartnerLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_get_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetChannelPartnerLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_channel_partner_link(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py deleted file mode 100644 index 27efc1e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetChannelPartnerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_get_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetChannelPartnerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - response = await client.get_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py deleted file mode 100644 index 079f538..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetChannelPartnerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_get_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetChannelPartnerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - response = client.get_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py deleted file mode 100644 index 74b3ac3..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetCustomer_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_get_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetCustomerRequest( - name="name_value", - ) - - # Make the request - response = await client.get_customer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py deleted file mode 100644 index fae377b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCustomerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_get_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetCustomerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - response = await client.get_customer_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py deleted file mode 100644 index 0b7d36e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCustomerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_get_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetCustomerRepricingConfigRequest( - name="name_value", - ) - - # Make the request - response = client.get_customer_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py deleted file mode 100644 index ce75381..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetCustomer_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_get_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetCustomerRequest( - name="name_value", - ) - - # Make the request - response = client.get_customer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py deleted file mode 100644 index db19cc9..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetEntitlement_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_get_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.GetEntitlementRequest( - name="name_value", - ) - - # Make the request - response = await client.get_entitlement(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py deleted file mode 100644 index e8b80c0..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_GetEntitlement_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_get_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.GetEntitlementRequest( - name="name_value", - ) - - # Make the request - response = client.get_entitlement(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_GetEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py deleted file mode 100644 index e9a6fe8..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ImportCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ImportCustomer_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_import_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ImportCustomerRequest( - domain="domain_value", - parent="parent_value", - overwrite_if_exists=True, - ) - - # Make the request - response = await client.import_customer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ImportCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py deleted file mode 100644 index 79a50c6..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ImportCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ImportCustomer_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_import_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ImportCustomerRequest( - domain="domain_value", - parent="parent_value", - overwrite_if_exists=True, - ) - - # Make the request - response = client.import_customer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ImportCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py deleted file mode 100644 index 30bbbc9..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListChannelPartnerLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_channel_partner_links(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListChannelPartnerLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_partner_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py deleted file mode 100644 index 142d6ca..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListChannelPartnerLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_channel_partner_links(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListChannelPartnerLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_partner_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py deleted file mode 100644 index 92364fb..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListChannelPartnerRepricingConfigs -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_channel_partner_repricing_configs(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListChannelPartnerRepricingConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_partner_repricing_configs(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py deleted file mode 100644 index f5092d2..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListChannelPartnerRepricingConfigs -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_channel_partner_repricing_configs(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListChannelPartnerRepricingConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_partner_repricing_configs(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py deleted file mode 100644 index 49a44a4..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCustomerRepricingConfigs -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_customer_repricing_configs(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListCustomerRepricingConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_customer_repricing_configs(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py deleted file mode 100644 index e8a8daf..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCustomerRepricingConfigs -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_customer_repricing_configs(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListCustomerRepricingConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_customer_repricing_configs(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py deleted file mode 100644 index d5ec42d..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCustomers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListCustomers_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_customers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListCustomersRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_customers(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListCustomers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py deleted file mode 100644 index 6e18d14..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCustomers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListCustomers_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_customers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListCustomersRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_customers(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListCustomers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py deleted file mode 100644 index ea274f1..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListEntitlements -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListEntitlements_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_entitlements(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListEntitlementsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_entitlements(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListEntitlements_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py deleted file mode 100644 index f525909..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListEntitlements -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListEntitlements_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_entitlements(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListEntitlementsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_entitlements(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListEntitlements_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py deleted file mode 100644 index 46ab716..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListOffers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListOffers_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_offers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListOffersRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_offers(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListOffers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py deleted file mode 100644 index 5e6e0db..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListOffers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListOffers_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_offers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListOffersRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_offers(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListOffers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_async.py deleted file mode 100644 index fae9356..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListProducts -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListProducts_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_products(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListProductsRequest( - account="account_value", - ) - - # Make the request - page_result = client.list_products(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListProducts_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py deleted file mode 100644 index 1f5298e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListProducts -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListProducts_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_products(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListProductsRequest( - account="account_value", - ) - - # Make the request - page_result = client.list_products(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListProducts_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py deleted file mode 100644 index 5866cd8..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPurchasableOffers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_purchasable_offers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() - create_entitlement_purchase.sku = "sku_value" - - request = channel_v1.ListPurchasableOffersRequest( - create_entitlement_purchase=create_entitlement_purchase, - customer="customer_value", - ) - - # Make the request - page_result = client.list_purchasable_offers(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py deleted file mode 100644 index dbae981..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPurchasableOffers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_purchasable_offers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() - create_entitlement_purchase.sku = "sku_value" - - request = channel_v1.ListPurchasableOffersRequest( - create_entitlement_purchase=create_entitlement_purchase, - customer="customer_value", - ) - - # Make the request - page_result = client.list_purchasable_offers(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py deleted file mode 100644 index 8c3088f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPurchasableSkus -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_purchasable_skus(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() - create_entitlement_purchase.product = "product_value" - - request = channel_v1.ListPurchasableSkusRequest( - create_entitlement_purchase=create_entitlement_purchase, - customer="customer_value", - ) - - # Make the request - page_result = client.list_purchasable_skus(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py deleted file mode 100644 index 0e6dd30..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListPurchasableSkus -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_purchasable_skus(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - create_entitlement_purchase = channel_v1.CreateEntitlementPurchase() - create_entitlement_purchase.product = "product_value" - - request = channel_v1.ListPurchasableSkusRequest( - create_entitlement_purchase=create_entitlement_purchase, - customer="customer_value", - ) - - # Make the request - page_result = client.list_purchasable_skus(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py deleted file mode 100644 index 426f9bd..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSkus -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListSkus_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_skus(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListSkusRequest( - parent="parent_value", - account="account_value", - ) - - # Make the request - page_result = client.list_skus(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListSkus_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py deleted file mode 100644 index e24b741..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSkus -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListSkus_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_skus(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListSkusRequest( - parent="parent_value", - account="account_value", - ) - - # Make the request - page_result = client.list_skus(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListSkus_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py deleted file mode 100644 index 0195bfb..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSubscribers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListSubscribers_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_subscribers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListSubscribersRequest( - account="account_value", - ) - - # Make the request - page_result = client.list_subscribers(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListSubscribers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py deleted file mode 100644 index 5348522..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSubscribers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListSubscribers_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_subscribers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListSubscribersRequest( - account="account_value", - ) - - # Make the request - page_result = client.list_subscribers(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListSubscribers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py deleted file mode 100644 index 104aba7..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTransferableOffers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_transferable_offers(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListTransferableOffersRequest( - cloud_identity_id="cloud_identity_id_value", - parent="parent_value", - sku="sku_value", - ) - - # Make the request - page_result = client.list_transferable_offers(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py deleted file mode 100644 index a7b70b5..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTransferableOffers -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_transferable_offers(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListTransferableOffersRequest( - cloud_identity_id="cloud_identity_id_value", - parent="parent_value", - sku="sku_value", - ) - - # Make the request - page_result = client.list_transferable_offers(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py deleted file mode 100644 index 0427d3a..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTransferableSkus -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_list_transferable_skus(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ListTransferableSkusRequest( - cloud_identity_id="cloud_identity_id_value", - parent="parent_value", - ) - - # Make the request - page_result = client.list_transferable_skus(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py deleted file mode 100644 index 2255edb..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListTransferableSkus -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_list_transferable_skus(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ListTransferableSkusRequest( - cloud_identity_id="cloud_identity_id_value", - parent="parent_value", - ) - - # Make the request - page_result = client.list_transferable_skus(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py deleted file mode 100644 index 936643e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for LookupOffer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_LookupOffer_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_lookup_offer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.LookupOfferRequest( - entitlement="entitlement_value", - ) - - # Make the request - response = await client.lookup_offer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_LookupOffer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py deleted file mode 100644 index a0f5c74..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for LookupOffer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_LookupOffer_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_lookup_offer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.LookupOfferRequest( - entitlement="entitlement_value", - ) - - # Make the request - response = client.lookup_offer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_LookupOffer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py deleted file mode 100644 index 8ff3034..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ProvisionCloudIdentity -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_provision_cloud_identity(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.ProvisionCloudIdentityRequest( - customer="customer_value", - ) - - # Make the request - operation = client.provision_cloud_identity(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py deleted file mode 100644 index fe82de8..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ProvisionCloudIdentity -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_provision_cloud_identity(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.ProvisionCloudIdentityRequest( - customer="customer_value", - ) - - # Make the request - operation = client.provision_cloud_identity(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py deleted file mode 100644 index d07471a..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RegisterSubscriber -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_register_subscriber(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.RegisterSubscriberRequest( - account="account_value", - service_account="service_account_value", - ) - - # Make the request - response = await client.register_subscriber(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py deleted file mode 100644 index ae53dfa..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RegisterSubscriber -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_register_subscriber(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.RegisterSubscriberRequest( - account="account_value", - service_account="service_account_value", - ) - - # Make the request - response = client.register_subscriber(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py deleted file mode 100644 index 7467019..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for StartPaidService -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_StartPaidService_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_start_paid_service(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.StartPaidServiceRequest( - name="name_value", - ) - - # Make the request - operation = client.start_paid_service(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_StartPaidService_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py deleted file mode 100644 index d3f56f5..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for StartPaidService -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_StartPaidService_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_start_paid_service(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.StartPaidServiceRequest( - name="name_value", - ) - - # Make the request - operation = client.start_paid_service(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_StartPaidService_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py deleted file mode 100644 index 260d7de..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SuspendEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_suspend_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.SuspendEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.suspend_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py deleted file mode 100644 index 2b7683b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SuspendEntitlement -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_suspend_entitlement(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.SuspendEntitlementRequest( - name="name_value", - ) - - # Make the request - operation = client.suspend_entitlement(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py deleted file mode 100644 index ceada69..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for TransferEntitlements -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_transfer_entitlements(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - entitlements = channel_v1.Entitlement() - entitlements.offer = "offer_value" - - request = channel_v1.TransferEntitlementsRequest( - parent="parent_value", - entitlements=entitlements, - ) - - # Make the request - operation = client.transfer_entitlements(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py deleted file mode 100644 index 5835e28..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for TransferEntitlements -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_transfer_entitlements(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - entitlements = channel_v1.Entitlement() - entitlements.offer = "offer_value" - - request = channel_v1.TransferEntitlementsRequest( - parent="parent_value", - entitlements=entitlements, - ) - - # Make the request - operation = client.transfer_entitlements(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py deleted file mode 100644 index 87fee38..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for TransferEntitlementsToGoogle -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_transfer_entitlements_to_google(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - entitlements = channel_v1.Entitlement() - entitlements.offer = "offer_value" - - request = channel_v1.TransferEntitlementsToGoogleRequest( - parent="parent_value", - entitlements=entitlements, - ) - - # Make the request - operation = client.transfer_entitlements_to_google(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py deleted file mode 100644 index 16e7853..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for TransferEntitlementsToGoogle -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_transfer_entitlements_to_google(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - entitlements = channel_v1.Entitlement() - entitlements.offer = "offer_value" - - request = channel_v1.TransferEntitlementsToGoogleRequest( - parent="parent_value", - entitlements=entitlements, - ) - - # Make the request - operation = client.transfer_entitlements_to_google(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py deleted file mode 100644 index 5983d02..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UnregisterSubscriber -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_unregister_subscriber(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - request = channel_v1.UnregisterSubscriberRequest( - account="account_value", - service_account="service_account_value", - ) - - # Make the request - response = await client.unregister_subscriber(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py deleted file mode 100644 index ab88607..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UnregisterSubscriber -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_unregister_subscriber(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - request = channel_v1.UnregisterSubscriberRequest( - account="account_value", - service_account="service_account_value", - ) - - # Make the request - response = client.unregister_subscriber(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py deleted file mode 100644 index acbd021..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateChannelPartnerLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_update_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - channel_partner_link = channel_v1.ChannelPartnerLink() - channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" - channel_partner_link.link_state = "SUSPENDED" - - request = channel_v1.UpdateChannelPartnerLinkRequest( - name="name_value", - channel_partner_link=channel_partner_link, - ) - - # Make the request - response = await client.update_channel_partner_link(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py deleted file mode 100644 index 7b4aaad..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateChannelPartnerLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_update_channel_partner_link(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - channel_partner_link = channel_v1.ChannelPartnerLink() - channel_partner_link.reseller_cloud_identity_id = "reseller_cloud_identity_id_value" - channel_partner_link.link_state = "SUSPENDED" - - request = channel_v1.UpdateChannelPartnerLinkRequest( - name="name_value", - channel_partner_link=channel_partner_link, - ) - - # Make the request - response = client.update_channel_partner_link(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py deleted file mode 100644 index 8199bc2..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateChannelPartnerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_update_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() - channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.UpdateChannelPartnerRepricingConfigRequest( - channel_partner_repricing_config=channel_partner_repricing_config, - ) - - # Make the request - response = await client.update_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py deleted file mode 100644 index 94fed44..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateChannelPartnerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_update_channel_partner_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - channel_partner_repricing_config = channel_v1.ChannelPartnerRepricingConfig() - channel_partner_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.UpdateChannelPartnerRepricingConfigRequest( - channel_partner_repricing_config=channel_partner_repricing_config, - ) - - # Make the request - response = client.update_channel_partner_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py deleted file mode 100644 index 3730dc8..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_update_customer(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - customer = channel_v1.Customer() - customer.org_display_name = "org_display_name_value" - customer.domain = "domain_value" - - request = channel_v1.UpdateCustomerRequest( - customer=customer, - ) - - # Make the request - response = await client.update_customer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py deleted file mode 100644 index 28e86c9..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCustomerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -async def sample_update_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceAsyncClient() - - # Initialize request argument(s) - customer_repricing_config = channel_v1.CustomerRepricingConfig() - customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.UpdateCustomerRepricingConfigRequest( - customer_repricing_config=customer_repricing_config, - ) - - # Make the request - response = await client.update_customer_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py deleted file mode 100644 index 6f71c7c..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCustomerRepricingConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_update_customer_repricing_config(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - customer_repricing_config = channel_v1.CustomerRepricingConfig() - customer_repricing_config.repricing_config.rebilling_basis = "DIRECT_CUSTOMER_COST" - - request = channel_v1.UpdateCustomerRepricingConfigRequest( - customer_repricing_config=customer_repricing_config, - ) - - # Make the request - response = client.update_customer_repricing_config(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py b/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py deleted file mode 100644 index 626c660..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCustomer -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-channel - - -# [START cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud import channel_v1 - - -def sample_update_customer(): - # Create a client - client = channel_v1.CloudChannelServiceClient() - - # Initialize request argument(s) - customer = channel_v1.Customer() - customer.org_display_name = "org_display_name_value" - customer.domain = "domain_value" - - request = channel_v1.UpdateCustomerRequest( - customer=customer, - ) - - # Make the request - response = client.update_customer(request=request) - - # Handle the response - print(response) - -# [END cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_channel_v1.json b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_channel_v1.json deleted file mode 100644 index 44fb553..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_channel_v1.json +++ /dev/null @@ -1,7468 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.cloud.channel.v1", - "version": "v1" - } - ], - "language": "PYTHON", - "name": "google-cloud-channel" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient", - "shortName": "CloudChannelReportsServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient.fetch_report_results", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService", - "shortName": "CloudChannelReportsService" - }, - "shortName": "FetchReportResults" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.FetchReportResultsRequest" - }, - { - "name": "report_job", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.FetchReportResultsAsyncPager", - "shortName": "fetch_report_results" - }, - "description": "Sample for FetchReportResults", - "file": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient", - "shortName": "CloudChannelReportsServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient.fetch_report_results", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService", - "shortName": "CloudChannelReportsService" - }, - "shortName": "FetchReportResults" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.FetchReportResultsRequest" - }, - { - "name": "report_job", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.FetchReportResultsPager", - "shortName": "fetch_report_results" - }, - "description": "Sample for FetchReportResults", - "file": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient", - "shortName": "CloudChannelReportsServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient.list_reports", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService.ListReports", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService", - "shortName": "CloudChannelReportsService" - }, - "shortName": "ListReports" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListReportsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.ListReportsAsyncPager", - "shortName": "list_reports" - }, - "description": "Sample for ListReports", - "file": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_ListReports_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient", - "shortName": "CloudChannelReportsServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient.list_reports", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService.ListReports", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService", - "shortName": "CloudChannelReportsService" - }, - "shortName": "ListReports" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListReportsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.ListReportsPager", - "shortName": "list_reports" - }, - "description": "Sample for ListReports", - "file": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_ListReports_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient", - "shortName": "CloudChannelReportsServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient.run_report_job", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService.RunReportJob", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService", - "shortName": "CloudChannelReportsService" - }, - "shortName": "RunReportJob" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.RunReportJobRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "run_report_job" - }, - "description": "Sample for RunReportJob", - "file": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient", - "shortName": "CloudChannelReportsServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient.run_report_job", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService.RunReportJob", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelReportsService", - "shortName": "CloudChannelReportsService" - }, - "shortName": "RunReportJob" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.RunReportJobRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "run_report_job" - }, - "description": "Sample for RunReportJob", - "file": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.activate_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ActivateEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ActivateEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ActivateEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "activate_entitlement" - }, - "description": "Sample for ActivateEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.activate_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ActivateEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ActivateEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ActivateEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "activate_entitlement" - }, - "description": "Sample for ActivateEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ActivateEntitlement_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_activate_entitlement_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.cancel_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CancelEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CancelEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CancelEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "cancel_entitlement" - }, - "description": "Sample for CancelEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.cancel_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CancelEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CancelEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CancelEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "cancel_entitlement" - }, - "description": "Sample for CancelEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CancelEntitlement_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_cancel_entitlement_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.change_offer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeOffer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ChangeOffer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ChangeOfferRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "change_offer" - }, - "description": "Sample for ChangeOffer", - "file": "cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeOffer_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_change_offer_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.change_offer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeOffer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ChangeOffer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ChangeOfferRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "change_offer" - }, - "description": "Sample for ChangeOffer", - "file": "cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeOffer_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_change_offer_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.change_parameters", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeParameters", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ChangeParameters" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ChangeParametersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "change_parameters" - }, - "description": "Sample for ChangeParameters", - "file": "cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeParameters_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_change_parameters_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.change_parameters", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeParameters", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ChangeParameters" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ChangeParametersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "change_parameters" - }, - "description": "Sample for ChangeParameters", - "file": "cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeParameters_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_change_parameters_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.change_renewal_settings", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ChangeRenewalSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ChangeRenewalSettingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "change_renewal_settings" - }, - "description": "Sample for ChangeRenewalSettings", - "file": "cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.change_renewal_settings", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ChangeRenewalSettings", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ChangeRenewalSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ChangeRenewalSettingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "change_renewal_settings" - }, - "description": "Sample for ChangeRenewalSettings", - "file": "cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ChangeRenewalSettings_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_change_renewal_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.check_cloud_identity_accounts_exist", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CheckCloudIdentityAccountsExist" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistResponse", - "shortName": "check_cloud_identity_accounts_exist" - }, - "description": "Sample for CheckCloudIdentityAccountsExist", - "file": "cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.check_cloud_identity_accounts_exist", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CheckCloudIdentityAccountsExist", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CheckCloudIdentityAccountsExist" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.CheckCloudIdentityAccountsExistResponse", - "shortName": "check_cloud_identity_accounts_exist" - }, - "description": "Sample for CheckCloudIdentityAccountsExist", - "file": "cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CheckCloudIdentityAccountsExist_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_check_cloud_identity_accounts_exist_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_channel_partner_link", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateChannelPartnerLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateChannelPartnerLinkRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", - "shortName": "create_channel_partner_link" - }, - "description": "Sample for CreateChannelPartnerLink", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_channel_partner_link", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerLink", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateChannelPartnerLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateChannelPartnerLinkRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", - "shortName": "create_channel_partner_link" - }, - "description": "Sample for CreateChannelPartnerLink", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerLink_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_channel_partner_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateChannelPartnerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateChannelPartnerRepricingConfigRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "channel_partner_repricing_config", - "type": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", - "shortName": "create_channel_partner_repricing_config" - }, - "description": "Sample for CreateChannelPartnerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_channel_partner_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateChannelPartnerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateChannelPartnerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateChannelPartnerRepricingConfigRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "channel_partner_repricing_config", - "type": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", - "shortName": "create_channel_partner_repricing_config" - }, - "description": "Sample for CreateChannelPartnerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateChannelPartnerRepricingConfig_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_channel_partner_repricing_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_customer_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateCustomerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateCustomerRepricingConfigRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "customer_repricing_config", - "type": "google.cloud.channel_v1.types.CustomerRepricingConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", - "shortName": "create_customer_repricing_config" - }, - "description": "Sample for CreateCustomerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_customer_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateCustomerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateCustomerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateCustomerRepricingConfigRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "customer_repricing_config", - "type": "google.cloud.channel_v1.types.CustomerRepricingConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", - "shortName": "create_customer_repricing_config" - }, - "description": "Sample for CreateCustomerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateCustomerRepricingConfig_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_customer_repricing_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateCustomerRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Customer", - "shortName": "create_customer" - }, - "description": "Sample for CreateCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateCustomer_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_customer_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateCustomerRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Customer", - "shortName": "create_customer" - }, - "description": "Sample for CreateCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateCustomer_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_customer_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.create_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_entitlement" - }, - "description": "Sample for CreateEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_async", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_entitlement_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.create_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.CreateEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "CreateEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.CreateEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_entitlement" - }, - "description": "Sample for CreateEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_CreateEntitlement_sync", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_create_entitlement_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.delete_channel_partner_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteChannelPartnerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "DeleteChannelPartnerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.DeleteChannelPartnerRepricingConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_channel_partner_repricing_config" - }, - "description": "Sample for DeleteChannelPartnerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.delete_channel_partner_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteChannelPartnerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "DeleteChannelPartnerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.DeleteChannelPartnerRepricingConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_channel_partner_repricing_config" - }, - "description": "Sample for DeleteChannelPartnerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteChannelPartnerRepricingConfig_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_delete_channel_partner_repricing_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.delete_customer_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "DeleteCustomerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.DeleteCustomerRepricingConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_customer_repricing_config" - }, - "description": "Sample for DeleteCustomerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.delete_customer_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteCustomerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "DeleteCustomerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.DeleteCustomerRepricingConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_customer_repricing_config" - }, - "description": "Sample for DeleteCustomerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteCustomerRepricingConfig_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_repricing_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.delete_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "DeleteCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.DeleteCustomerRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_customer" - }, - "description": "Sample for DeleteCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.delete_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.DeleteCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "DeleteCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.DeleteCustomerRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_customer" - }, - "description": "Sample for DeleteCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_DeleteCustomer_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_delete_customer_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_channel_partner_link", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetChannelPartnerLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetChannelPartnerLinkRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", - "shortName": "get_channel_partner_link" - }, - "description": "Sample for GetChannelPartnerLink", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_channel_partner_link", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetChannelPartnerLink", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetChannelPartnerLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetChannelPartnerLinkRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", - "shortName": "get_channel_partner_link" - }, - "description": "Sample for GetChannelPartnerLink", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_channel_partner_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetChannelPartnerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetChannelPartnerRepricingConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", - "shortName": "get_channel_partner_repricing_config" - }, - "description": "Sample for GetChannelPartnerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_channel_partner_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetChannelPartnerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetChannelPartnerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetChannelPartnerRepricingConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", - "shortName": "get_channel_partner_repricing_config" - }, - "description": "Sample for GetChannelPartnerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetChannelPartnerRepricingConfig_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_repricing_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_customer_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetCustomerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetCustomerRepricingConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", - "shortName": "get_customer_repricing_config" - }, - "description": "Sample for GetCustomerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_customer_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetCustomerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetCustomerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetCustomerRepricingConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", - "shortName": "get_customer_repricing_config" - }, - "description": "Sample for GetCustomerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetCustomerRepricingConfig_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_customer_repricing_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetCustomerRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Customer", - "shortName": "get_customer" - }, - "description": "Sample for GetCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetCustomer_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_customer_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetCustomerRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Customer", - "shortName": "get_customer" - }, - "description": "Sample for GetCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetCustomer_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_customer_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.get_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Entitlement", - "shortName": "get_entitlement" - }, - "description": "Sample for GetEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetEntitlement_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_entitlement_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.get_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.GetEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "GetEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.GetEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Entitlement", - "shortName": "get_entitlement" - }, - "description": "Sample for GetEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_GetEntitlement_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_get_entitlement_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.import_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ImportCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ImportCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ImportCustomerRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Customer", - "shortName": "import_customer" - }, - "description": "Sample for ImportCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ImportCustomer_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_import_customer_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.import_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ImportCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ImportCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ImportCustomerRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Customer", - "shortName": "import_customer" - }, - "description": "Sample for ImportCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ImportCustomer_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_import_customer_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_channel_partner_links", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListChannelPartnerLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListChannelPartnerLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerLinksAsyncPager", - "shortName": "list_channel_partner_links" - }, - "description": "Sample for ListChannelPartnerLinks", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_channel_partner_links", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListChannelPartnerLinks", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListChannelPartnerLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListChannelPartnerLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerLinksPager", - "shortName": "list_channel_partner_links" - }, - "description": "Sample for ListChannelPartnerLinks", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerLinks_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_channel_partner_repricing_configs", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListChannelPartnerRepricingConfigs" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerRepricingConfigsAsyncPager", - "shortName": "list_channel_partner_repricing_configs" - }, - "description": "Sample for ListChannelPartnerRepricingConfigs", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_channel_partner_repricing_configs", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListChannelPartnerRepricingConfigs" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListChannelPartnerRepricingConfigsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListChannelPartnerRepricingConfigsPager", - "shortName": "list_channel_partner_repricing_configs" - }, - "description": "Sample for ListChannelPartnerRepricingConfigs", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListChannelPartnerRepricingConfigs_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_channel_partner_repricing_configs_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_customer_repricing_configs", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListCustomerRepricingConfigs" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomerRepricingConfigsAsyncPager", - "shortName": "list_customer_repricing_configs" - }, - "description": "Sample for ListCustomerRepricingConfigs", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_customer_repricing_configs", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListCustomerRepricingConfigs", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListCustomerRepricingConfigs" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListCustomerRepricingConfigsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomerRepricingConfigsPager", - "shortName": "list_customer_repricing_configs" - }, - "description": "Sample for ListCustomerRepricingConfigs", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListCustomerRepricingConfigs_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_customer_repricing_configs_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_customers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListCustomers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListCustomers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListCustomersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomersAsyncPager", - "shortName": "list_customers" - }, - "description": "Sample for ListCustomers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListCustomers_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_customers_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_customers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListCustomers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListCustomers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListCustomersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListCustomersPager", - "shortName": "list_customers" - }, - "description": "Sample for ListCustomers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListCustomers_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_customers_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_entitlements", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListEntitlements", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListEntitlements" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListEntitlementsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListEntitlementsAsyncPager", - "shortName": "list_entitlements" - }, - "description": "Sample for ListEntitlements", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListEntitlements_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_entitlements_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_entitlements", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListEntitlements", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListEntitlements" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListEntitlementsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListEntitlementsPager", - "shortName": "list_entitlements" - }, - "description": "Sample for ListEntitlements", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListEntitlements_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_entitlements_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_offers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListOffers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListOffers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListOffersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListOffersAsyncPager", - "shortName": "list_offers" - }, - "description": "Sample for ListOffers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListOffers_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_offers_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_offers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListOffers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListOffers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListOffersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListOffersPager", - "shortName": "list_offers" - }, - "description": "Sample for ListOffers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListOffers_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_offers_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_products", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListProducts", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListProducts" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListProductsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListProductsAsyncPager", - "shortName": "list_products" - }, - "description": "Sample for ListProducts", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_products_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListProducts_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_products_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_products", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListProducts", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListProducts" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListProductsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListProductsPager", - "shortName": "list_products" - }, - "description": "Sample for ListProducts", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListProducts_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_products_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_purchasable_offers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListPurchasableOffers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListPurchasableOffers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListPurchasableOffersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableOffersAsyncPager", - "shortName": "list_purchasable_offers" - }, - "description": "Sample for ListPurchasableOffers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_purchasable_offers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListPurchasableOffers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListPurchasableOffers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListPurchasableOffersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableOffersPager", - "shortName": "list_purchasable_offers" - }, - "description": "Sample for ListPurchasableOffers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListPurchasableOffers_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_offers_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_purchasable_skus", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListPurchasableSkus", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListPurchasableSkus" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListPurchasableSkusRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableSkusAsyncPager", - "shortName": "list_purchasable_skus" - }, - "description": "Sample for ListPurchasableSkus", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_purchasable_skus", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListPurchasableSkus", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListPurchasableSkus" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListPurchasableSkusRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListPurchasableSkusPager", - "shortName": "list_purchasable_skus" - }, - "description": "Sample for ListPurchasableSkus", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListPurchasableSkus_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_purchasable_skus_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_skus", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListSkus", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListSkus" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListSkusRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSkusAsyncPager", - "shortName": "list_skus" - }, - "description": "Sample for ListSkus", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListSkus_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_skus_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_skus", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListSkus", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListSkus" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListSkusRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSkusPager", - "shortName": "list_skus" - }, - "description": "Sample for ListSkus", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListSkus_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_skus_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_subscribers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListSubscribers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListSubscribers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListSubscribersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSubscribersAsyncPager", - "shortName": "list_subscribers" - }, - "description": "Sample for ListSubscribers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListSubscribers_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_subscribers_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_subscribers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListSubscribers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListSubscribers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListSubscribersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListSubscribersPager", - "shortName": "list_subscribers" - }, - "description": "Sample for ListSubscribers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListSubscribers_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_subscribers_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_transferable_offers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListTransferableOffers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListTransferableOffers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListTransferableOffersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableOffersAsyncPager", - "shortName": "list_transferable_offers" - }, - "description": "Sample for ListTransferableOffers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_transferable_offers", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListTransferableOffers", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListTransferableOffers" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListTransferableOffersRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableOffersPager", - "shortName": "list_transferable_offers" - }, - "description": "Sample for ListTransferableOffers", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListTransferableOffers_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 47, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 50, - "start": 48, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 51, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_offers_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.list_transferable_skus", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListTransferableSkus", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListTransferableSkus" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListTransferableSkusRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableSkusAsyncPager", - "shortName": "list_transferable_skus" - }, - "description": "Sample for ListTransferableSkus", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_transferable_skus", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ListTransferableSkus", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ListTransferableSkus" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ListTransferableSkusRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.services.cloud_channel_service.pagers.ListTransferableSkusPager", - "shortName": "list_transferable_skus" - }, - "description": "Sample for ListTransferableSkus", - "file": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListTransferableSkus_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.lookup_offer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.LookupOffer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "LookupOffer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.LookupOfferRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Offer", - "shortName": "lookup_offer" - }, - "description": "Sample for LookupOffer", - "file": "cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_LookupOffer_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_lookup_offer_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.lookup_offer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.LookupOffer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "LookupOffer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.LookupOfferRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Offer", - "shortName": "lookup_offer" - }, - "description": "Sample for LookupOffer", - "file": "cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_LookupOffer_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_lookup_offer_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.provision_cloud_identity", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ProvisionCloudIdentity" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ProvisionCloudIdentityRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "provision_cloud_identity" - }, - "description": "Sample for ProvisionCloudIdentity", - "file": "cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.provision_cloud_identity", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.ProvisionCloudIdentity", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "ProvisionCloudIdentity" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.ProvisionCloudIdentityRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "provision_cloud_identity" - }, - "description": "Sample for ProvisionCloudIdentity", - "file": "cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_ProvisionCloudIdentity_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_provision_cloud_identity_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.register_subscriber", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.RegisterSubscriber", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "RegisterSubscriber" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.RegisterSubscriberRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.RegisterSubscriberResponse", - "shortName": "register_subscriber" - }, - "description": "Sample for RegisterSubscriber", - "file": "cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_register_subscriber_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.register_subscriber", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.RegisterSubscriber", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "RegisterSubscriber" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.RegisterSubscriberRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.RegisterSubscriberResponse", - "shortName": "register_subscriber" - }, - "description": "Sample for RegisterSubscriber", - "file": "cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_RegisterSubscriber_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_register_subscriber_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.start_paid_service", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.StartPaidService", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "StartPaidService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.StartPaidServiceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "start_paid_service" - }, - "description": "Sample for StartPaidService", - "file": "cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_StartPaidService_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_start_paid_service_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.start_paid_service", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.StartPaidService", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "StartPaidService" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.StartPaidServiceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "start_paid_service" - }, - "description": "Sample for StartPaidService", - "file": "cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_StartPaidService_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_start_paid_service_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.suspend_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.SuspendEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "SuspendEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.SuspendEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "suspend_entitlement" - }, - "description": "Sample for SuspendEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.suspend_entitlement", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.SuspendEntitlement", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "SuspendEntitlement" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.SuspendEntitlementRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "suspend_entitlement" - }, - "description": "Sample for SuspendEntitlement", - "file": "cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_SuspendEntitlement_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_suspend_entitlement_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.transfer_entitlements_to_google", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "TransferEntitlementsToGoogle" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.TransferEntitlementsToGoogleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "transfer_entitlements_to_google" - }, - "description": "Sample for TransferEntitlementsToGoogle", - "file": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_async", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.transfer_entitlements_to_google", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.TransferEntitlementsToGoogle", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "TransferEntitlementsToGoogle" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.TransferEntitlementsToGoogleRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "transfer_entitlements_to_google" - }, - "description": "Sample for TransferEntitlementsToGoogle", - "file": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_TransferEntitlementsToGoogle_sync", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_to_google_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.transfer_entitlements", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.TransferEntitlements", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "TransferEntitlements" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.TransferEntitlementsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "transfer_entitlements" - }, - "description": "Sample for TransferEntitlements", - "file": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_async", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.transfer_entitlements", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.TransferEntitlements", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "TransferEntitlements" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.TransferEntitlementsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "transfer_entitlements" - }, - "description": "Sample for TransferEntitlements", - "file": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_TransferEntitlements_sync", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_transfer_entitlements_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.unregister_subscriber", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UnregisterSubscriber", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UnregisterSubscriber" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UnregisterSubscriberRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.UnregisterSubscriberResponse", - "shortName": "unregister_subscriber" - }, - "description": "Sample for UnregisterSubscriber", - "file": "cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.unregister_subscriber", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UnregisterSubscriber", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UnregisterSubscriber" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UnregisterSubscriberRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.UnregisterSubscriberResponse", - "shortName": "unregister_subscriber" - }, - "description": "Sample for UnregisterSubscriber", - "file": "cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UnregisterSubscriber_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_unregister_subscriber_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.update_channel_partner_link", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UpdateChannelPartnerLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UpdateChannelPartnerLinkRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", - "shortName": "update_channel_partner_link" - }, - "description": "Sample for UpdateChannelPartnerLink", - "file": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.update_channel_partner_link", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerLink", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UpdateChannelPartnerLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UpdateChannelPartnerLinkRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerLink", - "shortName": "update_channel_partner_link" - }, - "description": "Sample for UpdateChannelPartnerLink", - "file": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerLink_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.update_channel_partner_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UpdateChannelPartnerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UpdateChannelPartnerRepricingConfigRequest" - }, - { - "name": "channel_partner_repricing_config", - "type": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", - "shortName": "update_channel_partner_repricing_config" - }, - "description": "Sample for UpdateChannelPartnerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.update_channel_partner_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateChannelPartnerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UpdateChannelPartnerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UpdateChannelPartnerRepricingConfigRequest" - }, - { - "name": "channel_partner_repricing_config", - "type": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.ChannelPartnerRepricingConfig", - "shortName": "update_channel_partner_repricing_config" - }, - "description": "Sample for UpdateChannelPartnerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateChannelPartnerRepricingConfig_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_update_channel_partner_repricing_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.update_customer_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UpdateCustomerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UpdateCustomerRepricingConfigRequest" - }, - { - "name": "customer_repricing_config", - "type": "google.cloud.channel_v1.types.CustomerRepricingConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", - "shortName": "update_customer_repricing_config" - }, - "description": "Sample for UpdateCustomerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.update_customer_repricing_config", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateCustomerRepricingConfig", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UpdateCustomerRepricingConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UpdateCustomerRepricingConfigRequest" - }, - { - "name": "customer_repricing_config", - "type": "google.cloud.channel_v1.types.CustomerRepricingConfig" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.CustomerRepricingConfig", - "shortName": "update_customer_repricing_config" - }, - "description": "Sample for UpdateCustomerRepricingConfig", - "file": "cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateCustomerRepricingConfig_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_update_customer_repricing_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient", - "shortName": "CloudChannelServiceAsyncClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceAsyncClient.update_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UpdateCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UpdateCustomerRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Customer", - "shortName": "update_customer" - }, - "description": "Sample for UpdateCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_update_customer_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", - "shortName": "CloudChannelServiceClient" - }, - "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.update_customer", - "method": { - "fullName": "google.cloud.channel.v1.CloudChannelService.UpdateCustomer", - "service": { - "fullName": "google.cloud.channel.v1.CloudChannelService", - "shortName": "CloudChannelService" - }, - "shortName": "UpdateCustomer" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.channel_v1.types.UpdateCustomerRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.channel_v1.types.Customer", - "shortName": "update_customer" - }, - "description": "Sample for UpdateCustomer", - "file": "cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "cloudchannel_v1_generated_CloudChannelService_UpdateCustomer_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "cloudchannel_v1_generated_cloud_channel_service_update_customer_sync.py" - } - ] -} diff --git a/owl-bot-staging/v1/scripts/fixup_channel_v1_keywords.py b/owl-bot-staging/v1/scripts/fixup_channel_v1_keywords.py deleted file mode 100644 index 643b44c..0000000 --- a/owl-bot-staging/v1/scripts/fixup_channel_v1_keywords.py +++ /dev/null @@ -1,223 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -class channelCallTransformer(cst.CSTTransformer): - CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') - METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'activate_entitlement': ('name', 'request_id', ), - 'cancel_entitlement': ('name', 'request_id', ), - 'change_offer': ('name', 'offer', 'parameters', 'purchase_order_id', 'request_id', ), - 'change_parameters': ('name', 'parameters', 'request_id', 'purchase_order_id', ), - 'change_renewal_settings': ('name', 'renewal_settings', 'request_id', ), - 'check_cloud_identity_accounts_exist': ('parent', 'domain', ), - 'create_channel_partner_link': ('parent', 'channel_partner_link', ), - 'create_channel_partner_repricing_config': ('parent', 'channel_partner_repricing_config', ), - 'create_customer': ('parent', 'customer', ), - 'create_customer_repricing_config': ('parent', 'customer_repricing_config', ), - 'create_entitlement': ('parent', 'entitlement', 'request_id', ), - 'delete_channel_partner_repricing_config': ('name', ), - 'delete_customer': ('name', ), - 'delete_customer_repricing_config': ('name', ), - 'fetch_report_results': ('report_job', 'page_size', 'page_token', ), - 'get_channel_partner_link': ('name', 'view', ), - 'get_channel_partner_repricing_config': ('name', ), - 'get_customer': ('name', ), - 'get_customer_repricing_config': ('name', ), - 'get_entitlement': ('name', ), - 'import_customer': ('domain', 'cloud_identity_id', 'parent', 'overwrite_if_exists', 'auth_token', 'channel_partner_id', 'customer', ), - 'list_channel_partner_links': ('parent', 'page_size', 'page_token', 'view', ), - 'list_channel_partner_repricing_configs': ('parent', 'page_size', 'page_token', 'filter', ), - 'list_customer_repricing_configs': ('parent', 'page_size', 'page_token', 'filter', ), - 'list_customers': ('parent', 'page_size', 'page_token', 'filter', ), - 'list_entitlements': ('parent', 'page_size', 'page_token', ), - 'list_offers': ('parent', 'page_size', 'page_token', 'filter', 'language_code', ), - 'list_products': ('account', 'page_size', 'page_token', 'language_code', ), - 'list_purchasable_offers': ('customer', 'create_entitlement_purchase', 'change_offer_purchase', 'page_size', 'page_token', 'language_code', ), - 'list_purchasable_skus': ('customer', 'create_entitlement_purchase', 'change_offer_purchase', 'page_size', 'page_token', 'language_code', ), - 'list_reports': ('parent', 'page_size', 'page_token', 'language_code', ), - 'list_skus': ('parent', 'account', 'page_size', 'page_token', 'language_code', ), - 'list_subscribers': ('account', 'page_size', 'page_token', ), - 'list_transferable_offers': ('parent', 'sku', 'cloud_identity_id', 'customer_name', 'page_size', 'page_token', 'language_code', ), - 'list_transferable_skus': ('parent', 'cloud_identity_id', 'customer_name', 'page_size', 'page_token', 'auth_token', 'language_code', ), - 'lookup_offer': ('entitlement', ), - 'provision_cloud_identity': ('customer', 'cloud_identity_info', 'user', 'validate_only', ), - 'register_subscriber': ('account', 'service_account', ), - 'run_report_job': ('name', 'date_range', 'filter', 'language_code', ), - 'start_paid_service': ('name', 'request_id', ), - 'suspend_entitlement': ('name', 'request_id', ), - 'transfer_entitlements': ('parent', 'entitlements', 'auth_token', 'request_id', ), - 'transfer_entitlements_to_google': ('parent', 'entitlements', 'request_id', ), - 'unregister_subscriber': ('account', 'service_account', ), - 'update_channel_partner_link': ('name', 'channel_partner_link', 'update_mask', ), - 'update_channel_partner_repricing_config': ('channel_partner_repricing_config', ), - 'update_customer': ('customer', 'update_mask', ), - 'update_customer_repricing_config': ('customer_repricing_config', ), - } - - def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -cst.Element(value=arg.value) - ) - # Note: the args + kwargs looks silly, but keep in mind that - # the control parameters had to be stripped out, and that - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=channelCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the channel client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1/setup.py b/owl-bot-staging/v1/setup.py deleted file mode 100644 index 508f3d4..0000000 --- a/owl-bot-staging/v1/setup.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import io -import os -import setuptools # type: ignore - -version = '0.1.0' - -package_root = os.path.abspath(os.path.dirname(__file__)) - -readme_filename = os.path.join(package_root, 'README.rst') -with io.open(readme_filename, encoding='utf-8') as readme_file: - readme = readme_file.read() - -setuptools.setup( - name='google-cloud-channel', - author="Google LLC", - author_email="googleapis-packages@google.com", - url="https://github.com/googleapis/python-google-cloud-channel", - version=version, - long_description=readme, - packages=setuptools.PEP420PackageFinder.find(), - namespace_packages=('google', 'google.cloud'), - platforms='Posix; MacOS X; Windows', - include_package_data=True, - install_requires=( - 'google-api-core[grpc] >= 2.10.0, < 3.0.0dev', - 'libcst >= 0.2.5', - 'googleapis-common-protos >= 1.55.0, <2.0.0dev', - 'proto-plus >= 1.19.7', - ), - python_requires='>=3.7', - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Topic :: Internet', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], - zip_safe=False, -) diff --git a/owl-bot-staging/v1/tests/__init__.py b/owl-bot-staging/v1/tests/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/__init__.py b/owl-bot-staging/v1/tests/unit/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/channel_v1/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/channel_v1/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/channel_v1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_service.py b/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_service.py deleted file mode 100644 index 3e356cf..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_service.py +++ /dev/null @@ -1,12149 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -import grpc -from grpc.experimental import aio -import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers - -from google.api_core import client_options -from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation -from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template -from google.auth import credentials as ga_credentials -from google.auth.exceptions import MutualTLSChannelError -from google.cloud.channel_v1.services.cloud_channel_service import CloudChannelServiceAsyncClient -from google.cloud.channel_v1.services.cloud_channel_service import CloudChannelServiceClient -from google.cloud.channel_v1.services.cloud_channel_service import pagers -from google.cloud.channel_v1.services.cloud_channel_service import transports -from google.cloud.channel_v1.types import channel_partner_links -from google.cloud.channel_v1.types import common -from google.cloud.channel_v1.types import customers -from google.cloud.channel_v1.types import entitlements -from google.cloud.channel_v1.types import offers -from google.cloud.channel_v1.types import operations -from google.cloud.channel_v1.types import products -from google.cloud.channel_v1.types import repricing -from google.cloud.channel_v1.types import service -from google.longrunning import operations_pb2 -from google.oauth2 import service_account -from google.protobuf import any_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from google.type import date_pb2 # type: ignore -from google.type import decimal_pb2 # type: ignore -from google.type import postal_address_pb2 # type: ignore -import google.auth - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert CloudChannelServiceClient._get_default_mtls_endpoint(None) is None - assert CloudChannelServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert CloudChannelServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint - assert CloudChannelServiceClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint - assert CloudChannelServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint - assert CloudChannelServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize("client_class,transport_name", [ - (CloudChannelServiceClient, "grpc"), - (CloudChannelServiceAsyncClient, "grpc_asyncio"), -]) -def test_cloud_channel_service_client_from_service_account_info(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: - factory.return_value = creds - info = {"valid": True} - client = client_class.from_service_account_info(info, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'cloudchannel.googleapis.com:443' - ) - - -@pytest.mark.parametrize("transport_class,transport_name", [ - (transports.CloudChannelServiceGrpcTransport, "grpc"), - (transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_cloud_channel_service_client_service_account_always_use_jwt(transport_class, transport_name): - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize("client_class,transport_name", [ - (CloudChannelServiceClient, "grpc"), - (CloudChannelServiceAsyncClient, "grpc_asyncio"), -]) -def test_cloud_channel_service_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: - factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'cloudchannel.googleapis.com:443' - ) - - -def test_cloud_channel_service_client_get_transport_class(): - transport = CloudChannelServiceClient.get_transport_class() - available_transports = [ - transports.CloudChannelServiceGrpcTransport, - ] - assert transport in available_transports - - transport = CloudChannelServiceClient.get_transport_class("grpc") - assert transport == transports.CloudChannelServiceGrpcTransport - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc"), - (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -@mock.patch.object(CloudChannelServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceClient)) -@mock.patch.object(CloudChannelServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceAsyncClient)) -def test_cloud_channel_service_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(CloudChannelServiceClient, 'get_transport_class') as gtc: - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(CloudChannelServiceClient, 'get_transport_class') as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions(api_audience="https://language.googleapis.com") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com" - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ - (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc", "true"), - (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio", "true"), - (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc", "false"), - (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio", "false"), -]) -@mock.patch.object(CloudChannelServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceClient)) -@mock.patch.object(CloudChannelServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceAsyncClient)) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_cloud_channel_service_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - if use_client_cert_env == "false": - expected_client_cert_source = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_client_cert_source = client_cert_source_callback - expected_host = client.DEFAULT_MTLS_ENDPOINT - - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): - if use_client_cert_env == "false": - expected_host = client.DEFAULT_ENDPOINT - expected_client_cert_source = None - else: - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_client_cert_source = client_cert_source_callback - - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [ - CloudChannelServiceClient, CloudChannelServiceAsyncClient -]) -@mock.patch.object(CloudChannelServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceClient)) -@mock.patch.object(CloudChannelServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelServiceAsyncClient)) -def test_cloud_channel_service_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc"), - (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_cloud_channel_service_client_client_options_scopes(client_class, transport_class, transport_name): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc", grpc_helpers), - (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_cloud_channel_service_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -def test_cloud_channel_service_client_client_options_from_dict(): - with mock.patch('google.cloud.channel_v1.services.cloud_channel_service.transports.CloudChannelServiceGrpcTransport.__init__') as grpc_transport: - grpc_transport.return_value = None - client = CloudChannelServiceClient( - client_options={'api_endpoint': 'squid.clam.whelk'} - ) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport, "grpc", grpc_helpers), - (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_cloud_channel_service_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "cloudchannel.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - 'https://www.googleapis.com/auth/apps.order', -), - scopes=None, - default_host="cloudchannel.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCustomersRequest, - dict, -]) -def test_list_customers(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCustomersResponse( - next_page_token='next_page_token_value', - ) - response = client.list_customers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCustomersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomersPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_customers_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customers), - '__call__') as call: - client.list_customers() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCustomersRequest() - -@pytest.mark.asyncio -async def test_list_customers_async(transport: str = 'grpc_asyncio', request_type=service.ListCustomersRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomersResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_customers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCustomersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomersAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_customers_async_from_dict(): - await test_list_customers_async(request_type=dict) - - -def test_list_customers_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListCustomersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customers), - '__call__') as call: - call.return_value = service.ListCustomersResponse() - client.list_customers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_customers_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListCustomersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customers), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomersResponse()) - await client.list_customers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_customers_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCustomersResponse( - customers=[ - customers.Customer(), - customers.Customer(), - customers.Customer(), - ], - next_page_token='abc', - ), - service.ListCustomersResponse( - customers=[], - next_page_token='def', - ), - service.ListCustomersResponse( - customers=[ - customers.Customer(), - ], - next_page_token='ghi', - ), - service.ListCustomersResponse( - customers=[ - customers.Customer(), - customers.Customer(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_customers(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, customers.Customer) - for i in results) -def test_list_customers_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCustomersResponse( - customers=[ - customers.Customer(), - customers.Customer(), - customers.Customer(), - ], - next_page_token='abc', - ), - service.ListCustomersResponse( - customers=[], - next_page_token='def', - ), - service.ListCustomersResponse( - customers=[ - customers.Customer(), - ], - next_page_token='ghi', - ), - service.ListCustomersResponse( - customers=[ - customers.Customer(), - customers.Customer(), - ], - ), - RuntimeError, - ) - pages = list(client.list_customers(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_customers_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCustomersResponse( - customers=[ - customers.Customer(), - customers.Customer(), - customers.Customer(), - ], - next_page_token='abc', - ), - service.ListCustomersResponse( - customers=[], - next_page_token='def', - ), - service.ListCustomersResponse( - customers=[ - customers.Customer(), - ], - next_page_token='ghi', - ), - service.ListCustomersResponse( - customers=[ - customers.Customer(), - customers.Customer(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_customers(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, customers.Customer) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_customers_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCustomersResponse( - customers=[ - customers.Customer(), - customers.Customer(), - customers.Customer(), - ], - next_page_token='abc', - ), - service.ListCustomersResponse( - customers=[], - next_page_token='def', - ), - service.ListCustomersResponse( - customers=[ - customers.Customer(), - ], - next_page_token='ghi', - ), - service.ListCustomersResponse( - customers=[ - customers.Customer(), - customers.Customer(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_customers(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.GetCustomerRequest, - dict, -]) -def test_get_customer(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = customers.Customer( - name='name_value', - org_display_name='org_display_name_value', - alternate_email='alternate_email_value', - domain='domain_value', - cloud_identity_id='cloud_identity_id_value', - language_code='language_code_value', - channel_partner_id='channel_partner_id_value', - ) - response = client.get_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCustomerRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, customers.Customer) - assert response.name == 'name_value' - assert response.org_display_name == 'org_display_name_value' - assert response.alternate_email == 'alternate_email_value' - assert response.domain == 'domain_value' - assert response.cloud_identity_id == 'cloud_identity_id_value' - assert response.language_code == 'language_code_value' - assert response.channel_partner_id == 'channel_partner_id_value' - - -def test_get_customer_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer), - '__call__') as call: - client.get_customer() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCustomerRequest() - -@pytest.mark.asyncio -async def test_get_customer_async(transport: str = 'grpc_asyncio', request_type=service.GetCustomerRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer( - name='name_value', - org_display_name='org_display_name_value', - alternate_email='alternate_email_value', - domain='domain_value', - cloud_identity_id='cloud_identity_id_value', - language_code='language_code_value', - channel_partner_id='channel_partner_id_value', - )) - response = await client.get_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCustomerRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, customers.Customer) - assert response.name == 'name_value' - assert response.org_display_name == 'org_display_name_value' - assert response.alternate_email == 'alternate_email_value' - assert response.domain == 'domain_value' - assert response.cloud_identity_id == 'cloud_identity_id_value' - assert response.language_code == 'language_code_value' - assert response.channel_partner_id == 'channel_partner_id_value' - - -@pytest.mark.asyncio -async def test_get_customer_async_from_dict(): - await test_get_customer_async(request_type=dict) - - -def test_get_customer_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetCustomerRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer), - '__call__') as call: - call.return_value = customers.Customer() - client.get_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_customer_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetCustomerRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) - await client.get_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_customer_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = customers.Customer() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_customer( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_customer_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_customer( - service.GetCustomerRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_customer_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = customers.Customer() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_customer( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_customer_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_customer( - service.GetCustomerRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.CheckCloudIdentityAccountsExistRequest, - dict, -]) -def test_check_cloud_identity_accounts_exist(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_cloud_identity_accounts_exist), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.CheckCloudIdentityAccountsExistResponse( - ) - response = client.check_cloud_identity_accounts_exist(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.CheckCloudIdentityAccountsExistRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, service.CheckCloudIdentityAccountsExistResponse) - - -def test_check_cloud_identity_accounts_exist_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_cloud_identity_accounts_exist), - '__call__') as call: - client.check_cloud_identity_accounts_exist() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CheckCloudIdentityAccountsExistRequest() - -@pytest.mark.asyncio -async def test_check_cloud_identity_accounts_exist_async(transport: str = 'grpc_asyncio', request_type=service.CheckCloudIdentityAccountsExistRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_cloud_identity_accounts_exist), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.CheckCloudIdentityAccountsExistResponse( - )) - response = await client.check_cloud_identity_accounts_exist(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.CheckCloudIdentityAccountsExistRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, service.CheckCloudIdentityAccountsExistResponse) - - -@pytest.mark.asyncio -async def test_check_cloud_identity_accounts_exist_async_from_dict(): - await test_check_cloud_identity_accounts_exist_async(request_type=dict) - - -def test_check_cloud_identity_accounts_exist_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CheckCloudIdentityAccountsExistRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_cloud_identity_accounts_exist), - '__call__') as call: - call.return_value = service.CheckCloudIdentityAccountsExistResponse() - client.check_cloud_identity_accounts_exist(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_check_cloud_identity_accounts_exist_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CheckCloudIdentityAccountsExistRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.check_cloud_identity_accounts_exist), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.CheckCloudIdentityAccountsExistResponse()) - await client.check_cloud_identity_accounts_exist(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.CreateCustomerRequest, - dict, -]) -def test_create_customer(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = customers.Customer( - name='name_value', - org_display_name='org_display_name_value', - alternate_email='alternate_email_value', - domain='domain_value', - cloud_identity_id='cloud_identity_id_value', - language_code='language_code_value', - channel_partner_id='channel_partner_id_value', - ) - response = client.create_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCustomerRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, customers.Customer) - assert response.name == 'name_value' - assert response.org_display_name == 'org_display_name_value' - assert response.alternate_email == 'alternate_email_value' - assert response.domain == 'domain_value' - assert response.cloud_identity_id == 'cloud_identity_id_value' - assert response.language_code == 'language_code_value' - assert response.channel_partner_id == 'channel_partner_id_value' - - -def test_create_customer_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer), - '__call__') as call: - client.create_customer() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCustomerRequest() - -@pytest.mark.asyncio -async def test_create_customer_async(transport: str = 'grpc_asyncio', request_type=service.CreateCustomerRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer( - name='name_value', - org_display_name='org_display_name_value', - alternate_email='alternate_email_value', - domain='domain_value', - cloud_identity_id='cloud_identity_id_value', - language_code='language_code_value', - channel_partner_id='channel_partner_id_value', - )) - response = await client.create_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCustomerRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, customers.Customer) - assert response.name == 'name_value' - assert response.org_display_name == 'org_display_name_value' - assert response.alternate_email == 'alternate_email_value' - assert response.domain == 'domain_value' - assert response.cloud_identity_id == 'cloud_identity_id_value' - assert response.language_code == 'language_code_value' - assert response.channel_partner_id == 'channel_partner_id_value' - - -@pytest.mark.asyncio -async def test_create_customer_async_from_dict(): - await test_create_customer_async(request_type=dict) - - -def test_create_customer_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateCustomerRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer), - '__call__') as call: - call.return_value = customers.Customer() - client.create_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_customer_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateCustomerRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) - await client.create_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.UpdateCustomerRequest, - dict, -]) -def test_update_customer(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = customers.Customer( - name='name_value', - org_display_name='org_display_name_value', - alternate_email='alternate_email_value', - domain='domain_value', - cloud_identity_id='cloud_identity_id_value', - language_code='language_code_value', - channel_partner_id='channel_partner_id_value', - ) - response = client.update_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCustomerRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, customers.Customer) - assert response.name == 'name_value' - assert response.org_display_name == 'org_display_name_value' - assert response.alternate_email == 'alternate_email_value' - assert response.domain == 'domain_value' - assert response.cloud_identity_id == 'cloud_identity_id_value' - assert response.language_code == 'language_code_value' - assert response.channel_partner_id == 'channel_partner_id_value' - - -def test_update_customer_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer), - '__call__') as call: - client.update_customer() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCustomerRequest() - -@pytest.mark.asyncio -async def test_update_customer_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCustomerRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer( - name='name_value', - org_display_name='org_display_name_value', - alternate_email='alternate_email_value', - domain='domain_value', - cloud_identity_id='cloud_identity_id_value', - language_code='language_code_value', - channel_partner_id='channel_partner_id_value', - )) - response = await client.update_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCustomerRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, customers.Customer) - assert response.name == 'name_value' - assert response.org_display_name == 'org_display_name_value' - assert response.alternate_email == 'alternate_email_value' - assert response.domain == 'domain_value' - assert response.cloud_identity_id == 'cloud_identity_id_value' - assert response.language_code == 'language_code_value' - assert response.channel_partner_id == 'channel_partner_id_value' - - -@pytest.mark.asyncio -async def test_update_customer_async_from_dict(): - await test_update_customer_async(request_type=dict) - - -def test_update_customer_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UpdateCustomerRequest() - - request.customer.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer), - '__call__') as call: - call.return_value = customers.Customer() - client.update_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_customer_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UpdateCustomerRequest() - - request.customer.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) - await client.update_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.DeleteCustomerRequest, - dict, -]) -def test_delete_customer(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCustomerRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -def test_delete_customer_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer), - '__call__') as call: - client.delete_customer() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCustomerRequest() - -@pytest.mark.asyncio -async def test_delete_customer_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCustomerRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCustomerRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_delete_customer_async_from_dict(): - await test_delete_customer_async(request_type=dict) - - -def test_delete_customer_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.DeleteCustomerRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer), - '__call__') as call: - call.return_value = None - client.delete_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_delete_customer_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.DeleteCustomerRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_customer_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_customer( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_customer_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_customer( - service.DeleteCustomerRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_customer_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_customer( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_customer_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_customer( - service.DeleteCustomerRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ImportCustomerRequest, - dict, -]) -def test_import_customer(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.import_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = customers.Customer( - name='name_value', - org_display_name='org_display_name_value', - alternate_email='alternate_email_value', - domain='domain_value', - cloud_identity_id='cloud_identity_id_value', - language_code='language_code_value', - channel_partner_id='channel_partner_id_value', - ) - response = client.import_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportCustomerRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, customers.Customer) - assert response.name == 'name_value' - assert response.org_display_name == 'org_display_name_value' - assert response.alternate_email == 'alternate_email_value' - assert response.domain == 'domain_value' - assert response.cloud_identity_id == 'cloud_identity_id_value' - assert response.language_code == 'language_code_value' - assert response.channel_partner_id == 'channel_partner_id_value' - - -def test_import_customer_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.import_customer), - '__call__') as call: - client.import_customer() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportCustomerRequest() - -@pytest.mark.asyncio -async def test_import_customer_async(transport: str = 'grpc_asyncio', request_type=service.ImportCustomerRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.import_customer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer( - name='name_value', - org_display_name='org_display_name_value', - alternate_email='alternate_email_value', - domain='domain_value', - cloud_identity_id='cloud_identity_id_value', - language_code='language_code_value', - channel_partner_id='channel_partner_id_value', - )) - response = await client.import_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportCustomerRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, customers.Customer) - assert response.name == 'name_value' - assert response.org_display_name == 'org_display_name_value' - assert response.alternate_email == 'alternate_email_value' - assert response.domain == 'domain_value' - assert response.cloud_identity_id == 'cloud_identity_id_value' - assert response.language_code == 'language_code_value' - assert response.channel_partner_id == 'channel_partner_id_value' - - -@pytest.mark.asyncio -async def test_import_customer_async_from_dict(): - await test_import_customer_async(request_type=dict) - - -def test_import_customer_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ImportCustomerRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.import_customer), - '__call__') as call: - call.return_value = customers.Customer() - client.import_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_import_customer_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ImportCustomerRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.import_customer), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(customers.Customer()) - await client.import_customer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.ProvisionCloudIdentityRequest, - dict, -]) -def test_provision_cloud_identity(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.provision_cloud_identity), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.provision_cloud_identity(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ProvisionCloudIdentityRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_provision_cloud_identity_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.provision_cloud_identity), - '__call__') as call: - client.provision_cloud_identity() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ProvisionCloudIdentityRequest() - -@pytest.mark.asyncio -async def test_provision_cloud_identity_async(transport: str = 'grpc_asyncio', request_type=service.ProvisionCloudIdentityRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.provision_cloud_identity), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.provision_cloud_identity(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ProvisionCloudIdentityRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_provision_cloud_identity_async_from_dict(): - await test_provision_cloud_identity_async(request_type=dict) - - -def test_provision_cloud_identity_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ProvisionCloudIdentityRequest() - - request.customer = 'customer_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.provision_cloud_identity), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.provision_cloud_identity(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer=customer_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_provision_cloud_identity_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ProvisionCloudIdentityRequest() - - request.customer = 'customer_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.provision_cloud_identity), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.provision_cloud_identity(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer=customer_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.ListEntitlementsRequest, - dict, -]) -def test_list_entitlements(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_entitlements), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListEntitlementsResponse( - next_page_token='next_page_token_value', - ) - response = client.list_entitlements(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEntitlementsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListEntitlementsPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_entitlements_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_entitlements), - '__call__') as call: - client.list_entitlements() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEntitlementsRequest() - -@pytest.mark.asyncio -async def test_list_entitlements_async(transport: str = 'grpc_asyncio', request_type=service.ListEntitlementsRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_entitlements), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListEntitlementsResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_entitlements(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEntitlementsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListEntitlementsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_entitlements_async_from_dict(): - await test_list_entitlements_async(request_type=dict) - - -def test_list_entitlements_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListEntitlementsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_entitlements), - '__call__') as call: - call.return_value = service.ListEntitlementsResponse() - client.list_entitlements(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_entitlements_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListEntitlementsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_entitlements), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListEntitlementsResponse()) - await client.list_entitlements(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_entitlements_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_entitlements), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - entitlements.Entitlement(), - entitlements.Entitlement(), - ], - next_page_token='abc', - ), - service.ListEntitlementsResponse( - entitlements=[], - next_page_token='def', - ), - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - ], - next_page_token='ghi', - ), - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - entitlements.Entitlement(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_entitlements(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, entitlements.Entitlement) - for i in results) -def test_list_entitlements_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_entitlements), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - entitlements.Entitlement(), - entitlements.Entitlement(), - ], - next_page_token='abc', - ), - service.ListEntitlementsResponse( - entitlements=[], - next_page_token='def', - ), - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - ], - next_page_token='ghi', - ), - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - entitlements.Entitlement(), - ], - ), - RuntimeError, - ) - pages = list(client.list_entitlements(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_entitlements_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_entitlements), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - entitlements.Entitlement(), - entitlements.Entitlement(), - ], - next_page_token='abc', - ), - service.ListEntitlementsResponse( - entitlements=[], - next_page_token='def', - ), - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - ], - next_page_token='ghi', - ), - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - entitlements.Entitlement(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_entitlements(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, entitlements.Entitlement) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_entitlements_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_entitlements), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - entitlements.Entitlement(), - entitlements.Entitlement(), - ], - next_page_token='abc', - ), - service.ListEntitlementsResponse( - entitlements=[], - next_page_token='def', - ), - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - ], - next_page_token='ghi', - ), - service.ListEntitlementsResponse( - entitlements=[ - entitlements.Entitlement(), - entitlements.Entitlement(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_entitlements(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.ListTransferableSkusRequest, - dict, -]) -def test_list_transferable_skus(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_skus), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListTransferableSkusResponse( - next_page_token='next_page_token_value', - ) - response = client.list_transferable_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTransferableSkusRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListTransferableSkusPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_transferable_skus_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_skus), - '__call__') as call: - client.list_transferable_skus() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTransferableSkusRequest() - -@pytest.mark.asyncio -async def test_list_transferable_skus_async(transport: str = 'grpc_asyncio', request_type=service.ListTransferableSkusRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_skus), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListTransferableSkusResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_transferable_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTransferableSkusRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListTransferableSkusAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_transferable_skus_async_from_dict(): - await test_list_transferable_skus_async(request_type=dict) - - -def test_list_transferable_skus_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListTransferableSkusRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_skus), - '__call__') as call: - call.return_value = service.ListTransferableSkusResponse() - client.list_transferable_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_transferable_skus_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListTransferableSkusRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_skus), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListTransferableSkusResponse()) - await client.list_transferable_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_transferable_skus_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_skus), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - entitlements.TransferableSku(), - entitlements.TransferableSku(), - ], - next_page_token='abc', - ), - service.ListTransferableSkusResponse( - transferable_skus=[], - next_page_token='def', - ), - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - ], - next_page_token='ghi', - ), - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - entitlements.TransferableSku(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_transferable_skus(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, entitlements.TransferableSku) - for i in results) -def test_list_transferable_skus_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_skus), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - entitlements.TransferableSku(), - entitlements.TransferableSku(), - ], - next_page_token='abc', - ), - service.ListTransferableSkusResponse( - transferable_skus=[], - next_page_token='def', - ), - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - ], - next_page_token='ghi', - ), - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - entitlements.TransferableSku(), - ], - ), - RuntimeError, - ) - pages = list(client.list_transferable_skus(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_transferable_skus_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_skus), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - entitlements.TransferableSku(), - entitlements.TransferableSku(), - ], - next_page_token='abc', - ), - service.ListTransferableSkusResponse( - transferable_skus=[], - next_page_token='def', - ), - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - ], - next_page_token='ghi', - ), - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - entitlements.TransferableSku(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_transferable_skus(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, entitlements.TransferableSku) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_transferable_skus_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_skus), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - entitlements.TransferableSku(), - entitlements.TransferableSku(), - ], - next_page_token='abc', - ), - service.ListTransferableSkusResponse( - transferable_skus=[], - next_page_token='def', - ), - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - ], - next_page_token='ghi', - ), - service.ListTransferableSkusResponse( - transferable_skus=[ - entitlements.TransferableSku(), - entitlements.TransferableSku(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_transferable_skus(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.ListTransferableOffersRequest, - dict, -]) -def test_list_transferable_offers(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_offers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListTransferableOffersResponse( - next_page_token='next_page_token_value', - ) - response = client.list_transferable_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTransferableOffersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListTransferableOffersPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_transferable_offers_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_offers), - '__call__') as call: - client.list_transferable_offers() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTransferableOffersRequest() - -@pytest.mark.asyncio -async def test_list_transferable_offers_async(transport: str = 'grpc_asyncio', request_type=service.ListTransferableOffersRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_offers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListTransferableOffersResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_transferable_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTransferableOffersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListTransferableOffersAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_transferable_offers_async_from_dict(): - await test_list_transferable_offers_async(request_type=dict) - - -def test_list_transferable_offers_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListTransferableOffersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_offers), - '__call__') as call: - call.return_value = service.ListTransferableOffersResponse() - client.list_transferable_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_transferable_offers_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListTransferableOffersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_offers), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListTransferableOffersResponse()) - await client.list_transferable_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_transferable_offers_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_offers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - service.TransferableOffer(), - service.TransferableOffer(), - ], - next_page_token='abc', - ), - service.ListTransferableOffersResponse( - transferable_offers=[], - next_page_token='def', - ), - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - ], - next_page_token='ghi', - ), - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - service.TransferableOffer(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_transferable_offers(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, service.TransferableOffer) - for i in results) -def test_list_transferable_offers_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_offers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - service.TransferableOffer(), - service.TransferableOffer(), - ], - next_page_token='abc', - ), - service.ListTransferableOffersResponse( - transferable_offers=[], - next_page_token='def', - ), - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - ], - next_page_token='ghi', - ), - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - service.TransferableOffer(), - ], - ), - RuntimeError, - ) - pages = list(client.list_transferable_offers(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_transferable_offers_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_offers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - service.TransferableOffer(), - service.TransferableOffer(), - ], - next_page_token='abc', - ), - service.ListTransferableOffersResponse( - transferable_offers=[], - next_page_token='def', - ), - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - ], - next_page_token='ghi', - ), - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - service.TransferableOffer(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_transferable_offers(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, service.TransferableOffer) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_transferable_offers_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_transferable_offers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - service.TransferableOffer(), - service.TransferableOffer(), - ], - next_page_token='abc', - ), - service.ListTransferableOffersResponse( - transferable_offers=[], - next_page_token='def', - ), - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - ], - next_page_token='ghi', - ), - service.ListTransferableOffersResponse( - transferable_offers=[ - service.TransferableOffer(), - service.TransferableOffer(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_transferable_offers(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.GetEntitlementRequest, - dict, -]) -def test_get_entitlement(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = entitlements.Entitlement( - name='name_value', - offer='offer_value', - provisioning_state=entitlements.Entitlement.ProvisioningState.ACTIVE, - suspension_reasons=[entitlements.Entitlement.SuspensionReason.RESELLER_INITIATED], - purchase_order_id='purchase_order_id_value', - ) - response = client.get_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, entitlements.Entitlement) - assert response.name == 'name_value' - assert response.offer == 'offer_value' - assert response.provisioning_state == entitlements.Entitlement.ProvisioningState.ACTIVE - assert response.suspension_reasons == [entitlements.Entitlement.SuspensionReason.RESELLER_INITIATED] - assert response.purchase_order_id == 'purchase_order_id_value' - - -def test_get_entitlement_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_entitlement), - '__call__') as call: - client.get_entitlement() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetEntitlementRequest() - -@pytest.mark.asyncio -async def test_get_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.GetEntitlementRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(entitlements.Entitlement( - name='name_value', - offer='offer_value', - provisioning_state=entitlements.Entitlement.ProvisioningState.ACTIVE, - suspension_reasons=[entitlements.Entitlement.SuspensionReason.RESELLER_INITIATED], - purchase_order_id='purchase_order_id_value', - )) - response = await client.get_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, entitlements.Entitlement) - assert response.name == 'name_value' - assert response.offer == 'offer_value' - assert response.provisioning_state == entitlements.Entitlement.ProvisioningState.ACTIVE - assert response.suspension_reasons == [entitlements.Entitlement.SuspensionReason.RESELLER_INITIATED] - assert response.purchase_order_id == 'purchase_order_id_value' - - -@pytest.mark.asyncio -async def test_get_entitlement_async_from_dict(): - await test_get_entitlement_async(request_type=dict) - - -def test_get_entitlement_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetEntitlementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_entitlement), - '__call__') as call: - call.return_value = entitlements.Entitlement() - client.get_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_entitlement_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetEntitlementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_entitlement), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(entitlements.Entitlement()) - await client.get_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.CreateEntitlementRequest, - dict, -]) -def test_create_entitlement(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.create_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_create_entitlement_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_entitlement), - '__call__') as call: - client.create_entitlement() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateEntitlementRequest() - -@pytest.mark.asyncio -async def test_create_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.CreateEntitlementRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.create_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_entitlement_async_from_dict(): - await test_create_entitlement_async(request_type=dict) - - -def test_create_entitlement_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateEntitlementRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_entitlement), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.create_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_entitlement_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateEntitlementRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_entitlement), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.create_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.ChangeParametersRequest, - dict, -]) -def test_change_parameters(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_parameters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.change_parameters(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeParametersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_change_parameters_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_parameters), - '__call__') as call: - client.change_parameters() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeParametersRequest() - -@pytest.mark.asyncio -async def test_change_parameters_async(transport: str = 'grpc_asyncio', request_type=service.ChangeParametersRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_parameters), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.change_parameters(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeParametersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_change_parameters_async_from_dict(): - await test_change_parameters_async(request_type=dict) - - -def test_change_parameters_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ChangeParametersRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_parameters), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.change_parameters(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_change_parameters_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ChangeParametersRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_parameters), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.change_parameters(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.ChangeRenewalSettingsRequest, - dict, -]) -def test_change_renewal_settings(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_renewal_settings), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.change_renewal_settings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeRenewalSettingsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_change_renewal_settings_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_renewal_settings), - '__call__') as call: - client.change_renewal_settings() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeRenewalSettingsRequest() - -@pytest.mark.asyncio -async def test_change_renewal_settings_async(transport: str = 'grpc_asyncio', request_type=service.ChangeRenewalSettingsRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_renewal_settings), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.change_renewal_settings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeRenewalSettingsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_change_renewal_settings_async_from_dict(): - await test_change_renewal_settings_async(request_type=dict) - - -def test_change_renewal_settings_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ChangeRenewalSettingsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_renewal_settings), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.change_renewal_settings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_change_renewal_settings_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ChangeRenewalSettingsRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_renewal_settings), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.change_renewal_settings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.ChangeOfferRequest, - dict, -]) -def test_change_offer(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_offer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.change_offer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeOfferRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_change_offer_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_offer), - '__call__') as call: - client.change_offer() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeOfferRequest() - -@pytest.mark.asyncio -async def test_change_offer_async(transport: str = 'grpc_asyncio', request_type=service.ChangeOfferRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_offer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.change_offer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeOfferRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_change_offer_async_from_dict(): - await test_change_offer_async(request_type=dict) - - -def test_change_offer_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ChangeOfferRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_offer), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.change_offer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_change_offer_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ChangeOfferRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.change_offer), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.change_offer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.StartPaidServiceRequest, - dict, -]) -def test_start_paid_service(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_paid_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.start_paid_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.StartPaidServiceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_start_paid_service_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_paid_service), - '__call__') as call: - client.start_paid_service() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.StartPaidServiceRequest() - -@pytest.mark.asyncio -async def test_start_paid_service_async(transport: str = 'grpc_asyncio', request_type=service.StartPaidServiceRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_paid_service), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.start_paid_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.StartPaidServiceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_start_paid_service_async_from_dict(): - await test_start_paid_service_async(request_type=dict) - - -def test_start_paid_service_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.StartPaidServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_paid_service), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.start_paid_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_start_paid_service_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.StartPaidServiceRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.start_paid_service), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.start_paid_service(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.SuspendEntitlementRequest, - dict, -]) -def test_suspend_entitlement(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.suspend_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.suspend_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.SuspendEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_suspend_entitlement_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.suspend_entitlement), - '__call__') as call: - client.suspend_entitlement() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.SuspendEntitlementRequest() - -@pytest.mark.asyncio -async def test_suspend_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.SuspendEntitlementRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.suspend_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.suspend_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.SuspendEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_suspend_entitlement_async_from_dict(): - await test_suspend_entitlement_async(request_type=dict) - - -def test_suspend_entitlement_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.SuspendEntitlementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.suspend_entitlement), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.suspend_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_suspend_entitlement_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.SuspendEntitlementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.suspend_entitlement), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.suspend_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.CancelEntitlementRequest, - dict, -]) -def test_cancel_entitlement(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.cancel_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.CancelEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_cancel_entitlement_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_entitlement), - '__call__') as call: - client.cancel_entitlement() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CancelEntitlementRequest() - -@pytest.mark.asyncio -async def test_cancel_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.CancelEntitlementRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.cancel_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.CancelEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_cancel_entitlement_async_from_dict(): - await test_cancel_entitlement_async(request_type=dict) - - -def test_cancel_entitlement_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CancelEntitlementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_entitlement), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.cancel_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_cancel_entitlement_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CancelEntitlementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.cancel_entitlement), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.cancel_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.ActivateEntitlementRequest, - dict, -]) -def test_activate_entitlement(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.activate_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_activate_entitlement_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_entitlement), - '__call__') as call: - client.activate_entitlement() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateEntitlementRequest() - -@pytest.mark.asyncio -async def test_activate_entitlement_async(transport: str = 'grpc_asyncio', request_type=service.ActivateEntitlementRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_entitlement), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.activate_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateEntitlementRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_activate_entitlement_async_from_dict(): - await test_activate_entitlement_async(request_type=dict) - - -def test_activate_entitlement_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ActivateEntitlementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_entitlement), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.activate_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_activate_entitlement_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ActivateEntitlementRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_entitlement), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.activate_entitlement(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.TransferEntitlementsRequest, - dict, -]) -def test_transfer_entitlements(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.transfer_entitlements(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.TransferEntitlementsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_transfer_entitlements_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements), - '__call__') as call: - client.transfer_entitlements() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.TransferEntitlementsRequest() - -@pytest.mark.asyncio -async def test_transfer_entitlements_async(transport: str = 'grpc_asyncio', request_type=service.TransferEntitlementsRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.transfer_entitlements(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.TransferEntitlementsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_transfer_entitlements_async_from_dict(): - await test_transfer_entitlements_async(request_type=dict) - - -def test_transfer_entitlements_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.TransferEntitlementsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.transfer_entitlements(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_transfer_entitlements_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.TransferEntitlementsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.transfer_entitlements(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.TransferEntitlementsToGoogleRequest, - dict, -]) -def test_transfer_entitlements_to_google(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements_to_google), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') - response = client.transfer_entitlements_to_google(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.TransferEntitlementsToGoogleRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -def test_transfer_entitlements_to_google_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements_to_google), - '__call__') as call: - client.transfer_entitlements_to_google() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.TransferEntitlementsToGoogleRequest() - -@pytest.mark.asyncio -async def test_transfer_entitlements_to_google_async(transport: str = 'grpc_asyncio', request_type=service.TransferEntitlementsToGoogleRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements_to_google), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - response = await client.transfer_entitlements_to_google(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.TransferEntitlementsToGoogleRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_transfer_entitlements_to_google_async_from_dict(): - await test_transfer_entitlements_to_google_async(request_type=dict) - - -def test_transfer_entitlements_to_google_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.TransferEntitlementsToGoogleRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements_to_google), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') - client.transfer_entitlements_to_google(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_transfer_entitlements_to_google_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.TransferEntitlementsToGoogleRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.transfer_entitlements_to_google), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) - await client.transfer_entitlements_to_google(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.ListChannelPartnerLinksRequest, - dict, -]) -def test_list_channel_partner_links(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_links), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListChannelPartnerLinksResponse( - next_page_token='next_page_token_value', - ) - response = client.list_channel_partner_links(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListChannelPartnerLinksRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListChannelPartnerLinksPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_channel_partner_links_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_links), - '__call__') as call: - client.list_channel_partner_links() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListChannelPartnerLinksRequest() - -@pytest.mark.asyncio -async def test_list_channel_partner_links_async(transport: str = 'grpc_asyncio', request_type=service.ListChannelPartnerLinksRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_links), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerLinksResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_channel_partner_links(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListChannelPartnerLinksRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListChannelPartnerLinksAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_channel_partner_links_async_from_dict(): - await test_list_channel_partner_links_async(request_type=dict) - - -def test_list_channel_partner_links_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListChannelPartnerLinksRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_links), - '__call__') as call: - call.return_value = service.ListChannelPartnerLinksResponse() - client.list_channel_partner_links(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_channel_partner_links_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListChannelPartnerLinksRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_links), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerLinksResponse()) - await client.list_channel_partner_links(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_channel_partner_links_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_links), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - ], - next_page_token='abc', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[], - next_page_token='def', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - ], - next_page_token='ghi', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_channel_partner_links(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, channel_partner_links.ChannelPartnerLink) - for i in results) -def test_list_channel_partner_links_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_links), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - ], - next_page_token='abc', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[], - next_page_token='def', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - ], - next_page_token='ghi', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - ], - ), - RuntimeError, - ) - pages = list(client.list_channel_partner_links(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_channel_partner_links_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_links), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - ], - next_page_token='abc', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[], - next_page_token='def', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - ], - next_page_token='ghi', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_channel_partner_links(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, channel_partner_links.ChannelPartnerLink) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_channel_partner_links_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_links), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - ], - next_page_token='abc', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[], - next_page_token='def', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - ], - next_page_token='ghi', - ), - service.ListChannelPartnerLinksResponse( - channel_partner_links=[ - channel_partner_links.ChannelPartnerLink(), - channel_partner_links.ChannelPartnerLink(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_channel_partner_links(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.GetChannelPartnerLinkRequest, - dict, -]) -def test_get_channel_partner_link(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_link), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = channel_partner_links.ChannelPartnerLink( - name='name_value', - reseller_cloud_identity_id='reseller_cloud_identity_id_value', - link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, - invite_link_uri='invite_link_uri_value', - public_id='public_id_value', - ) - response = client.get_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetChannelPartnerLinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, channel_partner_links.ChannelPartnerLink) - assert response.name == 'name_value' - assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' - assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED - assert response.invite_link_uri == 'invite_link_uri_value' - assert response.public_id == 'public_id_value' - - -def test_get_channel_partner_link_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_link), - '__call__') as call: - client.get_channel_partner_link() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetChannelPartnerLinkRequest() - -@pytest.mark.asyncio -async def test_get_channel_partner_link_async(transport: str = 'grpc_asyncio', request_type=service.GetChannelPartnerLinkRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_link), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink( - name='name_value', - reseller_cloud_identity_id='reseller_cloud_identity_id_value', - link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, - invite_link_uri='invite_link_uri_value', - public_id='public_id_value', - )) - response = await client.get_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetChannelPartnerLinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, channel_partner_links.ChannelPartnerLink) - assert response.name == 'name_value' - assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' - assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED - assert response.invite_link_uri == 'invite_link_uri_value' - assert response.public_id == 'public_id_value' - - -@pytest.mark.asyncio -async def test_get_channel_partner_link_async_from_dict(): - await test_get_channel_partner_link_async(request_type=dict) - - -def test_get_channel_partner_link_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetChannelPartnerLinkRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_link), - '__call__') as call: - call.return_value = channel_partner_links.ChannelPartnerLink() - client.get_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_channel_partner_link_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetChannelPartnerLinkRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_link), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink()) - await client.get_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.CreateChannelPartnerLinkRequest, - dict, -]) -def test_create_channel_partner_link(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_link), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = channel_partner_links.ChannelPartnerLink( - name='name_value', - reseller_cloud_identity_id='reseller_cloud_identity_id_value', - link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, - invite_link_uri='invite_link_uri_value', - public_id='public_id_value', - ) - response = client.create_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateChannelPartnerLinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, channel_partner_links.ChannelPartnerLink) - assert response.name == 'name_value' - assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' - assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED - assert response.invite_link_uri == 'invite_link_uri_value' - assert response.public_id == 'public_id_value' - - -def test_create_channel_partner_link_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_link), - '__call__') as call: - client.create_channel_partner_link() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateChannelPartnerLinkRequest() - -@pytest.mark.asyncio -async def test_create_channel_partner_link_async(transport: str = 'grpc_asyncio', request_type=service.CreateChannelPartnerLinkRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_link), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink( - name='name_value', - reseller_cloud_identity_id='reseller_cloud_identity_id_value', - link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, - invite_link_uri='invite_link_uri_value', - public_id='public_id_value', - )) - response = await client.create_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateChannelPartnerLinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, channel_partner_links.ChannelPartnerLink) - assert response.name == 'name_value' - assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' - assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED - assert response.invite_link_uri == 'invite_link_uri_value' - assert response.public_id == 'public_id_value' - - -@pytest.mark.asyncio -async def test_create_channel_partner_link_async_from_dict(): - await test_create_channel_partner_link_async(request_type=dict) - - -def test_create_channel_partner_link_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateChannelPartnerLinkRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_link), - '__call__') as call: - call.return_value = channel_partner_links.ChannelPartnerLink() - client.create_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_channel_partner_link_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateChannelPartnerLinkRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_link), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink()) - await client.create_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.UpdateChannelPartnerLinkRequest, - dict, -]) -def test_update_channel_partner_link(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_link), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = channel_partner_links.ChannelPartnerLink( - name='name_value', - reseller_cloud_identity_id='reseller_cloud_identity_id_value', - link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, - invite_link_uri='invite_link_uri_value', - public_id='public_id_value', - ) - response = client.update_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateChannelPartnerLinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, channel_partner_links.ChannelPartnerLink) - assert response.name == 'name_value' - assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' - assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED - assert response.invite_link_uri == 'invite_link_uri_value' - assert response.public_id == 'public_id_value' - - -def test_update_channel_partner_link_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_link), - '__call__') as call: - client.update_channel_partner_link() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateChannelPartnerLinkRequest() - -@pytest.mark.asyncio -async def test_update_channel_partner_link_async(transport: str = 'grpc_asyncio', request_type=service.UpdateChannelPartnerLinkRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_link), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink( - name='name_value', - reseller_cloud_identity_id='reseller_cloud_identity_id_value', - link_state=channel_partner_links.ChannelPartnerLinkState.INVITED, - invite_link_uri='invite_link_uri_value', - public_id='public_id_value', - )) - response = await client.update_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateChannelPartnerLinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, channel_partner_links.ChannelPartnerLink) - assert response.name == 'name_value' - assert response.reseller_cloud_identity_id == 'reseller_cloud_identity_id_value' - assert response.link_state == channel_partner_links.ChannelPartnerLinkState.INVITED - assert response.invite_link_uri == 'invite_link_uri_value' - assert response.public_id == 'public_id_value' - - -@pytest.mark.asyncio -async def test_update_channel_partner_link_async_from_dict(): - await test_update_channel_partner_link_async(request_type=dict) - - -def test_update_channel_partner_link_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UpdateChannelPartnerLinkRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_link), - '__call__') as call: - call.return_value = channel_partner_links.ChannelPartnerLink() - client.update_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_channel_partner_link_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UpdateChannelPartnerLinkRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_link), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(channel_partner_links.ChannelPartnerLink()) - await client.update_channel_partner_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.GetCustomerRepricingConfigRequest, - dict, -]) -def test_get_customer_repricing_config(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.CustomerRepricingConfig( - name='name_value', - ) - response = client.get_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCustomerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.CustomerRepricingConfig) - assert response.name == 'name_value' - - -def test_get_customer_repricing_config_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer_repricing_config), - '__call__') as call: - client.get_customer_repricing_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCustomerRepricingConfigRequest() - -@pytest.mark.asyncio -async def test_get_customer_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.GetCustomerRepricingConfigRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig( - name='name_value', - )) - response = await client.get_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCustomerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.CustomerRepricingConfig) - assert response.name == 'name_value' - - -@pytest.mark.asyncio -async def test_get_customer_repricing_config_async_from_dict(): - await test_get_customer_repricing_config_async(request_type=dict) - - -def test_get_customer_repricing_config_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetCustomerRepricingConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer_repricing_config), - '__call__') as call: - call.return_value = repricing.CustomerRepricingConfig() - client.get_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_customer_repricing_config_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetCustomerRepricingConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer_repricing_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) - await client.get_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_customer_repricing_config_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.CustomerRepricingConfig() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_customer_repricing_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_customer_repricing_config_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_customer_repricing_config( - service.GetCustomerRepricingConfigRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_customer_repricing_config_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.CustomerRepricingConfig() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_customer_repricing_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_customer_repricing_config_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_customer_repricing_config( - service.GetCustomerRepricingConfigRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCustomerRepricingConfigsRequest, - dict, -]) -def test_list_customer_repricing_configs(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCustomerRepricingConfigsResponse( - next_page_token='next_page_token_value', - ) - response = client.list_customer_repricing_configs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCustomerRepricingConfigsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomerRepricingConfigsPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_customer_repricing_configs_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__') as call: - client.list_customer_repricing_configs() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCustomerRepricingConfigsRequest() - -@pytest.mark.asyncio -async def test_list_customer_repricing_configs_async(transport: str = 'grpc_asyncio', request_type=service.ListCustomerRepricingConfigsRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomerRepricingConfigsResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_customer_repricing_configs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCustomerRepricingConfigsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomerRepricingConfigsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_customer_repricing_configs_async_from_dict(): - await test_list_customer_repricing_configs_async(request_type=dict) - - -def test_list_customer_repricing_configs_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListCustomerRepricingConfigsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__') as call: - call.return_value = service.ListCustomerRepricingConfigsResponse() - client.list_customer_repricing_configs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_customer_repricing_configs_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListCustomerRepricingConfigsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomerRepricingConfigsResponse()) - await client.list_customer_repricing_configs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_customer_repricing_configs_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCustomerRepricingConfigsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_customer_repricing_configs( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_customer_repricing_configs_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_customer_repricing_configs( - service.ListCustomerRepricingConfigsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_customer_repricing_configs_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCustomerRepricingConfigsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCustomerRepricingConfigsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_customer_repricing_configs( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_customer_repricing_configs_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_customer_repricing_configs( - service.ListCustomerRepricingConfigsRequest(), - parent='parent_value', - ) - - -def test_list_customer_repricing_configs_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - ], - next_page_token='abc', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[], - next_page_token='def', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - ], - next_page_token='ghi', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_customer_repricing_configs(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, repricing.CustomerRepricingConfig) - for i in results) -def test_list_customer_repricing_configs_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - ], - next_page_token='abc', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[], - next_page_token='def', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - ], - next_page_token='ghi', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - ], - ), - RuntimeError, - ) - pages = list(client.list_customer_repricing_configs(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_customer_repricing_configs_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - ], - next_page_token='abc', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[], - next_page_token='def', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - ], - next_page_token='ghi', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_customer_repricing_configs(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, repricing.CustomerRepricingConfig) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_customer_repricing_configs_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_customer_repricing_configs), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - ], - next_page_token='abc', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[], - next_page_token='def', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - ], - next_page_token='ghi', - ), - service.ListCustomerRepricingConfigsResponse( - customer_repricing_configs=[ - repricing.CustomerRepricingConfig(), - repricing.CustomerRepricingConfig(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_customer_repricing_configs(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.CreateCustomerRepricingConfigRequest, - dict, -]) -def test_create_customer_repricing_config(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.CustomerRepricingConfig( - name='name_value', - ) - response = client.create_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCustomerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.CustomerRepricingConfig) - assert response.name == 'name_value' - - -def test_create_customer_repricing_config_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer_repricing_config), - '__call__') as call: - client.create_customer_repricing_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCustomerRepricingConfigRequest() - -@pytest.mark.asyncio -async def test_create_customer_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.CreateCustomerRepricingConfigRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig( - name='name_value', - )) - response = await client.create_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCustomerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.CustomerRepricingConfig) - assert response.name == 'name_value' - - -@pytest.mark.asyncio -async def test_create_customer_repricing_config_async_from_dict(): - await test_create_customer_repricing_config_async(request_type=dict) - - -def test_create_customer_repricing_config_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateCustomerRepricingConfigRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer_repricing_config), - '__call__') as call: - call.return_value = repricing.CustomerRepricingConfig() - client.create_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_customer_repricing_config_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateCustomerRepricingConfigRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer_repricing_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) - await client.create_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_customer_repricing_config_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.CustomerRepricingConfig() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_customer_repricing_config( - parent='parent_value', - customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].customer_repricing_config - mock_val = repricing.CustomerRepricingConfig(name='name_value') - assert arg == mock_val - - -def test_create_customer_repricing_config_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_customer_repricing_config( - service.CreateCustomerRepricingConfigRequest(), - parent='parent_value', - customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), - ) - -@pytest.mark.asyncio -async def test_create_customer_repricing_config_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.CustomerRepricingConfig() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_customer_repricing_config( - parent='parent_value', - customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].customer_repricing_config - mock_val = repricing.CustomerRepricingConfig(name='name_value') - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_customer_repricing_config_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_customer_repricing_config( - service.CreateCustomerRepricingConfigRequest(), - parent='parent_value', - customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), - ) - - -@pytest.mark.parametrize("request_type", [ - service.UpdateCustomerRepricingConfigRequest, - dict, -]) -def test_update_customer_repricing_config(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.CustomerRepricingConfig( - name='name_value', - ) - response = client.update_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCustomerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.CustomerRepricingConfig) - assert response.name == 'name_value' - - -def test_update_customer_repricing_config_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer_repricing_config), - '__call__') as call: - client.update_customer_repricing_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCustomerRepricingConfigRequest() - -@pytest.mark.asyncio -async def test_update_customer_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCustomerRepricingConfigRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig( - name='name_value', - )) - response = await client.update_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCustomerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.CustomerRepricingConfig) - assert response.name == 'name_value' - - -@pytest.mark.asyncio -async def test_update_customer_repricing_config_async_from_dict(): - await test_update_customer_repricing_config_async(request_type=dict) - - -def test_update_customer_repricing_config_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UpdateCustomerRepricingConfigRequest() - - request.customer_repricing_config.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer_repricing_config), - '__call__') as call: - call.return_value = repricing.CustomerRepricingConfig() - client.update_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer_repricing_config.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_customer_repricing_config_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UpdateCustomerRepricingConfigRequest() - - request.customer_repricing_config.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer_repricing_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) - await client.update_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer_repricing_config.name=name_value', - ) in kw['metadata'] - - -def test_update_customer_repricing_config_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.CustomerRepricingConfig() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_customer_repricing_config( - customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].customer_repricing_config - mock_val = repricing.CustomerRepricingConfig(name='name_value') - assert arg == mock_val - - -def test_update_customer_repricing_config_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_customer_repricing_config( - service.UpdateCustomerRepricingConfigRequest(), - customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), - ) - -@pytest.mark.asyncio -async def test_update_customer_repricing_config_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.CustomerRepricingConfig() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.CustomerRepricingConfig()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_customer_repricing_config( - customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].customer_repricing_config - mock_val = repricing.CustomerRepricingConfig(name='name_value') - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_customer_repricing_config_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_customer_repricing_config( - service.UpdateCustomerRepricingConfigRequest(), - customer_repricing_config=repricing.CustomerRepricingConfig(name='name_value'), - ) - - -@pytest.mark.parametrize("request_type", [ - service.DeleteCustomerRepricingConfigRequest, - dict, -]) -def test_delete_customer_repricing_config(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCustomerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -def test_delete_customer_repricing_config_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer_repricing_config), - '__call__') as call: - client.delete_customer_repricing_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCustomerRepricingConfigRequest() - -@pytest.mark.asyncio -async def test_delete_customer_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCustomerRepricingConfigRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCustomerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_delete_customer_repricing_config_async_from_dict(): - await test_delete_customer_repricing_config_async(request_type=dict) - - -def test_delete_customer_repricing_config_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.DeleteCustomerRepricingConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer_repricing_config), - '__call__') as call: - call.return_value = None - client.delete_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_delete_customer_repricing_config_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.DeleteCustomerRepricingConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer_repricing_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_customer_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_customer_repricing_config_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_customer_repricing_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_customer_repricing_config_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_customer_repricing_config( - service.DeleteCustomerRepricingConfigRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_customer_repricing_config_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_customer_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_customer_repricing_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_customer_repricing_config_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_customer_repricing_config( - service.DeleteCustomerRepricingConfigRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetChannelPartnerRepricingConfigRequest, - dict, -]) -def test_get_channel_partner_repricing_config(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.ChannelPartnerRepricingConfig( - name='name_value', - ) - response = client.get_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetChannelPartnerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.ChannelPartnerRepricingConfig) - assert response.name == 'name_value' - - -def test_get_channel_partner_repricing_config_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_repricing_config), - '__call__') as call: - client.get_channel_partner_repricing_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetChannelPartnerRepricingConfigRequest() - -@pytest.mark.asyncio -async def test_get_channel_partner_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.GetChannelPartnerRepricingConfigRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig( - name='name_value', - )) - response = await client.get_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetChannelPartnerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.ChannelPartnerRepricingConfig) - assert response.name == 'name_value' - - -@pytest.mark.asyncio -async def test_get_channel_partner_repricing_config_async_from_dict(): - await test_get_channel_partner_repricing_config_async(request_type=dict) - - -def test_get_channel_partner_repricing_config_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetChannelPartnerRepricingConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_repricing_config), - '__call__') as call: - call.return_value = repricing.ChannelPartnerRepricingConfig() - client.get_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_channel_partner_repricing_config_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.GetChannelPartnerRepricingConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_repricing_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) - await client.get_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_channel_partner_repricing_config_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.ChannelPartnerRepricingConfig() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_channel_partner_repricing_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_channel_partner_repricing_config_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_channel_partner_repricing_config( - service.GetChannelPartnerRepricingConfigRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_channel_partner_repricing_config_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.ChannelPartnerRepricingConfig() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_channel_partner_repricing_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_channel_partner_repricing_config_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_channel_partner_repricing_config( - service.GetChannelPartnerRepricingConfigRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListChannelPartnerRepricingConfigsRequest, - dict, -]) -def test_list_channel_partner_repricing_configs(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListChannelPartnerRepricingConfigsResponse( - next_page_token='next_page_token_value', - ) - response = client.list_channel_partner_repricing_configs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListChannelPartnerRepricingConfigsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListChannelPartnerRepricingConfigsPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_channel_partner_repricing_configs_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__') as call: - client.list_channel_partner_repricing_configs() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListChannelPartnerRepricingConfigsRequest() - -@pytest.mark.asyncio -async def test_list_channel_partner_repricing_configs_async(transport: str = 'grpc_asyncio', request_type=service.ListChannelPartnerRepricingConfigsRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerRepricingConfigsResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_channel_partner_repricing_configs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListChannelPartnerRepricingConfigsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListChannelPartnerRepricingConfigsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_channel_partner_repricing_configs_async_from_dict(): - await test_list_channel_partner_repricing_configs_async(request_type=dict) - - -def test_list_channel_partner_repricing_configs_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListChannelPartnerRepricingConfigsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__') as call: - call.return_value = service.ListChannelPartnerRepricingConfigsResponse() - client.list_channel_partner_repricing_configs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_channel_partner_repricing_configs_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListChannelPartnerRepricingConfigsRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerRepricingConfigsResponse()) - await client.list_channel_partner_repricing_configs(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_channel_partner_repricing_configs_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListChannelPartnerRepricingConfigsResponse() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_channel_partner_repricing_configs( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_channel_partner_repricing_configs_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_channel_partner_repricing_configs( - service.ListChannelPartnerRepricingConfigsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_channel_partner_repricing_configs_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListChannelPartnerRepricingConfigsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListChannelPartnerRepricingConfigsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_channel_partner_repricing_configs( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_channel_partner_repricing_configs_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_channel_partner_repricing_configs( - service.ListChannelPartnerRepricingConfigsRequest(), - parent='parent_value', - ) - - -def test_list_channel_partner_repricing_configs_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - ], - next_page_token='abc', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[], - next_page_token='def', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - ], - next_page_token='ghi', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_channel_partner_repricing_configs(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, repricing.ChannelPartnerRepricingConfig) - for i in results) -def test_list_channel_partner_repricing_configs_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - ], - next_page_token='abc', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[], - next_page_token='def', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - ], - next_page_token='ghi', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - ], - ), - RuntimeError, - ) - pages = list(client.list_channel_partner_repricing_configs(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_channel_partner_repricing_configs_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - ], - next_page_token='abc', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[], - next_page_token='def', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - ], - next_page_token='ghi', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_channel_partner_repricing_configs(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, repricing.ChannelPartnerRepricingConfig) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_channel_partner_repricing_configs_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_partner_repricing_configs), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - ], - next_page_token='abc', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[], - next_page_token='def', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - ], - next_page_token='ghi', - ), - service.ListChannelPartnerRepricingConfigsResponse( - channel_partner_repricing_configs=[ - repricing.ChannelPartnerRepricingConfig(), - repricing.ChannelPartnerRepricingConfig(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_channel_partner_repricing_configs(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.CreateChannelPartnerRepricingConfigRequest, - dict, -]) -def test_create_channel_partner_repricing_config(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.ChannelPartnerRepricingConfig( - name='name_value', - ) - response = client.create_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateChannelPartnerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.ChannelPartnerRepricingConfig) - assert response.name == 'name_value' - - -def test_create_channel_partner_repricing_config_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_repricing_config), - '__call__') as call: - client.create_channel_partner_repricing_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateChannelPartnerRepricingConfigRequest() - -@pytest.mark.asyncio -async def test_create_channel_partner_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.CreateChannelPartnerRepricingConfigRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig( - name='name_value', - )) - response = await client.create_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateChannelPartnerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.ChannelPartnerRepricingConfig) - assert response.name == 'name_value' - - -@pytest.mark.asyncio -async def test_create_channel_partner_repricing_config_async_from_dict(): - await test_create_channel_partner_repricing_config_async(request_type=dict) - - -def test_create_channel_partner_repricing_config_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateChannelPartnerRepricingConfigRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_repricing_config), - '__call__') as call: - call.return_value = repricing.ChannelPartnerRepricingConfig() - client.create_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_channel_partner_repricing_config_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.CreateChannelPartnerRepricingConfigRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_repricing_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) - await client.create_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_channel_partner_repricing_config_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.ChannelPartnerRepricingConfig() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_channel_partner_repricing_config( - parent='parent_value', - channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].channel_partner_repricing_config - mock_val = repricing.ChannelPartnerRepricingConfig(name='name_value') - assert arg == mock_val - - -def test_create_channel_partner_repricing_config_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_channel_partner_repricing_config( - service.CreateChannelPartnerRepricingConfigRequest(), - parent='parent_value', - channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), - ) - -@pytest.mark.asyncio -async def test_create_channel_partner_repricing_config_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.ChannelPartnerRepricingConfig() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_channel_partner_repricing_config( - parent='parent_value', - channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].channel_partner_repricing_config - mock_val = repricing.ChannelPartnerRepricingConfig(name='name_value') - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_channel_partner_repricing_config_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_channel_partner_repricing_config( - service.CreateChannelPartnerRepricingConfigRequest(), - parent='parent_value', - channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), - ) - - -@pytest.mark.parametrize("request_type", [ - service.UpdateChannelPartnerRepricingConfigRequest, - dict, -]) -def test_update_channel_partner_repricing_config(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.ChannelPartnerRepricingConfig( - name='name_value', - ) - response = client.update_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateChannelPartnerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.ChannelPartnerRepricingConfig) - assert response.name == 'name_value' - - -def test_update_channel_partner_repricing_config_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_repricing_config), - '__call__') as call: - client.update_channel_partner_repricing_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateChannelPartnerRepricingConfigRequest() - -@pytest.mark.asyncio -async def test_update_channel_partner_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.UpdateChannelPartnerRepricingConfigRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig( - name='name_value', - )) - response = await client.update_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateChannelPartnerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, repricing.ChannelPartnerRepricingConfig) - assert response.name == 'name_value' - - -@pytest.mark.asyncio -async def test_update_channel_partner_repricing_config_async_from_dict(): - await test_update_channel_partner_repricing_config_async(request_type=dict) - - -def test_update_channel_partner_repricing_config_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UpdateChannelPartnerRepricingConfigRequest() - - request.channel_partner_repricing_config.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_repricing_config), - '__call__') as call: - call.return_value = repricing.ChannelPartnerRepricingConfig() - client.update_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'channel_partner_repricing_config.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_channel_partner_repricing_config_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UpdateChannelPartnerRepricingConfigRequest() - - request.channel_partner_repricing_config.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_repricing_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) - await client.update_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'channel_partner_repricing_config.name=name_value', - ) in kw['metadata'] - - -def test_update_channel_partner_repricing_config_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.ChannelPartnerRepricingConfig() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_channel_partner_repricing_config( - channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].channel_partner_repricing_config - mock_val = repricing.ChannelPartnerRepricingConfig(name='name_value') - assert arg == mock_val - - -def test_update_channel_partner_repricing_config_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_channel_partner_repricing_config( - service.UpdateChannelPartnerRepricingConfigRequest(), - channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), - ) - -@pytest.mark.asyncio -async def test_update_channel_partner_repricing_config_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = repricing.ChannelPartnerRepricingConfig() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(repricing.ChannelPartnerRepricingConfig()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_channel_partner_repricing_config( - channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].channel_partner_repricing_config - mock_val = repricing.ChannelPartnerRepricingConfig(name='name_value') - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_channel_partner_repricing_config_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_channel_partner_repricing_config( - service.UpdateChannelPartnerRepricingConfigRequest(), - channel_partner_repricing_config=repricing.ChannelPartnerRepricingConfig(name='name_value'), - ) - - -@pytest.mark.parametrize("request_type", [ - service.DeleteChannelPartnerRepricingConfigRequest, - dict, -]) -def test_delete_channel_partner_repricing_config(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteChannelPartnerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -def test_delete_channel_partner_repricing_config_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_channel_partner_repricing_config), - '__call__') as call: - client.delete_channel_partner_repricing_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteChannelPartnerRepricingConfigRequest() - -@pytest.mark.asyncio -async def test_delete_channel_partner_repricing_config_async(transport: str = 'grpc_asyncio', request_type=service.DeleteChannelPartnerRepricingConfigRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteChannelPartnerRepricingConfigRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_delete_channel_partner_repricing_config_async_from_dict(): - await test_delete_channel_partner_repricing_config_async(request_type=dict) - - -def test_delete_channel_partner_repricing_config_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.DeleteChannelPartnerRepricingConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_channel_partner_repricing_config), - '__call__') as call: - call.return_value = None - client.delete_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_delete_channel_partner_repricing_config_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.DeleteChannelPartnerRepricingConfigRequest() - - request.name = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_channel_partner_repricing_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_channel_partner_repricing_config(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_channel_partner_repricing_config_flattened(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_channel_partner_repricing_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_channel_partner_repricing_config_flattened_error(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_channel_partner_repricing_config( - service.DeleteChannelPartnerRepricingConfigRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_channel_partner_repricing_config_flattened_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_channel_partner_repricing_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = None - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_channel_partner_repricing_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_channel_partner_repricing_config_flattened_error_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_channel_partner_repricing_config( - service.DeleteChannelPartnerRepricingConfigRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.LookupOfferRequest, - dict, -]) -def test_lookup_offer(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_offer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = offers.Offer( - name='name_value', - ) - response = client.lookup_offer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.LookupOfferRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, offers.Offer) - assert response.name == 'name_value' - - -def test_lookup_offer_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_offer), - '__call__') as call: - client.lookup_offer() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.LookupOfferRequest() - -@pytest.mark.asyncio -async def test_lookup_offer_async(transport: str = 'grpc_asyncio', request_type=service.LookupOfferRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_offer), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(offers.Offer( - name='name_value', - )) - response = await client.lookup_offer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.LookupOfferRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, offers.Offer) - assert response.name == 'name_value' - - -@pytest.mark.asyncio -async def test_lookup_offer_async_from_dict(): - await test_lookup_offer_async(request_type=dict) - - -def test_lookup_offer_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.LookupOfferRequest() - - request.entitlement = 'entitlement_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_offer), - '__call__') as call: - call.return_value = offers.Offer() - client.lookup_offer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'entitlement=entitlement_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_lookup_offer_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.LookupOfferRequest() - - request.entitlement = 'entitlement_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.lookup_offer), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(offers.Offer()) - await client.lookup_offer(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'entitlement=entitlement_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.ListProductsRequest, - dict, -]) -def test_list_products(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_products), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListProductsResponse( - next_page_token='next_page_token_value', - ) - response = client.list_products(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListProductsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListProductsPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_products_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_products), - '__call__') as call: - client.list_products() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListProductsRequest() - -@pytest.mark.asyncio -async def test_list_products_async(transport: str = 'grpc_asyncio', request_type=service.ListProductsRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_products), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListProductsResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_products(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListProductsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListProductsAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - -def test_list_products_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_products), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListProductsResponse( - products=[ - products.Product(), - products.Product(), - products.Product(), - ], - next_page_token='abc', - ), - service.ListProductsResponse( - products=[], - next_page_token='def', - ), - service.ListProductsResponse( - products=[ - products.Product(), - ], - next_page_token='ghi', - ), - service.ListProductsResponse( - products=[ - products.Product(), - products.Product(), - ], - ), - RuntimeError, - ) - - metadata = () - pager = client.list_products(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, products.Product) - for i in results) -def test_list_products_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_products), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListProductsResponse( - products=[ - products.Product(), - products.Product(), - products.Product(), - ], - next_page_token='abc', - ), - service.ListProductsResponse( - products=[], - next_page_token='def', - ), - service.ListProductsResponse( - products=[ - products.Product(), - ], - next_page_token='ghi', - ), - service.ListProductsResponse( - products=[ - products.Product(), - products.Product(), - ], - ), - RuntimeError, - ) - pages = list(client.list_products(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_products_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_products), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListProductsResponse( - products=[ - products.Product(), - products.Product(), - products.Product(), - ], - next_page_token='abc', - ), - service.ListProductsResponse( - products=[], - next_page_token='def', - ), - service.ListProductsResponse( - products=[ - products.Product(), - ], - next_page_token='ghi', - ), - service.ListProductsResponse( - products=[ - products.Product(), - products.Product(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_products(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, products.Product) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_products_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_products), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListProductsResponse( - products=[ - products.Product(), - products.Product(), - products.Product(), - ], - next_page_token='abc', - ), - service.ListProductsResponse( - products=[], - next_page_token='def', - ), - service.ListProductsResponse( - products=[ - products.Product(), - ], - next_page_token='ghi', - ), - service.ListProductsResponse( - products=[ - products.Product(), - products.Product(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_products(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.ListSkusRequest, - dict, -]) -def test_list_skus(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_skus), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListSkusResponse( - next_page_token='next_page_token_value', - ) - response = client.list_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSkusRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSkusPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_skus_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_skus), - '__call__') as call: - client.list_skus() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSkusRequest() - -@pytest.mark.asyncio -async def test_list_skus_async(transport: str = 'grpc_asyncio', request_type=service.ListSkusRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_skus), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListSkusResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSkusRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSkusAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_skus_async_from_dict(): - await test_list_skus_async(request_type=dict) - - -def test_list_skus_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListSkusRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_skus), - '__call__') as call: - call.return_value = service.ListSkusResponse() - client.list_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_skus_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListSkusRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_skus), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListSkusResponse()) - await client.list_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_skus_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_skus), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListSkusResponse( - skus=[ - products.Sku(), - products.Sku(), - products.Sku(), - ], - next_page_token='abc', - ), - service.ListSkusResponse( - skus=[], - next_page_token='def', - ), - service.ListSkusResponse( - skus=[ - products.Sku(), - ], - next_page_token='ghi', - ), - service.ListSkusResponse( - skus=[ - products.Sku(), - products.Sku(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_skus(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, products.Sku) - for i in results) -def test_list_skus_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_skus), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListSkusResponse( - skus=[ - products.Sku(), - products.Sku(), - products.Sku(), - ], - next_page_token='abc', - ), - service.ListSkusResponse( - skus=[], - next_page_token='def', - ), - service.ListSkusResponse( - skus=[ - products.Sku(), - ], - next_page_token='ghi', - ), - service.ListSkusResponse( - skus=[ - products.Sku(), - products.Sku(), - ], - ), - RuntimeError, - ) - pages = list(client.list_skus(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_skus_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_skus), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListSkusResponse( - skus=[ - products.Sku(), - products.Sku(), - products.Sku(), - ], - next_page_token='abc', - ), - service.ListSkusResponse( - skus=[], - next_page_token='def', - ), - service.ListSkusResponse( - skus=[ - products.Sku(), - ], - next_page_token='ghi', - ), - service.ListSkusResponse( - skus=[ - products.Sku(), - products.Sku(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_skus(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, products.Sku) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_skus_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_skus), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListSkusResponse( - skus=[ - products.Sku(), - products.Sku(), - products.Sku(), - ], - next_page_token='abc', - ), - service.ListSkusResponse( - skus=[], - next_page_token='def', - ), - service.ListSkusResponse( - skus=[ - products.Sku(), - ], - next_page_token='ghi', - ), - service.ListSkusResponse( - skus=[ - products.Sku(), - products.Sku(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_skus(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.ListOffersRequest, - dict, -]) -def test_list_offers(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_offers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListOffersResponse( - next_page_token='next_page_token_value', - ) - response = client.list_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListOffersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListOffersPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_offers_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_offers), - '__call__') as call: - client.list_offers() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListOffersRequest() - -@pytest.mark.asyncio -async def test_list_offers_async(transport: str = 'grpc_asyncio', request_type=service.ListOffersRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_offers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListOffersResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListOffersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListOffersAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_offers_async_from_dict(): - await test_list_offers_async(request_type=dict) - - -def test_list_offers_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListOffersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_offers), - '__call__') as call: - call.return_value = service.ListOffersResponse() - client.list_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_offers_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListOffersRequest() - - request.parent = 'parent_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_offers), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListOffersResponse()) - await client.list_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_offers_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_offers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListOffersResponse( - offers=[ - offers.Offer(), - offers.Offer(), - offers.Offer(), - ], - next_page_token='abc', - ), - service.ListOffersResponse( - offers=[], - next_page_token='def', - ), - service.ListOffersResponse( - offers=[ - offers.Offer(), - ], - next_page_token='ghi', - ), - service.ListOffersResponse( - offers=[ - offers.Offer(), - offers.Offer(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_offers(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, offers.Offer) - for i in results) -def test_list_offers_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_offers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListOffersResponse( - offers=[ - offers.Offer(), - offers.Offer(), - offers.Offer(), - ], - next_page_token='abc', - ), - service.ListOffersResponse( - offers=[], - next_page_token='def', - ), - service.ListOffersResponse( - offers=[ - offers.Offer(), - ], - next_page_token='ghi', - ), - service.ListOffersResponse( - offers=[ - offers.Offer(), - offers.Offer(), - ], - ), - RuntimeError, - ) - pages = list(client.list_offers(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_offers_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_offers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListOffersResponse( - offers=[ - offers.Offer(), - offers.Offer(), - offers.Offer(), - ], - next_page_token='abc', - ), - service.ListOffersResponse( - offers=[], - next_page_token='def', - ), - service.ListOffersResponse( - offers=[ - offers.Offer(), - ], - next_page_token='ghi', - ), - service.ListOffersResponse( - offers=[ - offers.Offer(), - offers.Offer(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_offers(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, offers.Offer) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_offers_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_offers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListOffersResponse( - offers=[ - offers.Offer(), - offers.Offer(), - offers.Offer(), - ], - next_page_token='abc', - ), - service.ListOffersResponse( - offers=[], - next_page_token='def', - ), - service.ListOffersResponse( - offers=[ - offers.Offer(), - ], - next_page_token='ghi', - ), - service.ListOffersResponse( - offers=[ - offers.Offer(), - offers.Offer(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_offers(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.ListPurchasableSkusRequest, - dict, -]) -def test_list_purchasable_skus(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_skus), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListPurchasableSkusResponse( - next_page_token='next_page_token_value', - ) - response = client.list_purchasable_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListPurchasableSkusRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListPurchasableSkusPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_purchasable_skus_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_skus), - '__call__') as call: - client.list_purchasable_skus() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListPurchasableSkusRequest() - -@pytest.mark.asyncio -async def test_list_purchasable_skus_async(transport: str = 'grpc_asyncio', request_type=service.ListPurchasableSkusRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_skus), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListPurchasableSkusResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_purchasable_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListPurchasableSkusRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListPurchasableSkusAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_purchasable_skus_async_from_dict(): - await test_list_purchasable_skus_async(request_type=dict) - - -def test_list_purchasable_skus_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListPurchasableSkusRequest() - - request.customer = 'customer_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_skus), - '__call__') as call: - call.return_value = service.ListPurchasableSkusResponse() - client.list_purchasable_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer=customer_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_purchasable_skus_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListPurchasableSkusRequest() - - request.customer = 'customer_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_skus), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListPurchasableSkusResponse()) - await client.list_purchasable_skus(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer=customer_value', - ) in kw['metadata'] - - -def test_list_purchasable_skus_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_skus), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - service.PurchasableSku(), - service.PurchasableSku(), - ], - next_page_token='abc', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[], - next_page_token='def', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - ], - next_page_token='ghi', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - service.PurchasableSku(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('customer', ''), - )), - ) - pager = client.list_purchasable_skus(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, service.PurchasableSku) - for i in results) -def test_list_purchasable_skus_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_skus), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - service.PurchasableSku(), - service.PurchasableSku(), - ], - next_page_token='abc', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[], - next_page_token='def', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - ], - next_page_token='ghi', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - service.PurchasableSku(), - ], - ), - RuntimeError, - ) - pages = list(client.list_purchasable_skus(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_purchasable_skus_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_skus), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - service.PurchasableSku(), - service.PurchasableSku(), - ], - next_page_token='abc', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[], - next_page_token='def', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - ], - next_page_token='ghi', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - service.PurchasableSku(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_purchasable_skus(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, service.PurchasableSku) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_purchasable_skus_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_skus), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - service.PurchasableSku(), - service.PurchasableSku(), - ], - next_page_token='abc', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[], - next_page_token='def', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - ], - next_page_token='ghi', - ), - service.ListPurchasableSkusResponse( - purchasable_skus=[ - service.PurchasableSku(), - service.PurchasableSku(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_purchasable_skus(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.ListPurchasableOffersRequest, - dict, -]) -def test_list_purchasable_offers(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_offers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListPurchasableOffersResponse( - next_page_token='next_page_token_value', - ) - response = client.list_purchasable_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListPurchasableOffersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListPurchasableOffersPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_purchasable_offers_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_offers), - '__call__') as call: - client.list_purchasable_offers() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListPurchasableOffersRequest() - -@pytest.mark.asyncio -async def test_list_purchasable_offers_async(transport: str = 'grpc_asyncio', request_type=service.ListPurchasableOffersRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_offers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListPurchasableOffersResponse( - next_page_token='next_page_token_value', - )) - response = await client.list_purchasable_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListPurchasableOffersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListPurchasableOffersAsyncPager) - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_purchasable_offers_async_from_dict(): - await test_list_purchasable_offers_async(request_type=dict) - - -def test_list_purchasable_offers_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListPurchasableOffersRequest() - - request.customer = 'customer_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_offers), - '__call__') as call: - call.return_value = service.ListPurchasableOffersResponse() - client.list_purchasable_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer=customer_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_purchasable_offers_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListPurchasableOffersRequest() - - request.customer = 'customer_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_offers), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListPurchasableOffersResponse()) - await client.list_purchasable_offers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'customer=customer_value', - ) in kw['metadata'] - - -def test_list_purchasable_offers_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_offers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - service.PurchasableOffer(), - service.PurchasableOffer(), - ], - next_page_token='abc', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[], - next_page_token='def', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - ], - next_page_token='ghi', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - service.PurchasableOffer(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('customer', ''), - )), - ) - pager = client.list_purchasable_offers(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, service.PurchasableOffer) - for i in results) -def test_list_purchasable_offers_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_offers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - service.PurchasableOffer(), - service.PurchasableOffer(), - ], - next_page_token='abc', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[], - next_page_token='def', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - ], - next_page_token='ghi', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - service.PurchasableOffer(), - ], - ), - RuntimeError, - ) - pages = list(client.list_purchasable_offers(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_purchasable_offers_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_offers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - service.PurchasableOffer(), - service.PurchasableOffer(), - ], - next_page_token='abc', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[], - next_page_token='def', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - ], - next_page_token='ghi', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - service.PurchasableOffer(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_purchasable_offers(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, service.PurchasableOffer) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_purchasable_offers_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_purchasable_offers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - service.PurchasableOffer(), - service.PurchasableOffer(), - ], - next_page_token='abc', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[], - next_page_token='def', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - ], - next_page_token='ghi', - ), - service.ListPurchasableOffersResponse( - purchasable_offers=[ - service.PurchasableOffer(), - service.PurchasableOffer(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_purchasable_offers(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.RegisterSubscriberRequest, - dict, -]) -def test_register_subscriber(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.register_subscriber), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.RegisterSubscriberResponse( - topic='topic_value', - ) - response = client.register_subscriber(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.RegisterSubscriberRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, service.RegisterSubscriberResponse) - assert response.topic == 'topic_value' - - -def test_register_subscriber_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.register_subscriber), - '__call__') as call: - client.register_subscriber() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.RegisterSubscriberRequest() - -@pytest.mark.asyncio -async def test_register_subscriber_async(transport: str = 'grpc_asyncio', request_type=service.RegisterSubscriberRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.register_subscriber), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.RegisterSubscriberResponse( - topic='topic_value', - )) - response = await client.register_subscriber(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.RegisterSubscriberRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, service.RegisterSubscriberResponse) - assert response.topic == 'topic_value' - - -@pytest.mark.asyncio -async def test_register_subscriber_async_from_dict(): - await test_register_subscriber_async(request_type=dict) - - -def test_register_subscriber_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.RegisterSubscriberRequest() - - request.account = 'account_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.register_subscriber), - '__call__') as call: - call.return_value = service.RegisterSubscriberResponse() - client.register_subscriber(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'account=account_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_register_subscriber_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.RegisterSubscriberRequest() - - request.account = 'account_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.register_subscriber), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.RegisterSubscriberResponse()) - await client.register_subscriber(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'account=account_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.UnregisterSubscriberRequest, - dict, -]) -def test_unregister_subscriber(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.unregister_subscriber), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.UnregisterSubscriberResponse( - topic='topic_value', - ) - response = client.unregister_subscriber(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.UnregisterSubscriberRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, service.UnregisterSubscriberResponse) - assert response.topic == 'topic_value' - - -def test_unregister_subscriber_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.unregister_subscriber), - '__call__') as call: - client.unregister_subscriber() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UnregisterSubscriberRequest() - -@pytest.mark.asyncio -async def test_unregister_subscriber_async(transport: str = 'grpc_asyncio', request_type=service.UnregisterSubscriberRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.unregister_subscriber), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.UnregisterSubscriberResponse( - topic='topic_value', - )) - response = await client.unregister_subscriber(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.UnregisterSubscriberRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, service.UnregisterSubscriberResponse) - assert response.topic == 'topic_value' - - -@pytest.mark.asyncio -async def test_unregister_subscriber_async_from_dict(): - await test_unregister_subscriber_async(request_type=dict) - - -def test_unregister_subscriber_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UnregisterSubscriberRequest() - - request.account = 'account_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.unregister_subscriber), - '__call__') as call: - call.return_value = service.UnregisterSubscriberResponse() - client.unregister_subscriber(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'account=account_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_unregister_subscriber_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.UnregisterSubscriberRequest() - - request.account = 'account_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.unregister_subscriber), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.UnregisterSubscriberResponse()) - await client.unregister_subscriber(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'account=account_value', - ) in kw['metadata'] - - -@pytest.mark.parametrize("request_type", [ - service.ListSubscribersRequest, - dict, -]) -def test_list_subscribers(request_type, transport: str = 'grpc'): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_subscribers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListSubscribersResponse( - topic='topic_value', - service_accounts=['service_accounts_value'], - next_page_token='next_page_token_value', - ) - response = client.list_subscribers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSubscribersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSubscribersPager) - assert response.topic == 'topic_value' - assert response.service_accounts == ['service_accounts_value'] - assert response.next_page_token == 'next_page_token_value' - - -def test_list_subscribers_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_subscribers), - '__call__') as call: - client.list_subscribers() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSubscribersRequest() - -@pytest.mark.asyncio -async def test_list_subscribers_async(transport: str = 'grpc_asyncio', request_type=service.ListSubscribersRequest): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_subscribers), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListSubscribersResponse( - topic='topic_value', - service_accounts=['service_accounts_value'], - next_page_token='next_page_token_value', - )) - response = await client.list_subscribers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSubscribersRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSubscribersAsyncPager) - assert response.topic == 'topic_value' - assert response.service_accounts == ['service_accounts_value'] - assert response.next_page_token == 'next_page_token_value' - - -@pytest.mark.asyncio -async def test_list_subscribers_async_from_dict(): - await test_list_subscribers_async(request_type=dict) - - -def test_list_subscribers_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListSubscribersRequest() - - request.account = 'account_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_subscribers), - '__call__') as call: - call.return_value = service.ListSubscribersResponse() - client.list_subscribers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'account=account_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_subscribers_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = service.ListSubscribersRequest() - - request.account = 'account_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_subscribers), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListSubscribersResponse()) - await client.list_subscribers(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'account=account_value', - ) in kw['metadata'] - - -def test_list_subscribers_pager(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_subscribers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListSubscribersResponse( - service_accounts=[ - str(), - str(), - str(), - ], - next_page_token='abc', - ), - service.ListSubscribersResponse( - service_accounts=[], - next_page_token='def', - ), - service.ListSubscribersResponse( - service_accounts=[ - str(), - ], - next_page_token='ghi', - ), - service.ListSubscribersResponse( - service_accounts=[ - str(), - str(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('account', ''), - )), - ) - pager = client.list_subscribers(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, str) - for i in results) -def test_list_subscribers_pages(transport_name: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_subscribers), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListSubscribersResponse( - service_accounts=[ - str(), - str(), - str(), - ], - next_page_token='abc', - ), - service.ListSubscribersResponse( - service_accounts=[], - next_page_token='def', - ), - service.ListSubscribersResponse( - service_accounts=[ - str(), - ], - next_page_token='ghi', - ), - service.ListSubscribersResponse( - service_accounts=[ - str(), - str(), - ], - ), - RuntimeError, - ) - pages = list(client.list_subscribers(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_subscribers_async_pager(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_subscribers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListSubscribersResponse( - service_accounts=[ - str(), - str(), - str(), - ], - next_page_token='abc', - ), - service.ListSubscribersResponse( - service_accounts=[], - next_page_token='def', - ), - service.ListSubscribersResponse( - service_accounts=[ - str(), - ], - next_page_token='ghi', - ), - service.ListSubscribersResponse( - service_accounts=[ - str(), - str(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_subscribers(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, str) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_subscribers_async_pages(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_subscribers), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListSubscribersResponse( - service_accounts=[ - str(), - str(), - str(), - ], - next_page_token='abc', - ), - service.ListSubscribersResponse( - service_accounts=[], - next_page_token='def', - ), - service.ListSubscribersResponse( - service_accounts=[ - str(), - ], - next_page_token='ghi', - ), - service.ListSubscribersResponse( - service_accounts=[ - str(), - str(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_subscribers(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.CloudChannelServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.CloudChannelServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CloudChannelServiceClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.CloudChannelServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = CloudChannelServiceClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = CloudChannelServiceClient( - client_options=options, - credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.CloudChannelServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CloudChannelServiceClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.CloudChannelServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = CloudChannelServiceClient(transport=transport) - assert client.transport is transport - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.CloudChannelServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.CloudChannelServiceGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - -@pytest.mark.parametrize("transport_class", [ - transports.CloudChannelServiceGrpcTransport, - transports.CloudChannelServiceGrpcAsyncIOTransport, -]) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - -@pytest.mark.parametrize("transport_name", [ - "grpc", -]) -def test_transport_kind(transport_name): - transport = CloudChannelServiceClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.CloudChannelServiceGrpcTransport, - ) - -def test_cloud_channel_service_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.CloudChannelServiceTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json" - ) - - -def test_cloud_channel_service_base_transport(): - # Instantiate the base transport. - with mock.patch('google.cloud.channel_v1.services.cloud_channel_service.transports.CloudChannelServiceTransport.__init__') as Transport: - Transport.return_value = None - transport = transports.CloudChannelServiceTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - 'list_customers', - 'get_customer', - 'check_cloud_identity_accounts_exist', - 'create_customer', - 'update_customer', - 'delete_customer', - 'import_customer', - 'provision_cloud_identity', - 'list_entitlements', - 'list_transferable_skus', - 'list_transferable_offers', - 'get_entitlement', - 'create_entitlement', - 'change_parameters', - 'change_renewal_settings', - 'change_offer', - 'start_paid_service', - 'suspend_entitlement', - 'cancel_entitlement', - 'activate_entitlement', - 'transfer_entitlements', - 'transfer_entitlements_to_google', - 'list_channel_partner_links', - 'get_channel_partner_link', - 'create_channel_partner_link', - 'update_channel_partner_link', - 'get_customer_repricing_config', - 'list_customer_repricing_configs', - 'create_customer_repricing_config', - 'update_customer_repricing_config', - 'delete_customer_repricing_config', - 'get_channel_partner_repricing_config', - 'list_channel_partner_repricing_configs', - 'create_channel_partner_repricing_config', - 'update_channel_partner_repricing_config', - 'delete_channel_partner_repricing_config', - 'lookup_offer', - 'list_products', - 'list_skus', - 'list_offers', - 'list_purchasable_skus', - 'list_purchasable_offers', - 'register_subscriber', - 'unregister_subscriber', - 'list_subscribers', - 'get_operation', - 'cancel_operation', - 'delete_operation', - 'list_operations', - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - with pytest.raises(NotImplementedError): - transport.operations_client - - # Catch all for all remaining methods and properties - remainder = [ - 'kind', - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_cloud_channel_service_base_transport_with_credentials_file(): - # Instantiate the base transport with a credentials file - with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.channel_v1.services.cloud_channel_service.transports.CloudChannelServiceTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.CloudChannelServiceTransport( - credentials_file="credentials.json", - quota_project_id="octopus", - ) - load_creds.assert_called_once_with("credentials.json", - scopes=None, - default_scopes=( - 'https://www.googleapis.com/auth/apps.order', -), - quota_project_id="octopus", - ) - - -def test_cloud_channel_service_base_transport_with_adc(): - # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.channel_v1.services.cloud_channel_service.transports.CloudChannelServiceTransport._prep_wrapped_messages') as Transport: - Transport.return_value = None - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.CloudChannelServiceTransport() - adc.assert_called_once() - - -def test_cloud_channel_service_auth_adc(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - CloudChannelServiceClient() - adc.assert_called_once_with( - scopes=None, - default_scopes=( - 'https://www.googleapis.com/auth/apps.order', -), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.CloudChannelServiceGrpcTransport, - transports.CloudChannelServiceGrpcAsyncIOTransport, - ], -) -def test_cloud_channel_service_transport_auth_adc(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus", scopes=["1", "2"]) - adc.assert_called_once_with( - scopes=["1", "2"], - default_scopes=( 'https://www.googleapis.com/auth/apps.order',), - quota_project_id="octopus", - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.CloudChannelServiceGrpcTransport, - transports.CloudChannelServiceGrpcAsyncIOTransport, - ], -) -def test_cloud_channel_service_transport_auth_gdch_credentials(transport_class): - host = 'https://language.com' - api_audience_tests = [None, 'https://language2.com'] - api_audience_expect = [host, 'https://language2.com'] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with( - e - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.CloudChannelServiceGrpcTransport, grpc_helpers), - (transports.CloudChannelServiceGrpcAsyncIOTransport, grpc_helpers_async) - ], -) -def test_cloud_channel_service_transport_create_channel(transport_class, grpc_helpers): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object( - grpc_helpers, "create_channel", autospec=True - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - adc.return_value = (creds, None) - transport_class( - quota_project_id="octopus", - scopes=["1", "2"] - ) - - create_channel.assert_called_with( - "cloudchannel.googleapis.com:443", - credentials=creds, - credentials_file=None, - quota_project_id="octopus", - default_scopes=( - 'https://www.googleapis.com/auth/apps.order', -), - scopes=["1", "2"], - default_host="cloudchannel.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("transport_class", [transports.CloudChannelServiceGrpcTransport, transports.CloudChannelServiceGrpcAsyncIOTransport]) -def test_cloud_channel_service_grpc_transport_client_cert_source_for_mtls( - transport_class -): - cred = ga_credentials.AnonymousCredentials() - - # Check ssl_channel_credentials is used if provided. - with mock.patch.object(transport_class, "create_channel") as mock_create_channel: - mock_ssl_channel_creds = mock.Mock() - transport_class( - host="squid.clam.whelk", - credentials=cred, - ssl_channel_credentials=mock_ssl_channel_creds - ) - mock_create_channel.assert_called_once_with( - "squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_channel_creds, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls - # is used. - with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): - with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: - transport_class( - credentials=cred, - client_cert_source_for_mtls=client_cert_source_callback - ) - expected_cert, expected_key = client_cert_source_callback() - mock_ssl_cred.assert_called_once_with( - certificate_chain=expected_cert, - private_key=expected_key - ) - - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) -def test_cloud_channel_service_host_no_port(transport_name): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='cloudchannel.googleapis.com'), - transport=transport_name, - ) - assert client.transport._host == ( - 'cloudchannel.googleapis.com:443' - ) - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) -def test_cloud_channel_service_host_with_port(transport_name): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='cloudchannel.googleapis.com:8000'), - transport=transport_name, - ) - assert client.transport._host == ( - 'cloudchannel.googleapis.com:8000' - ) - -def test_cloud_channel_service_grpc_transport_channel(): - channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.CloudChannelServiceGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_cloud_channel_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.CloudChannelServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CloudChannelServiceGrpcTransport, transports.CloudChannelServiceGrpcAsyncIOTransport]) -def test_cloud_channel_service_transport_channel_mtls_with_client_cert_source( - transport_class -): - with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - assert transport._ssl_channel_credentials == mock_ssl_cred - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CloudChannelServiceGrpcTransport, transports.CloudChannelServiceGrpcAsyncIOTransport]) -def test_cloud_channel_service_transport_channel_mtls_with_adc( - transport_class -): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_cloud_channel_service_grpc_lro_client(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_cloud_channel_service_grpc_lro_async_client(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc_asyncio', - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsAsyncClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_channel_partner_link_path(): - account = "squid" - channel_partner_link = "clam" - expected = "accounts/{account}/channelPartnerLinks/{channel_partner_link}".format(account=account, channel_partner_link=channel_partner_link, ) - actual = CloudChannelServiceClient.channel_partner_link_path(account, channel_partner_link) - assert expected == actual - - -def test_parse_channel_partner_link_path(): - expected = { - "account": "whelk", - "channel_partner_link": "octopus", - } - path = CloudChannelServiceClient.channel_partner_link_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_channel_partner_link_path(path) - assert expected == actual - -def test_channel_partner_repricing_config_path(): - account = "oyster" - channel_partner = "nudibranch" - channel_partner_repricing_config = "cuttlefish" - expected = "accounts/{account}/channelPartnerLinks/{channel_partner}/channelPartnerRepricingConfigs/{channel_partner_repricing_config}".format(account=account, channel_partner=channel_partner, channel_partner_repricing_config=channel_partner_repricing_config, ) - actual = CloudChannelServiceClient.channel_partner_repricing_config_path(account, channel_partner, channel_partner_repricing_config) - assert expected == actual - - -def test_parse_channel_partner_repricing_config_path(): - expected = { - "account": "mussel", - "channel_partner": "winkle", - "channel_partner_repricing_config": "nautilus", - } - path = CloudChannelServiceClient.channel_partner_repricing_config_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_channel_partner_repricing_config_path(path) - assert expected == actual - -def test_customer_path(): - account = "scallop" - customer = "abalone" - expected = "accounts/{account}/customers/{customer}".format(account=account, customer=customer, ) - actual = CloudChannelServiceClient.customer_path(account, customer) - assert expected == actual - - -def test_parse_customer_path(): - expected = { - "account": "squid", - "customer": "clam", - } - path = CloudChannelServiceClient.customer_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_customer_path(path) - assert expected == actual - -def test_customer_repricing_config_path(): - account = "whelk" - customer = "octopus" - customer_repricing_config = "oyster" - expected = "accounts/{account}/customers/{customer}/customerRepricingConfigs/{customer_repricing_config}".format(account=account, customer=customer, customer_repricing_config=customer_repricing_config, ) - actual = CloudChannelServiceClient.customer_repricing_config_path(account, customer, customer_repricing_config) - assert expected == actual - - -def test_parse_customer_repricing_config_path(): - expected = { - "account": "nudibranch", - "customer": "cuttlefish", - "customer_repricing_config": "mussel", - } - path = CloudChannelServiceClient.customer_repricing_config_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_customer_repricing_config_path(path) - assert expected == actual - -def test_entitlement_path(): - account = "winkle" - customer = "nautilus" - entitlement = "scallop" - expected = "accounts/{account}/customers/{customer}/entitlements/{entitlement}".format(account=account, customer=customer, entitlement=entitlement, ) - actual = CloudChannelServiceClient.entitlement_path(account, customer, entitlement) - assert expected == actual - - -def test_parse_entitlement_path(): - expected = { - "account": "abalone", - "customer": "squid", - "entitlement": "clam", - } - path = CloudChannelServiceClient.entitlement_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_entitlement_path(path) - assert expected == actual - -def test_offer_path(): - account = "whelk" - offer = "octopus" - expected = "accounts/{account}/offers/{offer}".format(account=account, offer=offer, ) - actual = CloudChannelServiceClient.offer_path(account, offer) - assert expected == actual - - -def test_parse_offer_path(): - expected = { - "account": "oyster", - "offer": "nudibranch", - } - path = CloudChannelServiceClient.offer_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_offer_path(path) - assert expected == actual - -def test_product_path(): - product = "cuttlefish" - expected = "products/{product}".format(product=product, ) - actual = CloudChannelServiceClient.product_path(product) - assert expected == actual - - -def test_parse_product_path(): - expected = { - "product": "mussel", - } - path = CloudChannelServiceClient.product_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_product_path(path) - assert expected == actual - -def test_sku_path(): - product = "winkle" - sku = "nautilus" - expected = "products/{product}/skus/{sku}".format(product=product, sku=sku, ) - actual = CloudChannelServiceClient.sku_path(product, sku) - assert expected == actual - - -def test_parse_sku_path(): - expected = { - "product": "scallop", - "sku": "abalone", - } - path = CloudChannelServiceClient.sku_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_sku_path(path) - assert expected == actual - -def test_common_billing_account_path(): - billing_account = "squid" - expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - actual = CloudChannelServiceClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "clam", - } - path = CloudChannelServiceClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_common_billing_account_path(path) - assert expected == actual - -def test_common_folder_path(): - folder = "whelk" - expected = "folders/{folder}".format(folder=folder, ) - actual = CloudChannelServiceClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "octopus", - } - path = CloudChannelServiceClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_common_folder_path(path) - assert expected == actual - -def test_common_organization_path(): - organization = "oyster" - expected = "organizations/{organization}".format(organization=organization, ) - actual = CloudChannelServiceClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nudibranch", - } - path = CloudChannelServiceClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_common_organization_path(path) - assert expected == actual - -def test_common_project_path(): - project = "cuttlefish" - expected = "projects/{project}".format(project=project, ) - actual = CloudChannelServiceClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "mussel", - } - path = CloudChannelServiceClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_common_project_path(path) - assert expected == actual - -def test_common_location_path(): - project = "winkle" - location = "nautilus" - expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) - actual = CloudChannelServiceClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "scallop", - "location": "abalone", - } - path = CloudChannelServiceClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = CloudChannelServiceClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object(transports.CloudChannelServiceTransport, '_prep_wrapped_messages') as prep: - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object(transports.CloudChannelServiceTransport, '_prep_wrapped_messages') as prep: - transport_class = CloudChannelServiceClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_delete_operation(transport: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.DeleteOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None -@pytest.mark.asyncio -async def test_delete_operation_async(transport: str = "grpc"): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.DeleteOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.delete_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - -def test_delete_operation_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.DeleteOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - call.return_value = None - - client.delete_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_delete_operation_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.DeleteOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - await client.delete_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_delete_operation_from_dict(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - - response = client.delete_operation( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_delete_operation_from_dict_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.delete_operation( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_cancel_operation(transport: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.CancelOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.cancel_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None -@pytest.mark.asyncio -async def test_cancel_operation_async(transport: str = "grpc"): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.CancelOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.cancel_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None - -def test_cancel_operation_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.CancelOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - call.return_value = None - - client.cancel_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_cancel_operation_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.CancelOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - await client.cancel_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_cancel_operation_from_dict(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - - response = client.cancel_operation( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_cancel_operation_from_dict_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) - response = await client.cancel_operation( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_get_operation(transport: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.GetOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation() - response = client.get_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.Operation) -@pytest.mark.asyncio -async def test_get_operation_async(transport: str = "grpc"): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.GetOperationRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation() - ) - response = await client.get_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.Operation) - -def test_get_operation_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.GetOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - call.return_value = operations_pb2.Operation() - - client.get_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_get_operation_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.GetOperationRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation() - ) - await client.get_operation(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_get_operation_from_dict(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation() - - response = client.get_operation( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_get_operation_from_dict_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_operation), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation() - ) - response = await client.get_operation( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_list_operations(transport: str = "grpc"): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.ListOperationsRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.ListOperationsResponse() - response = client.list_operations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.ListOperationsResponse) -@pytest.mark.asyncio -async def test_list_operations_async(transport: str = "grpc"): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = operations_pb2.ListOperationsRequest() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.ListOperationsResponse() - ) - response = await client.list_operations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the response is the type that we expect. - assert isinstance(response, operations_pb2.ListOperationsResponse) - -def test_list_operations_field_headers(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.ListOperationsRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - call.return_value = operations_pb2.ListOperationsResponse() - - client.list_operations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] -@pytest.mark.asyncio -async def test_list_operations_field_headers_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = operations_pb2.ListOperationsRequest() - request.name = "locations" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.ListOperationsResponse() - ) - await client.list_operations(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] - -def test_list_operations_from_dict(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.ListOperationsResponse() - - response = client.list_operations( - request={ - "name": "locations", - } - ) - call.assert_called() -@pytest.mark.asyncio -async def test_list_operations_from_dict_async(): - client = CloudChannelServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_operations), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.ListOperationsResponse() - ) - response = await client.list_operations( - request={ - "name": "locations", - } - ) - call.assert_called() - - -def test_transport_close(): - transports = { - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: - with client: - close.assert_not_called() - close.assert_called_once() - -def test_client_ctx(): - transports = [ - 'grpc', - ] - for transport in transports: - client = CloudChannelServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - -@pytest.mark.parametrize("client_class,transport_class", [ - (CloudChannelServiceClient, transports.CloudChannelServiceGrpcTransport), - (CloudChannelServiceAsyncClient, transports.CloudChannelServiceGrpcAsyncIOTransport), -]) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py similarity index 100% rename from owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py rename to samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py similarity index 100% rename from owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py rename to samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py similarity index 100% rename from owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py rename to samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py similarity index 100% rename from owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py rename to samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py similarity index 100% rename from owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py rename to samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py diff --git a/owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py similarity index 100% rename from owl-bot-staging/v1/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py rename to samples/generated_samples/cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py diff --git a/samples/generated_samples/snippet_metadata_channel_v1.json b/samples/generated_samples/snippet_metadata_channel_v1.json index 6ed74d0..44fb553 100644 --- a/samples/generated_samples/snippet_metadata_channel_v1.json +++ b/samples/generated_samples/snippet_metadata_channel_v1.json @@ -10,6 +10,481 @@ "name": "google-cloud-channel" }, "snippets": [ + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient", + "shortName": "CloudChannelReportsServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient.fetch_report_results", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "FetchReportResults" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.FetchReportResultsRequest" + }, + { + "name": "report_job", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.FetchReportResultsAsyncPager", + "shortName": "fetch_report_results" + }, + "description": "Sample for FetchReportResults", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient", + "shortName": "CloudChannelReportsServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient.fetch_report_results", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.FetchReportResults", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "FetchReportResults" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.FetchReportResultsRequest" + }, + { + "name": "report_job", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.FetchReportResultsPager", + "shortName": "fetch_report_results" + }, + "description": "Sample for FetchReportResults", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_FetchReportResults_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_fetch_report_results_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient", + "shortName": "CloudChannelReportsServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient.list_reports", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.ListReports", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "ListReports" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListReportsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.ListReportsAsyncPager", + "shortName": "list_reports" + }, + "description": "Sample for ListReports", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_ListReports_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient", + "shortName": "CloudChannelReportsServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient.list_reports", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.ListReports", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "ListReports" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListReportsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.channel_v1.services.cloud_channel_reports_service.pagers.ListReportsPager", + "shortName": "list_reports" + }, + "description": "Sample for ListReports", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_ListReports_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_list_reports_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient", + "shortName": "CloudChannelReportsServiceAsyncClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceAsyncClient.run_report_job", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.RunReportJob", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "RunReportJob" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.RunReportJobRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "run_report_job" + }, + "description": "Sample for RunReportJob", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient", + "shortName": "CloudChannelReportsServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelReportsServiceClient.run_report_job", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService.RunReportJob", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelReportsService", + "shortName": "CloudChannelReportsService" + }, + "shortName": "RunReportJob" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.RunReportJobRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "run_report_job" + }, + "description": "Sample for RunReportJob", + "file": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelReportsService_RunReportJob_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "cloudchannel_v1_generated_cloud_channel_reports_service_run_report_job_sync.py" + }, { "canonical": true, "clientMethod": { diff --git a/scripts/fixup_channel_v1_keywords.py b/scripts/fixup_channel_v1_keywords.py index 31f5ad4..643b44c 100644 --- a/scripts/fixup_channel_v1_keywords.py +++ b/scripts/fixup_channel_v1_keywords.py @@ -53,6 +53,7 @@ class channelCallTransformer(cst.CSTTransformer): 'delete_channel_partner_repricing_config': ('name', ), 'delete_customer': ('name', ), 'delete_customer_repricing_config': ('name', ), + 'fetch_report_results': ('report_job', 'page_size', 'page_token', ), 'get_channel_partner_link': ('name', 'view', ), 'get_channel_partner_repricing_config': ('name', ), 'get_customer': ('name', ), @@ -68,6 +69,7 @@ class channelCallTransformer(cst.CSTTransformer): 'list_products': ('account', 'page_size', 'page_token', 'language_code', ), 'list_purchasable_offers': ('customer', 'create_entitlement_purchase', 'change_offer_purchase', 'page_size', 'page_token', 'language_code', ), 'list_purchasable_skus': ('customer', 'create_entitlement_purchase', 'change_offer_purchase', 'page_size', 'page_token', 'language_code', ), + 'list_reports': ('parent', 'page_size', 'page_token', 'language_code', ), 'list_skus': ('parent', 'account', 'page_size', 'page_token', 'language_code', ), 'list_subscribers': ('account', 'page_size', 'page_token', ), 'list_transferable_offers': ('parent', 'sku', 'cloud_identity_id', 'customer_name', 'page_size', 'page_token', 'language_code', ), @@ -75,6 +77,7 @@ class channelCallTransformer(cst.CSTTransformer): 'lookup_offer': ('entitlement', ), 'provision_cloud_identity': ('customer', 'cloud_identity_info', 'user', 'validate_only', ), 'register_subscriber': ('account', 'service_account', ), + 'run_report_job': ('name', 'date_range', 'filter', 'language_code', ), 'start_paid_service': ('name', 'request_id', ), 'suspend_entitlement': ('name', 'request_id', ), 'transfer_entitlements': ('parent', 'entitlements', 'auth_token', 'request_id', ), diff --git a/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py b/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py similarity index 76% rename from owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py rename to tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py index e06dae9..e646e4b 100644 --- a/owl-bot-staging/v1/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py +++ b/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py @@ -14,6 +14,7 @@ # limitations under the License. # import os + # try/except added for compatibility with python < 3.8 try: from unittest import mock @@ -21,37 +22,41 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.channel_v1.services.cloud_channel_reports_service import CloudChannelReportsServiceAsyncClient -from google.cloud.channel_v1.services.cloud_channel_reports_service import CloudChannelReportsServiceClient -from google.cloud.channel_v1.services.cloud_channel_reports_service import pagers -from google.cloud.channel_v1.services.cloud_channel_reports_service import transports -from google.cloud.channel_v1.types import operations -from google.cloud.channel_v1.types import reports_service from google.longrunning import operations_pb2 from google.oauth2 import service_account from google.protobuf import duration_pb2 # type: ignore from google.type import date_pb2 # type: ignore from google.type import datetime_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.channel_v1.services.cloud_channel_reports_service import ( + CloudChannelReportsServiceAsyncClient, + CloudChannelReportsServiceClient, + pagers, + transports, +) +from google.cloud.channel_v1.types import operations, reports_service def client_cert_source_callback(): @@ -62,7 +67,11 @@ def client_cert_source_callback(): # This method modifies the default endpoint so the client can produce a different # mtls endpoint for endpoint testing purposes. def modify_default_endpoint(client): - return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) def test__get_default_mtls_endpoint(): @@ -73,66 +82,106 @@ def test__get_default_mtls_endpoint(): non_googleapi = "api.example.com" assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(None) is None - assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint - assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint - assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint - assert CloudChannelReportsServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize("client_class,transport_name", [ - (CloudChannelReportsServiceClient, "grpc"), - (CloudChannelReportsServiceAsyncClient, "grpc_asyncio"), -]) -def test_cloud_channel_reports_service_client_from_service_account_info(client_class, transport_name): + assert ( + CloudChannelReportsServiceClient._get_default_mtls_endpoint(api_endpoint) + == api_mtls_endpoint + ) + assert ( + CloudChannelReportsServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + CloudChannelReportsServiceClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + CloudChannelReportsServiceClient._get_default_mtls_endpoint( + sandbox_mtls_endpoint + ) + == sandbox_mtls_endpoint + ) + assert ( + CloudChannelReportsServiceClient._get_default_mtls_endpoint(non_googleapi) + == non_googleapi + ) + + +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (CloudChannelReportsServiceClient, "grpc"), + (CloudChannelReportsServiceAsyncClient, "grpc_asyncio"), + ], +) +def test_cloud_channel_reports_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: factory.return_value = creds info = {"valid": True} client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ( - 'cloudchannel.googleapis.com:443' - ) + assert client.transport._host == ("cloudchannel.googleapis.com:443") -@pytest.mark.parametrize("transport_class,transport_name", [ - (transports.CloudChannelReportsServiceGrpcTransport, "grpc"), - (transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_cloud_channel_reports_service_client_service_account_always_use_jwt(transport_class, transport_name): - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.CloudChannelReportsServiceGrpcTransport, "grpc"), + (transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_cloud_channel_reports_service_client_service_account_always_use_jwt( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: creds = service_account.Credentials(None, None, None) transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: creds = service_account.Credentials(None, None, None) transport = transport_class(credentials=creds, always_use_jwt_access=False) use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class,transport_name", [ - (CloudChannelReportsServiceClient, "grpc"), - (CloudChannelReportsServiceAsyncClient, "grpc_asyncio"), -]) -def test_cloud_channel_reports_service_client_from_service_account_file(client_class, transport_name): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (CloudChannelReportsServiceClient, "grpc"), + (CloudChannelReportsServiceAsyncClient, "grpc_asyncio"), + ], +) +def test_cloud_channel_reports_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ( - 'cloudchannel.googleapis.com:443' - ) + assert client.transport._host == ("cloudchannel.googleapis.com:443") def test_cloud_channel_reports_service_client_get_transport_class(): @@ -146,29 +195,52 @@ def test_cloud_channel_reports_service_client_get_transport_class(): assert transport == transports.CloudChannelReportsServiceGrpcTransport -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc"), - (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -@mock.patch.object(CloudChannelReportsServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceClient)) -@mock.patch.object(CloudChannelReportsServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceAsyncClient)) -def test_cloud_channel_reports_service_client_client_options(client_class, transport_class, transport_name): +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + CloudChannelReportsServiceClient, + transports.CloudChannelReportsServiceGrpcTransport, + "grpc", + ), + ( + CloudChannelReportsServiceAsyncClient, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +@mock.patch.object( + CloudChannelReportsServiceClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CloudChannelReportsServiceClient), +) +@mock.patch.object( + CloudChannelReportsServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CloudChannelReportsServiceAsyncClient), +) +def test_cloud_channel_reports_service_client_client_options( + client_class, transport_class, transport_name +): # Check that if channel is provided we won't create a new one. - with mock.patch.object(CloudChannelReportsServiceClient, 'get_transport_class') as gtc: - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ) + with mock.patch.object( + CloudChannelReportsServiceClient, "get_transport_class" + ) as gtc: + transport = transport_class(credentials=ga_credentials.AnonymousCredentials()) client = client_class(transport=transport) gtc.assert_not_called() # Check that if channel is provided via str we will create a new one. - with mock.patch.object(CloudChannelReportsServiceClient, 'get_transport_class') as gtc: + with mock.patch.object( + CloudChannelReportsServiceClient, "get_transport_class" + ) as gtc: client = client_class(transport=transport_name) gtc.assert_called() # Check the case api_endpoint is provided. options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( @@ -186,7 +258,7 @@ def test_cloud_channel_reports_service_client_client_options(client_class, trans # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is # "never". with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(transport=transport_name) patched.assert_called_once_with( @@ -204,7 +276,7 @@ def test_cloud_channel_reports_service_client_client_options(client_class, trans # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is # "always". with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(transport=transport_name) patched.assert_called_once_with( @@ -226,13 +298,15 @@ def test_cloud_channel_reports_service_client_client_options(client_class, trans client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} + ): with pytest.raises(ValueError): client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( @@ -247,8 +321,10 @@ def test_cloud_channel_reports_service_client_client_options(client_class, trans api_audience=None, ) # Check the case api_endpoint is provided - options = client_options.ClientOptions(api_audience="https://language.googleapis.com") - with mock.patch.object(transport_class, '__init__') as patched: + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( @@ -260,27 +336,65 @@ def test_cloud_channel_reports_service_client_client_options(client_class, trans quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, - api_audience="https://language.googleapis.com" + api_audience="https://language.googleapis.com", ) -@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ - (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc", "true"), - (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio", "true"), - (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc", "false"), - (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio", "false"), -]) -@mock.patch.object(CloudChannelReportsServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceClient)) -@mock.patch.object(CloudChannelReportsServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceAsyncClient)) + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,use_client_cert_env", + [ + ( + CloudChannelReportsServiceClient, + transports.CloudChannelReportsServiceGrpcTransport, + "grpc", + "true", + ), + ( + CloudChannelReportsServiceAsyncClient, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + "grpc_asyncio", + "true", + ), + ( + CloudChannelReportsServiceClient, + transports.CloudChannelReportsServiceGrpcTransport, + "grpc", + "false", + ), + ( + CloudChannelReportsServiceAsyncClient, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + "grpc_asyncio", + "false", + ), + ], +) +@mock.patch.object( + CloudChannelReportsServiceClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CloudChannelReportsServiceClient), +) +@mock.patch.object( + CloudChannelReportsServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CloudChannelReportsServiceAsyncClient), +) @mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_cloud_channel_reports_service_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): +def test_cloud_channel_reports_service_client_mtls_env_auto( + client_class, transport_class, transport_name, use_client_cert_env +): # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. # Check the case client_cert_source is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) - with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -305,10 +419,18 @@ def test_cloud_channel_reports_service_client_mtls_env_auto(client_class, transp # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): if use_client_cert_env == "false": expected_host = client.DEFAULT_ENDPOINT expected_client_cert_source = None @@ -331,9 +453,14 @@ def test_cloud_channel_reports_service_client_mtls_env_auto(client_class, transp ) # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): patched.return_value = None client = client_class(transport=transport_name) patched.assert_called_once_with( @@ -349,19 +476,34 @@ def test_cloud_channel_reports_service_client_mtls_env_auto(client_class, transp ) -@pytest.mark.parametrize("client_class", [ - CloudChannelReportsServiceClient, CloudChannelReportsServiceAsyncClient -]) -@mock.patch.object(CloudChannelReportsServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceClient)) -@mock.patch.object(CloudChannelReportsServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudChannelReportsServiceAsyncClient)) -def test_cloud_channel_reports_service_client_get_mtls_endpoint_and_cert_source(client_class): +@pytest.mark.parametrize( + "client_class", + [CloudChannelReportsServiceClient, CloudChannelReportsServiceAsyncClient], +) +@mock.patch.object( + CloudChannelReportsServiceClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CloudChannelReportsServiceClient), +) +@mock.patch.object( + CloudChannelReportsServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CloudChannelReportsServiceAsyncClient), +) +def test_cloud_channel_reports_service_client_get_mtls_endpoint_and_cert_source( + client_class, +): mock_client_cert_source = mock.Mock() # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) assert api_endpoint == mock_api_endpoint assert cert_source == mock_client_cert_source @@ -369,8 +511,12 @@ def test_cloud_channel_reports_service_client_get_mtls_endpoint_and_cert_source( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): mock_client_cert_source = mock.Mock() mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) assert api_endpoint == mock_api_endpoint assert cert_source is None @@ -388,30 +534,55 @@ def test_cloud_channel_reports_service_client_get_mtls_endpoint_and_cert_source( # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() assert api_endpoint == client_class.DEFAULT_ENDPOINT assert cert_source is None # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT assert cert_source == mock_client_cert_source -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc"), - (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_cloud_channel_reports_service_client_client_options_scopes(client_class, transport_class, transport_name): +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + ( + CloudChannelReportsServiceClient, + transports.CloudChannelReportsServiceGrpcTransport, + "grpc", + ), + ( + CloudChannelReportsServiceAsyncClient, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_cloud_channel_reports_service_client_client_options_scopes( + client_class, transport_class, transport_name +): # Check the case scopes are provided. options = client_options.ClientOptions( scopes=["1", "2"], ) - with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( @@ -426,17 +597,31 @@ def test_cloud_channel_reports_service_client_client_options_scopes(client_class api_audience=None, ) -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc", grpc_helpers), - (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_cloud_channel_reports_service_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + CloudChannelReportsServiceClient, + transports.CloudChannelReportsServiceGrpcTransport, + "grpc", + grpc_helpers, + ), + ( + CloudChannelReportsServiceAsyncClient, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_cloud_channel_reports_service_client_client_options_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) + options = client_options.ClientOptions(credentials_file="credentials.json") - with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( @@ -451,11 +636,14 @@ def test_cloud_channel_reports_service_client_client_options_credentials_file(cl api_audience=None, ) + def test_cloud_channel_reports_service_client_client_options_from_dict(): - with mock.patch('google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceGrpcTransport.__init__') as grpc_transport: + with mock.patch( + "google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceGrpcTransport.__init__" + ) as grpc_transport: grpc_transport.return_value = None client = CloudChannelReportsServiceClient( - client_options={'api_endpoint': 'squid.clam.whelk'} + client_options={"api_endpoint": "squid.clam.whelk"} ) grpc_transport.assert_called_once_with( credentials=None, @@ -470,17 +658,30 @@ def test_cloud_channel_reports_service_client_client_options_from_dict(): ) -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport, "grpc", grpc_helpers), - (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_cloud_channel_reports_service_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + CloudChannelReportsServiceClient, + transports.CloudChannelReportsServiceGrpcTransport, + "grpc", + grpc_helpers, + ), + ( + CloudChannelReportsServiceAsyncClient, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_cloud_channel_reports_service_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) + options = client_options.ClientOptions(credentials_file="credentials.json") - with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( @@ -514,8 +715,8 @@ def test_cloud_channel_reports_service_client_create_channel_credentials_file(cl credentials_file=None, quota_project_id=None, default_scopes=( - 'https://www.googleapis.com/auth/apps.reports.usage.readonly', -), + "https://www.googleapis.com/auth/apps.reports.usage.readonly", + ), scopes=None, default_host="cloudchannel.googleapis.com", ssl_credentials=None, @@ -526,11 +727,14 @@ def test_cloud_channel_reports_service_client_create_channel_credentials_file(cl ) -@pytest.mark.parametrize("request_type", [ - reports_service.RunReportJobRequest, - dict, -]) -def test_run_report_job(request_type, transport: str = 'grpc'): +@pytest.mark.parametrize( + "request_type", + [ + reports_service.RunReportJobRequest, + dict, + ], +) +def test_run_report_job(request_type, transport: str = "grpc"): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -541,11 +745,9 @@ def test_run_report_job(request_type, transport: str = 'grpc'): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.run_report_job), - '__call__') as call: + with mock.patch.object(type(client.transport.run_report_job), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/spam') + call.return_value = operations_pb2.Operation(name="operations/spam") response = client.run_report_job(request) # Establish that the underlying gRPC stub method was called. @@ -562,20 +764,21 @@ def test_run_report_job_empty_call(): # i.e. request == None and no flattened fields passed, work. client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.run_report_job), - '__call__') as call: + with mock.patch.object(type(client.transport.run_report_job), "__call__") as call: client.run_report_job() call.assert_called() _, args, _ = call.mock_calls[0] assert args[0] == reports_service.RunReportJobRequest() + @pytest.mark.asyncio -async def test_run_report_job_async(transport: str = 'grpc_asyncio', request_type=reports_service.RunReportJobRequest): +async def test_run_report_job_async( + transport: str = "grpc_asyncio", request_type=reports_service.RunReportJobRequest +): client = CloudChannelReportsServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -586,12 +789,10 @@ async def test_run_report_job_async(transport: str = 'grpc_asyncio', request_typ request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.run_report_job), - '__call__') as call: + with mock.patch.object(type(client.transport.run_report_job), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') + operations_pb2.Operation(name="operations/spam") ) response = await client.run_report_job(request) @@ -618,13 +819,11 @@ def test_run_report_job_field_headers(): # a field header. Set these to a non-empty value. request = reports_service.RunReportJobRequest() - request.name = 'name_value' + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.run_report_job), - '__call__') as call: - call.return_value = operations_pb2.Operation(name='operations/op') + with mock.patch.object(type(client.transport.run_report_job), "__call__") as call: + call.return_value = operations_pb2.Operation(name="operations/op") client.run_report_job(request) # Establish that the underlying gRPC stub method was called. @@ -635,9 +834,9 @@ def test_run_report_job_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -650,13 +849,13 @@ async def test_run_report_job_field_headers_async(): # a field header. Set these to a non-empty value. request = reports_service.RunReportJobRequest() - request.name = 'name_value' + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.run_report_job), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(operations_pb2.Operation(name='operations/op')) + with mock.patch.object(type(client.transport.run_report_job), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) await client.run_report_job(request) # Establish that the underlying gRPC stub method was called. @@ -667,16 +866,19 @@ async def test_run_report_job_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [ - reports_service.FetchReportResultsRequest, - dict, -]) -def test_fetch_report_results(request_type, transport: str = 'grpc'): +@pytest.mark.parametrize( + "request_type", + [ + reports_service.FetchReportResultsRequest, + dict, + ], +) +def test_fetch_report_results(request_type, transport: str = "grpc"): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -688,11 +890,11 @@ def test_fetch_report_results(request_type, transport: str = 'grpc'): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__') as call: + type(client.transport.fetch_report_results), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = reports_service.FetchReportResultsResponse( - next_page_token='next_page_token_value', + next_page_token="next_page_token_value", ) response = client.fetch_report_results(request) @@ -703,7 +905,7 @@ def test_fetch_report_results(request_type, transport: str = 'grpc'): # Establish that the response is the type that we expect. assert isinstance(response, pagers.FetchReportResultsPager) - assert response.next_page_token == 'next_page_token_value' + assert response.next_page_token == "next_page_token_value" def test_fetch_report_results_empty_call(): @@ -711,20 +913,24 @@ def test_fetch_report_results_empty_call(): # i.e. request == None and no flattened fields passed, work. client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__') as call: + type(client.transport.fetch_report_results), "__call__" + ) as call: client.fetch_report_results() call.assert_called() _, args, _ = call.mock_calls[0] assert args[0] == reports_service.FetchReportResultsRequest() + @pytest.mark.asyncio -async def test_fetch_report_results_async(transport: str = 'grpc_asyncio', request_type=reports_service.FetchReportResultsRequest): +async def test_fetch_report_results_async( + transport: str = "grpc_asyncio", + request_type=reports_service.FetchReportResultsRequest, +): client = CloudChannelReportsServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -736,12 +942,14 @@ async def test_fetch_report_results_async(transport: str = 'grpc_asyncio', reque # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__') as call: + type(client.transport.fetch_report_results), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(reports_service.FetchReportResultsResponse( - next_page_token='next_page_token_value', - )) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reports_service.FetchReportResultsResponse( + next_page_token="next_page_token_value", + ) + ) response = await client.fetch_report_results(request) # Establish that the underlying gRPC stub method was called. @@ -751,7 +959,7 @@ async def test_fetch_report_results_async(transport: str = 'grpc_asyncio', reque # Establish that the response is the type that we expect. assert isinstance(response, pagers.FetchReportResultsAsyncPager) - assert response.next_page_token == 'next_page_token_value' + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio @@ -768,12 +976,12 @@ def test_fetch_report_results_field_headers(): # a field header. Set these to a non-empty value. request = reports_service.FetchReportResultsRequest() - request.report_job = 'report_job_value' + request.report_job = "report_job_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__') as call: + type(client.transport.fetch_report_results), "__call__" + ) as call: call.return_value = reports_service.FetchReportResultsResponse() client.fetch_report_results(request) @@ -785,9 +993,9 @@ def test_fetch_report_results_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] assert ( - 'x-goog-request-params', - 'report_job=report_job_value', - ) in kw['metadata'] + "x-goog-request-params", + "report_job=report_job_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -800,13 +1008,15 @@ async def test_fetch_report_results_field_headers_async(): # a field header. Set these to a non-empty value. request = reports_service.FetchReportResultsRequest() - request.report_job = 'report_job_value' + request.report_job = "report_job_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(reports_service.FetchReportResultsResponse()) + type(client.transport.fetch_report_results), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reports_service.FetchReportResultsResponse() + ) await client.fetch_report_results(request) # Establish that the underlying gRPC stub method was called. @@ -817,9 +1027,9 @@ async def test_fetch_report_results_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] assert ( - 'x-goog-request-params', - 'report_job=report_job_value', - ) in kw['metadata'] + "x-goog-request-params", + "report_job=report_job_value", + ) in kw["metadata"] def test_fetch_report_results_flattened(): @@ -829,14 +1039,14 @@ def test_fetch_report_results_flattened(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__') as call: + type(client.transport.fetch_report_results), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = reports_service.FetchReportResultsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.fetch_report_results( - report_job='report_job_value', + report_job="report_job_value", ) # Establish that the underlying call was made with the expected @@ -844,7 +1054,7 @@ def test_fetch_report_results_flattened(): assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] arg = args[0].report_job - mock_val = 'report_job_value' + mock_val = "report_job_value" assert arg == mock_val @@ -858,9 +1068,10 @@ def test_fetch_report_results_flattened_error(): with pytest.raises(ValueError): client.fetch_report_results( reports_service.FetchReportResultsRequest(), - report_job='report_job_value', + report_job="report_job_value", ) + @pytest.mark.asyncio async def test_fetch_report_results_flattened_async(): client = CloudChannelReportsServiceAsyncClient( @@ -869,16 +1080,18 @@ async def test_fetch_report_results_flattened_async(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__') as call: + type(client.transport.fetch_report_results), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = reports_service.FetchReportResultsResponse() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(reports_service.FetchReportResultsResponse()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reports_service.FetchReportResultsResponse() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.fetch_report_results( - report_job='report_job_value', + report_job="report_job_value", ) # Establish that the underlying call was made with the expected @@ -886,9 +1099,10 @@ async def test_fetch_report_results_flattened_async(): assert len(call.mock_calls) _, args, _ = call.mock_calls[0] arg = args[0].report_job - mock_val = 'report_job_value' + mock_val = "report_job_value" assert arg == mock_val + @pytest.mark.asyncio async def test_fetch_report_results_flattened_error_async(): client = CloudChannelReportsServiceAsyncClient( @@ -900,7 +1114,7 @@ async def test_fetch_report_results_flattened_error_async(): with pytest.raises(ValueError): await client.fetch_report_results( reports_service.FetchReportResultsRequest(), - report_job='report_job_value', + report_job="report_job_value", ) @@ -912,8 +1126,8 @@ def test_fetch_report_results_pager(transport_name: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__') as call: + type(client.transport.fetch_report_results), "__call__" + ) as call: # Set the response to a series of pages. call.side_effect = ( reports_service.FetchReportResultsResponse( @@ -922,17 +1136,17 @@ def test_fetch_report_results_pager(transport_name: str = "grpc"): reports_service.Row(), reports_service.Row(), ], - next_page_token='abc', + next_page_token="abc", ), reports_service.FetchReportResultsResponse( rows=[], - next_page_token='def', + next_page_token="def", ), reports_service.FetchReportResultsResponse( rows=[ reports_service.Row(), ], - next_page_token='ghi', + next_page_token="ghi", ), reports_service.FetchReportResultsResponse( rows=[ @@ -945,9 +1159,7 @@ def test_fetch_report_results_pager(transport_name: str = "grpc"): metadata = () metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('report_job', ''), - )), + gapic_v1.routing_header.to_grpc_metadata((("report_job", ""),)), ) pager = client.fetch_report_results(request={}) @@ -955,8 +1167,9 @@ def test_fetch_report_results_pager(transport_name: str = "grpc"): results = list(pager) assert len(results) == 6 - assert all(isinstance(i, reports_service.Row) - for i in results) + assert all(isinstance(i, reports_service.Row) for i in results) + + def test_fetch_report_results_pages(transport_name: str = "grpc"): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials, @@ -965,8 +1178,8 @@ def test_fetch_report_results_pages(transport_name: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__') as call: + type(client.transport.fetch_report_results), "__call__" + ) as call: # Set the response to a series of pages. call.side_effect = ( reports_service.FetchReportResultsResponse( @@ -975,17 +1188,17 @@ def test_fetch_report_results_pages(transport_name: str = "grpc"): reports_service.Row(), reports_service.Row(), ], - next_page_token='abc', + next_page_token="abc", ), reports_service.FetchReportResultsResponse( rows=[], - next_page_token='def', + next_page_token="def", ), reports_service.FetchReportResultsResponse( rows=[ reports_service.Row(), ], - next_page_token='ghi', + next_page_token="ghi", ), reports_service.FetchReportResultsResponse( rows=[ @@ -996,9 +1209,10 @@ def test_fetch_report_results_pages(transport_name: str = "grpc"): RuntimeError, ) pages = list(client.fetch_report_results(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token + @pytest.mark.asyncio async def test_fetch_report_results_async_pager(): client = CloudChannelReportsServiceAsyncClient( @@ -1007,8 +1221,10 @@ async def test_fetch_report_results_async_pager(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__', new_callable=mock.AsyncMock) as call: + type(client.transport.fetch_report_results), + "__call__", + new_callable=mock.AsyncMock, + ) as call: # Set the response to a series of pages. call.side_effect = ( reports_service.FetchReportResultsResponse( @@ -1017,17 +1233,17 @@ async def test_fetch_report_results_async_pager(): reports_service.Row(), reports_service.Row(), ], - next_page_token='abc', + next_page_token="abc", ), reports_service.FetchReportResultsResponse( rows=[], - next_page_token='def', + next_page_token="def", ), reports_service.FetchReportResultsResponse( rows=[ reports_service.Row(), ], - next_page_token='ghi', + next_page_token="ghi", ), reports_service.FetchReportResultsResponse( rows=[ @@ -1037,15 +1253,16 @@ async def test_fetch_report_results_async_pager(): ), RuntimeError, ) - async_pager = await client.fetch_report_results(request={},) - assert async_pager.next_page_token == 'abc' + async_pager = await client.fetch_report_results( + request={}, + ) + assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: # pragma: no branch + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 - assert all(isinstance(i, reports_service.Row) - for i in responses) + assert all(isinstance(i, reports_service.Row) for i in responses) @pytest.mark.asyncio @@ -1056,8 +1273,10 @@ async def test_fetch_report_results_async_pages(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_report_results), - '__call__', new_callable=mock.AsyncMock) as call: + type(client.transport.fetch_report_results), + "__call__", + new_callable=mock.AsyncMock, + ) as call: # Set the response to a series of pages. call.side_effect = ( reports_service.FetchReportResultsResponse( @@ -1066,17 +1285,17 @@ async def test_fetch_report_results_async_pages(): reports_service.Row(), reports_service.Row(), ], - next_page_token='abc', + next_page_token="abc", ), reports_service.FetchReportResultsResponse( rows=[], - next_page_token='def', + next_page_token="def", ), reports_service.FetchReportResultsResponse( rows=[ reports_service.Row(), ], - next_page_token='ghi', + next_page_token="ghi", ), reports_service.FetchReportResultsResponse( rows=[ @@ -1087,16 +1306,22 @@ async def test_fetch_report_results_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.fetch_report_results(request={})).pages: # pragma: no branch + async for page_ in ( + await client.fetch_report_results(request={}) + ).pages: # pragma: no branch pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [ - reports_service.ListReportsRequest, - dict, -]) -def test_list_reports(request_type, transport: str = 'grpc'): + +@pytest.mark.parametrize( + "request_type", + [ + reports_service.ListReportsRequest, + dict, + ], +) +def test_list_reports(request_type, transport: str = "grpc"): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -1107,12 +1332,10 @@ def test_list_reports(request_type, transport: str = 'grpc'): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reports), - '__call__') as call: + with mock.patch.object(type(client.transport.list_reports), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = reports_service.ListReportsResponse( - next_page_token='next_page_token_value', + next_page_token="next_page_token_value", ) response = client.list_reports(request) @@ -1123,7 +1346,7 @@ def test_list_reports(request_type, transport: str = 'grpc'): # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListReportsPager) - assert response.next_page_token == 'next_page_token_value' + assert response.next_page_token == "next_page_token_value" def test_list_reports_empty_call(): @@ -1131,20 +1354,21 @@ def test_list_reports_empty_call(): # i.e. request == None and no flattened fields passed, work. client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reports), - '__call__') as call: + with mock.patch.object(type(client.transport.list_reports), "__call__") as call: client.list_reports() call.assert_called() _, args, _ = call.mock_calls[0] assert args[0] == reports_service.ListReportsRequest() + @pytest.mark.asyncio -async def test_list_reports_async(transport: str = 'grpc_asyncio', request_type=reports_service.ListReportsRequest): +async def test_list_reports_async( + transport: str = "grpc_asyncio", request_type=reports_service.ListReportsRequest +): client = CloudChannelReportsServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -1155,13 +1379,13 @@ async def test_list_reports_async(transport: str = 'grpc_asyncio', request_type= request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reports), - '__call__') as call: + with mock.patch.object(type(client.transport.list_reports), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(reports_service.ListReportsResponse( - next_page_token='next_page_token_value', - )) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reports_service.ListReportsResponse( + next_page_token="next_page_token_value", + ) + ) response = await client.list_reports(request) # Establish that the underlying gRPC stub method was called. @@ -1171,7 +1395,7 @@ async def test_list_reports_async(transport: str = 'grpc_asyncio', request_type= # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListReportsAsyncPager) - assert response.next_page_token == 'next_page_token_value' + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio @@ -1188,12 +1412,10 @@ def test_list_reports_field_headers(): # a field header. Set these to a non-empty value. request = reports_service.ListReportsRequest() - request.parent = 'parent_value' + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reports), - '__call__') as call: + with mock.patch.object(type(client.transport.list_reports), "__call__") as call: call.return_value = reports_service.ListReportsResponse() client.list_reports(request) @@ -1205,9 +1427,9 @@ def test_list_reports_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1220,13 +1442,13 @@ async def test_list_reports_field_headers_async(): # a field header. Set these to a non-empty value. request = reports_service.ListReportsRequest() - request.parent = 'parent_value' + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reports), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(reports_service.ListReportsResponse()) + with mock.patch.object(type(client.transport.list_reports), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reports_service.ListReportsResponse() + ) await client.list_reports(request) # Establish that the underlying gRPC stub method was called. @@ -1237,9 +1459,9 @@ async def test_list_reports_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_reports_flattened(): @@ -1248,15 +1470,13 @@ def test_list_reports_flattened(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reports), - '__call__') as call: + with mock.patch.object(type(client.transport.list_reports), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = reports_service.ListReportsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_reports( - parent='parent_value', + parent="parent_value", ) # Establish that the underlying call was made with the expected @@ -1264,7 +1484,7 @@ def test_list_reports_flattened(): assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] arg = args[0].parent - mock_val = 'parent_value' + mock_val = "parent_value" assert arg == mock_val @@ -1278,9 +1498,10 @@ def test_list_reports_flattened_error(): with pytest.raises(ValueError): client.list_reports( reports_service.ListReportsRequest(), - parent='parent_value', + parent="parent_value", ) + @pytest.mark.asyncio async def test_list_reports_flattened_async(): client = CloudChannelReportsServiceAsyncClient( @@ -1288,17 +1509,17 @@ async def test_list_reports_flattened_async(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reports), - '__call__') as call: + with mock.patch.object(type(client.transport.list_reports), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = reports_service.ListReportsResponse() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(reports_service.ListReportsResponse()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + reports_service.ListReportsResponse() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.list_reports( - parent='parent_value', + parent="parent_value", ) # Establish that the underlying call was made with the expected @@ -1306,9 +1527,10 @@ async def test_list_reports_flattened_async(): assert len(call.mock_calls) _, args, _ = call.mock_calls[0] arg = args[0].parent - mock_val = 'parent_value' + mock_val = "parent_value" assert arg == mock_val + @pytest.mark.asyncio async def test_list_reports_flattened_error_async(): client = CloudChannelReportsServiceAsyncClient( @@ -1320,7 +1542,7 @@ async def test_list_reports_flattened_error_async(): with pytest.raises(ValueError): await client.list_reports( reports_service.ListReportsRequest(), - parent='parent_value', + parent="parent_value", ) @@ -1331,9 +1553,7 @@ def test_list_reports_pager(transport_name: str = "grpc"): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reports), - '__call__') as call: + with mock.patch.object(type(client.transport.list_reports), "__call__") as call: # Set the response to a series of pages. call.side_effect = ( reports_service.ListReportsResponse( @@ -1342,17 +1562,17 @@ def test_list_reports_pager(transport_name: str = "grpc"): reports_service.Report(), reports_service.Report(), ], - next_page_token='abc', + next_page_token="abc", ), reports_service.ListReportsResponse( reports=[], - next_page_token='def', + next_page_token="def", ), reports_service.ListReportsResponse( reports=[ reports_service.Report(), ], - next_page_token='ghi', + next_page_token="ghi", ), reports_service.ListReportsResponse( reports=[ @@ -1365,9 +1585,7 @@ def test_list_reports_pager(transport_name: str = "grpc"): metadata = () metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), ) pager = client.list_reports(request={}) @@ -1375,8 +1593,9 @@ def test_list_reports_pager(transport_name: str = "grpc"): results = list(pager) assert len(results) == 6 - assert all(isinstance(i, reports_service.Report) - for i in results) + assert all(isinstance(i, reports_service.Report) for i in results) + + def test_list_reports_pages(transport_name: str = "grpc"): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials, @@ -1384,9 +1603,7 @@ def test_list_reports_pages(transport_name: str = "grpc"): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reports), - '__call__') as call: + with mock.patch.object(type(client.transport.list_reports), "__call__") as call: # Set the response to a series of pages. call.side_effect = ( reports_service.ListReportsResponse( @@ -1395,17 +1612,17 @@ def test_list_reports_pages(transport_name: str = "grpc"): reports_service.Report(), reports_service.Report(), ], - next_page_token='abc', + next_page_token="abc", ), reports_service.ListReportsResponse( reports=[], - next_page_token='def', + next_page_token="def", ), reports_service.ListReportsResponse( reports=[ reports_service.Report(), ], - next_page_token='ghi', + next_page_token="ghi", ), reports_service.ListReportsResponse( reports=[ @@ -1416,9 +1633,10 @@ def test_list_reports_pages(transport_name: str = "grpc"): RuntimeError, ) pages = list(client.list_reports(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token + @pytest.mark.asyncio async def test_list_reports_async_pager(): client = CloudChannelReportsServiceAsyncClient( @@ -1427,8 +1645,8 @@ async def test_list_reports_async_pager(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_reports), - '__call__', new_callable=mock.AsyncMock) as call: + type(client.transport.list_reports), "__call__", new_callable=mock.AsyncMock + ) as call: # Set the response to a series of pages. call.side_effect = ( reports_service.ListReportsResponse( @@ -1437,17 +1655,17 @@ async def test_list_reports_async_pager(): reports_service.Report(), reports_service.Report(), ], - next_page_token='abc', + next_page_token="abc", ), reports_service.ListReportsResponse( reports=[], - next_page_token='def', + next_page_token="def", ), reports_service.ListReportsResponse( reports=[ reports_service.Report(), ], - next_page_token='ghi', + next_page_token="ghi", ), reports_service.ListReportsResponse( reports=[ @@ -1457,15 +1675,16 @@ async def test_list_reports_async_pager(): ), RuntimeError, ) - async_pager = await client.list_reports(request={},) - assert async_pager.next_page_token == 'abc' + async_pager = await client.list_reports( + request={}, + ) + assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: # pragma: no branch + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 - assert all(isinstance(i, reports_service.Report) - for i in responses) + assert all(isinstance(i, reports_service.Report) for i in responses) @pytest.mark.asyncio @@ -1476,8 +1695,8 @@ async def test_list_reports_async_pages(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_reports), - '__call__', new_callable=mock.AsyncMock) as call: + type(client.transport.list_reports), "__call__", new_callable=mock.AsyncMock + ) as call: # Set the response to a series of pages. call.side_effect = ( reports_service.ListReportsResponse( @@ -1486,17 +1705,17 @@ async def test_list_reports_async_pages(): reports_service.Report(), reports_service.Report(), ], - next_page_token='abc', + next_page_token="abc", ), reports_service.ListReportsResponse( reports=[], - next_page_token='def', + next_page_token="def", ), reports_service.ListReportsResponse( reports=[ reports_service.Report(), ], - next_page_token='ghi', + next_page_token="ghi", ), reports_service.ListReportsResponse( reports=[ @@ -1507,9 +1726,11 @@ async def test_list_reports_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_reports(request={})).pages: # pragma: no branch + async for page_ in ( + await client.list_reports(request={}) + ).pages: # pragma: no branch pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1551,8 +1772,7 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = CloudChannelReportsServiceClient( - client_options=options, - credentials=ga_credentials.AnonymousCredentials() + client_options=options, credentials=ga_credentials.AnonymousCredentials() ) # It is an error to provide scopes and a transport instance. @@ -1574,6 +1794,7 @@ def test_transport_instance(): client = CloudChannelReportsServiceClient(transport=transport) assert client.transport is transport + def test_transport_get_channel(): # A client may be instantiated with a custom transport instance. transport = transports.CloudChannelReportsServiceGrpcTransport( @@ -1588,26 +1809,35 @@ def test_transport_get_channel(): channel = transport.grpc_channel assert channel -@pytest.mark.parametrize("transport_class", [ - transports.CloudChannelReportsServiceGrpcTransport, - transports.CloudChannelReportsServiceGrpcAsyncIOTransport, -]) + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudChannelReportsServiceGrpcTransport, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + ], +) def test_transport_adc(transport_class): # Test default credentials are used if not provided. - with mock.patch.object(google.auth, 'default') as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class() adc.assert_called_once() -@pytest.mark.parametrize("transport_name", [ - "grpc", -]) + +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) def test_transport_kind(transport_name): transport = CloudChannelReportsServiceClient.get_transport_class(transport_name)( credentials=ga_credentials.AnonymousCredentials(), ) assert transport.kind == transport_name + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CloudChannelReportsServiceClient( @@ -1618,18 +1848,21 @@ def test_transport_grpc_default(): transports.CloudChannelReportsServiceGrpcTransport, ) + def test_cloud_channel_reports_service_base_transport_error(): # Passing both a credentials object and credentials_file should raise an error with pytest.raises(core_exceptions.DuplicateCredentialArgs): transport = transports.CloudChannelReportsServiceTransport( credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json" + credentials_file="credentials.json", ) def test_cloud_channel_reports_service_base_transport(): # Instantiate the base transport. - with mock.patch('google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceTransport.__init__') as Transport: + with mock.patch( + "google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceTransport.__init__" + ) as Transport: Transport.return_value = None transport = transports.CloudChannelReportsServiceTransport( credentials=ga_credentials.AnonymousCredentials(), @@ -1638,13 +1871,13 @@ def test_cloud_channel_reports_service_base_transport(): # Every method on the transport should just blindly # raise NotImplementedError. methods = ( - 'run_report_job', - 'fetch_report_results', - 'list_reports', - 'get_operation', - 'cancel_operation', - 'delete_operation', - 'list_operations', + "run_report_job", + "fetch_report_results", + "list_reports", + "get_operation", + "cancel_operation", + "delete_operation", + "list_operations", ) for method in methods: with pytest.raises(NotImplementedError): @@ -1660,7 +1893,7 @@ def test_cloud_channel_reports_service_base_transport(): # Catch all for all remaining methods and properties remainder = [ - 'kind', + "kind", ] for r in remainder: with pytest.raises(NotImplementedError): @@ -1669,25 +1902,32 @@ def test_cloud_channel_reports_service_base_transport(): def test_cloud_channel_reports_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file - with mock.patch.object(google.auth, 'load_credentials_from_file', autospec=True) as load_creds, mock.patch('google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceTransport._prep_wrapped_messages') as Transport: + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch( + "google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceTransport._prep_wrapped_messages" + ) as Transport: Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudChannelReportsServiceTransport( credentials_file="credentials.json", quota_project_id="octopus", ) - load_creds.assert_called_once_with("credentials.json", + load_creds.assert_called_once_with( + "credentials.json", scopes=None, default_scopes=( - 'https://www.googleapis.com/auth/apps.reports.usage.readonly', -), + "https://www.googleapis.com/auth/apps.reports.usage.readonly", + ), quota_project_id="octopus", ) def test_cloud_channel_reports_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. - with mock.patch.object(google.auth, 'default', autospec=True) as adc, mock.patch('google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceTransport._prep_wrapped_messages') as Transport: + with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( + "google.cloud.channel_v1.services.cloud_channel_reports_service.transports.CloudChannelReportsServiceTransport._prep_wrapped_messages" + ) as Transport: Transport.return_value = None adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudChannelReportsServiceTransport() @@ -1696,14 +1936,14 @@ def test_cloud_channel_reports_service_base_transport_with_adc(): def test_cloud_channel_reports_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: + with mock.patch.object(google.auth, "default", autospec=True) as adc: adc.return_value = (ga_credentials.AnonymousCredentials(), None) CloudChannelReportsServiceClient() adc.assert_called_once_with( scopes=None, default_scopes=( - 'https://www.googleapis.com/auth/apps.reports.usage.readonly', -), + "https://www.googleapis.com/auth/apps.reports.usage.readonly", + ), quota_project_id=None, ) @@ -1718,12 +1958,14 @@ def test_cloud_channel_reports_service_auth_adc(): def test_cloud_channel_reports_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. - with mock.patch.object(google.auth, 'default', autospec=True) as adc: + with mock.patch.object(google.auth, "default", autospec=True) as adc: adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( scopes=["1", "2"], - default_scopes=( 'https://www.googleapis.com/auth/apps.reports.usage.readonly',), + default_scopes=( + "https://www.googleapis.com/auth/apps.reports.usage.readonly", + ), quota_project_id="octopus", ) @@ -1736,39 +1978,40 @@ def test_cloud_channel_reports_service_transport_auth_adc(transport_class): ], ) def test_cloud_channel_reports_service_transport_auth_gdch_credentials(transport_class): - host = 'https://language.com' - api_audience_tests = [None, 'https://language2.com'] - api_audience_expect = [host, 'https://language2.com'] + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, 'default', autospec=True) as adc: + with mock.patch.object(google.auth, "default", autospec=True) as adc: gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) adc.return_value = (gdch_mock, None) transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with( - e - ) + gdch_mock.with_gdch_audience.assert_called_once_with(e) @pytest.mark.parametrize( "transport_class,grpc_helpers", [ (transports.CloudChannelReportsServiceGrpcTransport, grpc_helpers), - (transports.CloudChannelReportsServiceGrpcAsyncIOTransport, grpc_helpers_async) + (transports.CloudChannelReportsServiceGrpcAsyncIOTransport, grpc_helpers_async), ], ) -def test_cloud_channel_reports_service_transport_create_channel(transport_class, grpc_helpers): +def test_cloud_channel_reports_service_transport_create_channel( + transport_class, grpc_helpers +): # If credentials and host are not provided, the transport class should use # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object( + with mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( grpc_helpers, "create_channel", autospec=True ) as create_channel: creds = ga_credentials.AnonymousCredentials() adc.return_value = (creds, None) - transport_class( - quota_project_id="octopus", - scopes=["1", "2"] - ) + transport_class(quota_project_id="octopus", scopes=["1", "2"]) create_channel.assert_called_with( "cloudchannel.googleapis.com:443", @@ -1776,8 +2019,8 @@ def test_cloud_channel_reports_service_transport_create_channel(transport_class, credentials_file=None, quota_project_id="octopus", default_scopes=( - 'https://www.googleapis.com/auth/apps.reports.usage.readonly', -), + "https://www.googleapis.com/auth/apps.reports.usage.readonly", + ), scopes=["1", "2"], default_host="cloudchannel.googleapis.com", ssl_credentials=None, @@ -1788,9 +2031,15 @@ def test_cloud_channel_reports_service_transport_create_channel(transport_class, ) -@pytest.mark.parametrize("transport_class", [transports.CloudChannelReportsServiceGrpcTransport, transports.CloudChannelReportsServiceGrpcAsyncIOTransport]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudChannelReportsServiceGrpcTransport, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + ], +) def test_cloud_channel_reports_service_grpc_transport_client_cert_source_for_mtls( - transport_class + transport_class, ): cred = ga_credentials.AnonymousCredentials() @@ -1800,7 +2049,7 @@ def test_cloud_channel_reports_service_grpc_transport_client_cert_source_for_mtl transport_class( host="squid.clam.whelk", credentials=cred, - ssl_channel_credentials=mock_ssl_channel_creds + ssl_channel_credentials=mock_ssl_channel_creds, ) mock_create_channel.assert_called_once_with( "squid.clam.whelk:443", @@ -1821,45 +2070,52 @@ def test_cloud_channel_reports_service_grpc_transport_client_cert_source_for_mtl with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: transport_class( credentials=cred, - client_cert_source_for_mtls=client_cert_source_callback + client_cert_source_for_mtls=client_cert_source_callback, ) expected_cert, expected_key = client_cert_source_callback() mock_ssl_cred.assert_called_once_with( - certificate_chain=expected_cert, - private_key=expected_key + certificate_chain=expected_cert, private_key=expected_key ) -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) def test_cloud_channel_reports_service_host_no_port(transport_name): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='cloudchannel.googleapis.com'), - transport=transport_name, - ) - assert client.transport._host == ( - 'cloudchannel.googleapis.com:443' + client_options=client_options.ClientOptions( + api_endpoint="cloudchannel.googleapis.com" + ), + transport=transport_name, ) + assert client.transport._host == ("cloudchannel.googleapis.com:443") + -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) def test_cloud_channel_reports_service_host_with_port(transport_name): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='cloudchannel.googleapis.com:8000'), + client_options=client_options.ClientOptions( + api_endpoint="cloudchannel.googleapis.com:8000" + ), transport=transport_name, ) - assert client.transport._host == ( - 'cloudchannel.googleapis.com:8000' - ) + assert client.transport._host == ("cloudchannel.googleapis.com:8000") + def test_cloud_channel_reports_service_grpc_transport_channel(): - channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CloudChannelReportsServiceGrpcTransport( @@ -1872,7 +2128,7 @@ def test_cloud_channel_reports_service_grpc_transport_channel(): def test_cloud_channel_reports_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CloudChannelReportsServiceGrpcAsyncIOTransport( @@ -1886,12 +2142,22 @@ def test_cloud_channel_reports_service_grpc_asyncio_transport_channel(): # Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are # removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CloudChannelReportsServiceGrpcTransport, transports.CloudChannelReportsServiceGrpcAsyncIOTransport]) +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudChannelReportsServiceGrpcTransport, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + ], +) def test_cloud_channel_reports_service_transport_channel_mtls_with_client_cert_source( - transport_class + transport_class, ): - with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + with mock.patch( + "grpc.ssl_channel_credentials", autospec=True + ) as grpc_ssl_channel_cred: + with mock.patch.object( + transport_class, "create_channel" + ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1900,7 +2166,7 @@ def test_cloud_channel_reports_service_transport_channel_mtls_with_client_cert_s cred = ga_credentials.AnonymousCredentials() with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, 'default') as adc: + with mock.patch.object(google.auth, "default") as adc: adc.return_value = (cred, None) transport = transport_class( host="squid.clam.whelk", @@ -1930,17 +2196,23 @@ def test_cloud_channel_reports_service_transport_channel_mtls_with_client_cert_s # Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are # removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CloudChannelReportsServiceGrpcTransport, transports.CloudChannelReportsServiceGrpcAsyncIOTransport]) -def test_cloud_channel_reports_service_transport_channel_mtls_with_adc( - transport_class -): +@pytest.mark.parametrize( + "transport_class", + [ + transports.CloudChannelReportsServiceGrpcTransport, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + ], +) +def test_cloud_channel_reports_service_transport_channel_mtls_with_adc(transport_class): mock_ssl_cred = mock.Mock() with mock.patch.multiple( "google.auth.transport.grpc.SslCredentials", __init__=mock.Mock(return_value=None), ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + with mock.patch.object( + transport_class, "create_channel" + ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel mock_cred = mock.Mock() @@ -1971,7 +2243,7 @@ def test_cloud_channel_reports_service_transport_channel_mtls_with_adc( def test_cloud_channel_reports_service_grpc_lro_client(): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', + transport="grpc", ) transport = client.transport @@ -1988,7 +2260,7 @@ def test_cloud_channel_reports_service_grpc_lro_client(): def test_cloud_channel_reports_service_grpc_lro_async_client(): client = CloudChannelReportsServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport='grpc_asyncio', + transport="grpc_asyncio", ) transport = client.transport @@ -2005,7 +2277,10 @@ def test_cloud_channel_reports_service_grpc_lro_async_client(): def test_report_path(): account = "squid" report = "clam" - expected = "accounts/{account}/reports/{report}".format(account=account, report=report, ) + expected = "accounts/{account}/reports/{report}".format( + account=account, + report=report, + ) actual = CloudChannelReportsServiceClient.report_path(account, report) assert expected == actual @@ -2021,10 +2296,14 @@ def test_parse_report_path(): actual = CloudChannelReportsServiceClient.parse_report_path(path) assert expected == actual + def test_report_job_path(): account = "oyster" report_job = "nudibranch" - expected = "accounts/{account}/reportJobs/{report_job}".format(account=account, report_job=report_job, ) + expected = "accounts/{account}/reportJobs/{report_job}".format( + account=account, + report_job=report_job, + ) actual = CloudChannelReportsServiceClient.report_job_path(account, report_job) assert expected == actual @@ -2040,10 +2319,15 @@ def test_parse_report_job_path(): actual = CloudChannelReportsServiceClient.parse_report_job_path(path) assert expected == actual + def test_common_billing_account_path(): billing_account = "winkle" - expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - actual = CloudChannelReportsServiceClient.common_billing_account_path(billing_account) + expected = "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + actual = CloudChannelReportsServiceClient.common_billing_account_path( + billing_account + ) assert expected == actual @@ -2057,9 +2341,12 @@ def test_parse_common_billing_account_path(): actual = CloudChannelReportsServiceClient.parse_common_billing_account_path(path) assert expected == actual + def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder, ) + expected = "folders/{folder}".format( + folder=folder, + ) actual = CloudChannelReportsServiceClient.common_folder_path(folder) assert expected == actual @@ -2074,9 +2361,12 @@ def test_parse_common_folder_path(): actual = CloudChannelReportsServiceClient.parse_common_folder_path(path) assert expected == actual + def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization, ) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = CloudChannelReportsServiceClient.common_organization_path(organization) assert expected == actual @@ -2091,9 +2381,12 @@ def test_parse_common_organization_path(): actual = CloudChannelReportsServiceClient.parse_common_organization_path(path) assert expected == actual + def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project, ) + expected = "projects/{project}".format( + project=project, + ) actual = CloudChannelReportsServiceClient.common_project_path(project) assert expected == actual @@ -2108,10 +2401,14 @@ def test_parse_common_project_path(): actual = CloudChannelReportsServiceClient.parse_common_project_path(path) assert expected == actual + def test_common_location_path(): project = "oyster" location = "nudibranch" - expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) + expected = "projects/{project}/locations/{location}".format( + project=project, + location=location, + ) actual = CloudChannelReportsServiceClient.common_location_path(project, location) assert expected == actual @@ -2131,14 +2428,18 @@ def test_parse_common_location_path(): def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() - with mock.patch.object(transports.CloudChannelReportsServiceTransport, '_prep_wrapped_messages') as prep: + with mock.patch.object( + transports.CloudChannelReportsServiceTransport, "_prep_wrapped_messages" + ) as prep: client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) - with mock.patch.object(transports.CloudChannelReportsServiceTransport, '_prep_wrapped_messages') as prep: + with mock.patch.object( + transports.CloudChannelReportsServiceTransport, "_prep_wrapped_messages" + ) as prep: transport_class = CloudChannelReportsServiceClient.get_transport_class() transport = transport_class( credentials=ga_credentials.AnonymousCredentials(), @@ -2146,13 +2447,16 @@ def test_client_with_default_client_info(): ) prep.assert_called_once_with(client_info) + @pytest.mark.asyncio async def test_transport_close_async(): client = CloudChannelReportsServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", ) - with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: + with mock.patch.object( + type(getattr(client.transport, "grpc_channel")), "close" + ) as close: async with client: close.assert_not_called() close.assert_called_once() @@ -2160,7 +2464,8 @@ async def test_transport_close_async(): def test_delete_operation(transport: str = "grpc"): client = CloudChannelReportsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2179,10 +2484,13 @@ def test_delete_operation(transport: str = "grpc"): # Establish that the response is the type that we expect. assert response is None + + @pytest.mark.asyncio async def test_delete_operation_async(transport: str = "grpc"): client = CloudChannelReportsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2192,9 +2500,7 @@ async def test_delete_operation_async(transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) response = await client.delete_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -2204,6 +2510,7 @@ async def test_delete_operation_async(transport: str = "grpc"): # Establish that the response is the type that we expect. assert response is None + def test_delete_operation_field_headers(): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2216,7 +2523,7 @@ def test_delete_operation_field_headers(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - call.return_value = None + call.return_value = None client.delete_operation(request) # Establish that the underlying gRPC stub method was called. @@ -2226,7 +2533,12 @@ def test_delete_operation_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=locations", + ) in kw["metadata"] + + @pytest.mark.asyncio async def test_delete_operation_field_headers_async(): client = CloudChannelReportsServiceAsyncClient( @@ -2240,9 +2552,7 @@ async def test_delete_operation_field_headers_async(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -2251,7 +2561,11 @@ async def test_delete_operation_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=locations", + ) in kw["metadata"] + def test_delete_operation_from_dict(): client = CloudChannelReportsServiceClient( @@ -2268,6 +2582,8 @@ def test_delete_operation_from_dict(): } ) call.assert_called() + + @pytest.mark.asyncio async def test_delete_operation_from_dict_async(): client = CloudChannelReportsServiceAsyncClient( @@ -2276,9 +2592,7 @@ async def test_delete_operation_from_dict_async(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_operation), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) response = await client.delete_operation( request={ "name": "locations", @@ -2289,7 +2603,8 @@ async def test_delete_operation_from_dict_async(): def test_cancel_operation(transport: str = "grpc"): client = CloudChannelReportsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2308,10 +2623,13 @@ def test_cancel_operation(transport: str = "grpc"): # Establish that the response is the type that we expect. assert response is None + + @pytest.mark.asyncio async def test_cancel_operation_async(transport: str = "grpc"): client = CloudChannelReportsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2321,9 +2639,7 @@ async def test_cancel_operation_async(transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) response = await client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -2333,6 +2649,7 @@ async def test_cancel_operation_async(transport: str = "grpc"): # Establish that the response is the type that we expect. assert response is None + def test_cancel_operation_field_headers(): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2345,7 +2662,7 @@ def test_cancel_operation_field_headers(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - call.return_value = None + call.return_value = None client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. @@ -2355,7 +2672,12 @@ def test_cancel_operation_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=locations", + ) in kw["metadata"] + + @pytest.mark.asyncio async def test_cancel_operation_field_headers_async(): client = CloudChannelReportsServiceAsyncClient( @@ -2369,9 +2691,7 @@ async def test_cancel_operation_field_headers_async(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.cancel_operation(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -2380,7 +2700,11 @@ async def test_cancel_operation_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=locations", + ) in kw["metadata"] + def test_cancel_operation_from_dict(): client = CloudChannelReportsServiceClient( @@ -2397,6 +2721,8 @@ def test_cancel_operation_from_dict(): } ) call.assert_called() + + @pytest.mark.asyncio async def test_cancel_operation_from_dict_async(): client = CloudChannelReportsServiceAsyncClient( @@ -2405,9 +2731,7 @@ async def test_cancel_operation_from_dict_async(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - None - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) response = await client.cancel_operation( request={ "name": "locations", @@ -2418,7 +2742,8 @@ async def test_cancel_operation_from_dict_async(): def test_get_operation(transport: str = "grpc"): client = CloudChannelReportsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2437,10 +2762,13 @@ def test_get_operation(transport: str = "grpc"): # Establish that the response is the type that we expect. assert isinstance(response, operations_pb2.Operation) + + @pytest.mark.asyncio async def test_get_operation_async(transport: str = "grpc"): client = CloudChannelReportsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2462,6 +2790,7 @@ async def test_get_operation_async(transport: str = "grpc"): # Establish that the response is the type that we expect. assert isinstance(response, operations_pb2.Operation) + def test_get_operation_field_headers(): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2484,7 +2813,12 @@ def test_get_operation_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=locations", + ) in kw["metadata"] + + @pytest.mark.asyncio async def test_get_operation_field_headers_async(): client = CloudChannelReportsServiceAsyncClient( @@ -2509,7 +2843,11 @@ async def test_get_operation_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=locations", + ) in kw["metadata"] + def test_get_operation_from_dict(): client = CloudChannelReportsServiceClient( @@ -2526,6 +2864,8 @@ def test_get_operation_from_dict(): } ) call.assert_called() + + @pytest.mark.asyncio async def test_get_operation_from_dict_async(): client = CloudChannelReportsServiceAsyncClient( @@ -2547,7 +2887,8 @@ async def test_get_operation_from_dict_async(): def test_list_operations(transport: str = "grpc"): client = CloudChannelReportsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2566,10 +2907,13 @@ def test_list_operations(transport: str = "grpc"): # Establish that the response is the type that we expect. assert isinstance(response, operations_pb2.ListOperationsResponse) + + @pytest.mark.asyncio async def test_list_operations_async(transport: str = "grpc"): client = CloudChannelReportsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2591,6 +2935,7 @@ async def test_list_operations_async(transport: str = "grpc"): # Establish that the response is the type that we expect. assert isinstance(response, operations_pb2.ListOperationsResponse) + def test_list_operations_field_headers(): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2613,7 +2958,12 @@ def test_list_operations_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=locations", + ) in kw["metadata"] + + @pytest.mark.asyncio async def test_list_operations_field_headers_async(): client = CloudChannelReportsServiceAsyncClient( @@ -2638,7 +2988,11 @@ async def test_list_operations_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=locations",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=locations", + ) in kw["metadata"] + def test_list_operations_from_dict(): client = CloudChannelReportsServiceClient( @@ -2655,6 +3009,8 @@ def test_list_operations_from_dict(): } ) call.assert_called() + + @pytest.mark.asyncio async def test_list_operations_from_dict_async(): client = CloudChannelReportsServiceAsyncClient( @@ -2681,22 +3037,23 @@ def test_transport_close(): for transport, close_name in transports.items(): client = CloudChannelReportsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) - with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: with client: close.assert_not_called() close.assert_called_once() + def test_client_ctx(): transports = [ - 'grpc', + "grpc", ] for transport in transports: client = CloudChannelReportsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport + credentials=ga_credentials.AnonymousCredentials(), transport=transport ) # Test client calls underlying transport. with mock.patch.object(type(client.transport), "close") as close: @@ -2705,10 +3062,20 @@ def test_client_ctx(): pass close.assert_called() -@pytest.mark.parametrize("client_class,transport_class", [ - (CloudChannelReportsServiceClient, transports.CloudChannelReportsServiceGrpcTransport), - (CloudChannelReportsServiceAsyncClient, transports.CloudChannelReportsServiceGrpcAsyncIOTransport), -]) + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + ( + CloudChannelReportsServiceClient, + transports.CloudChannelReportsServiceGrpcTransport, + ), + ( + CloudChannelReportsServiceAsyncClient, + transports.CloudChannelReportsServiceGrpcAsyncIOTransport, + ), + ], +) def test_api_key_credentials(client_class, transport_class): with mock.patch.object( google.auth._default, "get_api_key_credentials", create=True