diff --git a/.coveragerc b/.coveragerc index 81825cf..92f648e 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,6 +5,7 @@ branch = True show_missing = True omit = google/cloud/channel/__init__.py + google/cloud/channel/gapic_version.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 889f77d..b8edda5 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320 + digest: sha256:2e247c7bf5154df7f98cce087a20ca7605e236340c7d6d1a14447e5c06791bd6 diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in index cbd7e77..ec867d9 100644 --- a/.kokoro/requirements.in +++ b/.kokoro/requirements.in @@ -1,10 +1,10 @@ gcp-docuploader -gcp-releasetool +gcp-releasetool>=1.10.5 # required for compatibility with cryptography>=39.x importlib-metadata typing-extensions twine wheel setuptools -nox +nox>=2022.11.21 # required to remove dependency on py charset-normalizer<3 click<8.1.0 diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 05dc467..66a2172 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -1,6 +1,6 @@ # -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: # # pip-compile --allow-unsafe --generate-hashes requirements.in # @@ -113,33 +113,28 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==38.0.3 \ - --hash=sha256:068147f32fa662c81aebab95c74679b401b12b57494872886eb5c1139250ec5d \ - --hash=sha256:06fc3cc7b6f6cca87bd56ec80a580c88f1da5306f505876a71c8cfa7050257dd \ - --hash=sha256:25c1d1f19729fb09d42e06b4bf9895212292cb27bb50229f5aa64d039ab29146 \ - --hash=sha256:402852a0aea73833d982cabb6d0c3bb582c15483d29fb7085ef2c42bfa7e38d7 \ - --hash=sha256:4e269dcd9b102c5a3d72be3c45d8ce20377b8076a43cbed6f660a1afe365e436 \ - --hash=sha256:5419a127426084933076132d317911e3c6eb77568a1ce23c3ac1e12d111e61e0 \ - --hash=sha256:554bec92ee7d1e9d10ded2f7e92a5d70c1f74ba9524947c0ba0c850c7b011828 \ - --hash=sha256:5e89468fbd2fcd733b5899333bc54d0d06c80e04cd23d8c6f3e0542358c6060b \ - --hash=sha256:65535bc550b70bd6271984d9863a37741352b4aad6fb1b3344a54e6950249b55 \ - --hash=sha256:6ab9516b85bebe7aa83f309bacc5f44a61eeb90d0b4ec125d2d003ce41932d36 \ - --hash=sha256:6addc3b6d593cd980989261dc1cce38263c76954d758c3c94de51f1e010c9a50 \ - --hash=sha256:728f2694fa743a996d7784a6194da430f197d5c58e2f4e278612b359f455e4a2 \ - --hash=sha256:785e4056b5a8b28f05a533fab69febf5004458e20dad7e2e13a3120d8ecec75a \ - --hash=sha256:78cf5eefac2b52c10398a42765bfa981ce2372cbc0457e6bf9658f41ec3c41d8 \ - --hash=sha256:7f836217000342d448e1c9a342e9163149e45d5b5eca76a30e84503a5a96cab0 \ - --hash=sha256:8d41a46251bf0634e21fac50ffd643216ccecfaf3701a063257fe0b2be1b6548 \ - --hash=sha256:984fe150f350a3c91e84de405fe49e688aa6092b3525f407a18b9646f6612320 \ - --hash=sha256:9b24bcff7853ed18a63cfb0c2b008936a9554af24af2fb146e16d8e1aed75748 \ - --hash=sha256:b1b35d9d3a65542ed2e9d90115dfd16bbc027b3f07ee3304fc83580f26e43249 \ - --hash=sha256:b1b52c9e5f8aa2b802d48bd693190341fae201ea51c7a167d69fc48b60e8a959 \ - --hash=sha256:bbf203f1a814007ce24bd4d51362991d5cb90ba0c177a9c08825f2cc304d871f \ - --hash=sha256:be243c7e2bfcf6cc4cb350c0d5cdf15ca6383bbcb2a8ef51d3c9411a9d4386f0 \ - --hash=sha256:bfbe6ee19615b07a98b1d2287d6a6073f734735b49ee45b11324d85efc4d5cbd \ - --hash=sha256:c46837ea467ed1efea562bbeb543994c2d1f6e800785bd5a2c98bc096f5cb220 \ - --hash=sha256:dfb4f4dd568de1b6af9f4cda334adf7d72cf5bc052516e1b2608b683375dd95c \ - --hash=sha256:ed7b00096790213e09eb11c97cc6e2b757f15f3d2f85833cd2d3ec3fe37c1722 +cryptography==39.0.1 \ + --hash=sha256:0f8da300b5c8af9f98111ffd512910bc792b4c77392a9523624680f7956a99d4 \ + --hash=sha256:35f7c7d015d474f4011e859e93e789c87d21f6f4880ebdc29896a60403328f1f \ + --hash=sha256:5aa67414fcdfa22cf052e640cb5ddc461924a045cacf325cd164e65312d99502 \ + --hash=sha256:5d2d8b87a490bfcd407ed9d49093793d0f75198a35e6eb1a923ce1ee86c62b41 \ + --hash=sha256:6687ef6d0a6497e2b58e7c5b852b53f62142cfa7cd1555795758934da363a965 \ + --hash=sha256:6f8ba7f0328b79f08bdacc3e4e66fb4d7aab0c3584e0bd41328dce5262e26b2e \ + --hash=sha256:706843b48f9a3f9b9911979761c91541e3d90db1ca905fd63fee540a217698bc \ + --hash=sha256:807ce09d4434881ca3a7594733669bd834f5b2c6d5c7e36f8c00f691887042ad \ + --hash=sha256:83e17b26de248c33f3acffb922748151d71827d6021d98c70e6c1a25ddd78505 \ + --hash=sha256:96f1157a7c08b5b189b16b47bc9db2332269d6680a196341bf30046330d15388 \ + --hash=sha256:aec5a6c9864be7df2240c382740fcf3b96928c46604eaa7f3091f58b878c0bb6 \ + --hash=sha256:b0afd054cd42f3d213bf82c629efb1ee5f22eba35bf0eec88ea9ea7304f511a2 \ + --hash=sha256:ced4e447ae29ca194449a3f1ce132ded8fcab06971ef5f618605aacaa612beac \ + --hash=sha256:d1f6198ee6d9148405e49887803907fe8962a23e6c6f83ea7d98f1c0de375695 \ + --hash=sha256:e124352fd3db36a9d4a21c1aa27fd5d051e621845cb87fb851c08f4f75ce8be6 \ + --hash=sha256:e422abdec8b5fa8462aa016786680720d78bdce7a30c652b7fadf83a4ba35336 \ + --hash=sha256:ef8b72fa70b348724ff1218267e7f7375b8de4e8194d1636ee60510aae104cd0 \ + --hash=sha256:f0c64d1bd842ca2633e74a1a28033d139368ad959872533b1bab8c80e8240a0c \ + --hash=sha256:f24077a3b5298a5a06a8e0536e3ea9ec60e4c7ac486755e5fb6e6ea9b3500106 \ + --hash=sha256:fdd188c8a6ef8769f148f88f859884507b954cc64db6b52f66ef199bb9ad660a \ + --hash=sha256:fe913f20024eb2cb2f323e42a64bdf2911bb9738a15dba7d3cce48151034e3a8 # via # gcp-releasetool # secretstorage @@ -159,9 +154,9 @@ gcp-docuploader==0.6.4 \ --hash=sha256:01486419e24633af78fd0167db74a2763974765ee8078ca6eb6964d0ebd388af \ --hash=sha256:70861190c123d907b3b067da896265ead2eeb9263969d6955c9e0bb091b5ccbf # via -r requirements.in -gcp-releasetool==1.10.0 \ - --hash=sha256:72a38ca91b59c24f7e699e9227c90cbe4dd71b789383cb0164b088abae294c83 \ - --hash=sha256:8c7c99320208383d4bb2b808c6880eb7a81424afe7cdba3c8d84b25f4f0e097d +gcp-releasetool==1.10.5 \ + --hash=sha256:174b7b102d704b254f2a26a3eda2c684fd3543320ec239baf771542a2e58e109 \ + --hash=sha256:e29d29927fe2ca493105a82958c6873bb2b90d503acac56be2c229e74de0eec9 # via -r requirements.in google-api-core==2.10.2 \ --hash=sha256:10c06f7739fe57781f87523375e8e1a3a4674bf6392cd6131a3222182b971320 \ @@ -340,9 +335,9 @@ more-itertools==9.0.0 \ --hash=sha256:250e83d7e81d0c87ca6bd942e6aeab8cc9daa6096d12c5308f3f92fa5e5c1f41 \ --hash=sha256:5a6257e40878ef0520b1803990e3e22303a41b5714006c32a3fd8304b26ea1ab # via jaraco-classes -nox==2022.8.7 \ - --hash=sha256:1b894940551dc5c389f9271d197ca5d655d40bdc6ccf93ed6880e4042760a34b \ - --hash=sha256:96cca88779e08282a699d672258ec01eb7c792d35bbbf538c723172bce23212c +nox==2022.11.21 \ + --hash=sha256:0e41a990e290e274cb205a976c4c97ee3c5234441a8132c8c3fd9ea3c22149eb \ + --hash=sha256:e21c31de0711d1274ca585a2c5fde36b1aa962005ba8e9322bf5eeed16dcd684 # via -r requirements.in packaging==21.3 \ --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ @@ -385,10 +380,6 @@ protobuf==3.20.3 \ # gcp-docuploader # gcp-releasetool # google-api-core -py==1.11.0 \ - --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ - --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 - # via nox pyasn1==0.4.8 \ --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 87f5de0..23860f9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.12.1" + ".": "1.13.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e82b0ed..517f6c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.13.0](https://github.com/googleapis/python-channel/compare/v1.12.1...v1.13.0) (2023-03-16) + + +### Features + +* Add ListEntitlementChanges ([da4f098](https://github.com/googleapis/python-channel/commit/da4f0983e2aed026f66190c55f52d4545eda0769)) +* Add show_future_offers to ListOffers ([da4f098](https://github.com/googleapis/python-channel/commit/da4f0983e2aed026f66190c55f52d4545eda0769)) + ## [1.12.1](https://github.com/googleapis/python-channel/compare/v1.12.0...v1.12.1) (2023-01-20) diff --git a/google/cloud/channel/__init__.py b/google/cloud/channel/__init__.py index aaa54f1..566a24a 100644 --- a/google/cloud/channel/__init__.py +++ b/google/cloud/channel/__init__.py @@ -42,6 +42,7 @@ Value, ) from google.cloud.channel_v1.types.customers import ContactInfo, Customer +from google.cloud.channel_v1.types.entitlement_changes import EntitlementChange from google.cloud.channel_v1.types.entitlements import ( AssociationInfo, CommitmentSettings, @@ -136,6 +137,8 @@ ListCustomerRepricingConfigsResponse, ListCustomersRequest, ListCustomersResponse, + ListEntitlementChangesRequest, + ListEntitlementChangesResponse, ListEntitlementsRequest, ListEntitlementsResponse, ListOffersRequest, @@ -193,6 +196,7 @@ "Value", "ContactInfo", "Customer", + "EntitlementChange", "AssociationInfo", "CommitmentSettings", "Entitlement", @@ -276,6 +280,8 @@ "ListCustomerRepricingConfigsResponse", "ListCustomersRequest", "ListCustomersResponse", + "ListEntitlementChangesRequest", + "ListEntitlementChangesResponse", "ListEntitlementsRequest", "ListEntitlementsResponse", "ListOffersRequest", diff --git a/google/cloud/channel/gapic_version.py b/google/cloud/channel/gapic_version.py index 0d065af..1fc1b24 100644 --- a/google/cloud/channel/gapic_version.py +++ b/google/cloud/channel/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.12.1" # {x-release-please-version} +__version__ = "1.13.0" # {x-release-please-version} diff --git a/google/cloud/channel_v1/__init__.py b/google/cloud/channel_v1/__init__.py index 918b540..400611e 100644 --- a/google/cloud/channel_v1/__init__.py +++ b/google/cloud/channel_v1/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from google.cloud.channel import gapic_version as package_version +from google.cloud.channel_v1 import gapic_version as package_version __version__ = package_version.__version__ @@ -33,6 +33,7 @@ ) from .types.common import AdminUser, CloudIdentityInfo, EduData, Value from .types.customers import ContactInfo, Customer +from .types.entitlement_changes import EntitlementChange from .types.entitlements import ( AssociationInfo, CommitmentSettings, @@ -121,6 +122,8 @@ ListCustomerRepricingConfigsResponse, ListCustomersRequest, ListCustomersResponse, + ListEntitlementChangesRequest, + ListEntitlementChangesResponse, ListEntitlementsRequest, ListEntitlementsResponse, ListOffersRequest, @@ -200,6 +203,7 @@ "DeleteCustomerRequest", "EduData", "Entitlement", + "EntitlementChange", "EntitlementEvent", "FetchReportResultsRequest", "FetchReportResultsResponse", @@ -217,6 +221,8 @@ "ListCustomerRepricingConfigsResponse", "ListCustomersRequest", "ListCustomersResponse", + "ListEntitlementChangesRequest", + "ListEntitlementChangesResponse", "ListEntitlementsRequest", "ListEntitlementsResponse", "ListOffersRequest", diff --git a/google/cloud/channel_v1/gapic_metadata.json b/google/cloud/channel_v1/gapic_metadata.json index aff1a2d..aec2806 100644 --- a/google/cloud/channel_v1/gapic_metadata.json +++ b/google/cloud/channel_v1/gapic_metadata.json @@ -174,6 +174,11 @@ "list_customers" ] }, + "ListEntitlementChanges": { + "methods": [ + "list_entitlement_changes" + ] + }, "ListEntitlements": { "methods": [ "list_entitlements" @@ -404,6 +409,11 @@ "list_customers" ] }, + "ListEntitlementChanges": { + "methods": [ + "list_entitlement_changes" + ] + }, "ListEntitlements": { "methods": [ "list_entitlements" diff --git a/google/cloud/channel_v1/gapic_version.py b/google/cloud/channel_v1/gapic_version.py index 0d065af..1fc1b24 100644 --- a/google/cloud/channel_v1/gapic_version.py +++ b/google/cloud/channel_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.12.1" # {x-release-please-version} +__version__ = "1.13.0" # {x-release-please-version} 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 cc56558..965393a 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 @@ -54,6 +54,7 @@ channel_partner_links, common, customers, + entitlement_changes, entitlements, offers, operations, @@ -5530,6 +5531,141 @@ async def sample_list_subscribers(): # Done; return the response. return response + async def list_entitlement_changes( + self, + request: Optional[Union[service.ListEntitlementChangesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEntitlementChangesAsyncPager: + r"""List entitlement history. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different. + - INVALID_ARGUMENT: Missing or invalid required fields in the + request. + - NOT_FOUND: The parent resource doesn't exist. Usually the + result of an invalid name parameter. + - INTERNAL: Any non-user error related to a technical issue in + the backend. In this case, contact CloudChannel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. In this case, contact Cloud Channel support. + + Return value: List of + [EntitlementChange][google.cloud.channel.v1.EntitlementChange]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_entitlement_changes(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListEntitlementChangesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_entitlement_changes(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.channel_v1.types.ListEntitlementChangesRequest, dict]]): + The request object. Request message for + [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + parent (:class:`str`): + Required. The resource name of the entitlement for which + to list entitlement changes. The ``-`` wildcard may be + used to match entitlements across a customer. Formats: + + - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + - accounts/{account_id}/customers/{customer_id}/entitlements/- + + 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.ListEntitlementChangesAsyncPager: + Response message for + [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + + 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.ListEntitlementChangesRequest(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_entitlement_changes, + 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.ListEntitlementChangesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + async def list_operations( self, request: Optional[operations_pb2.ListOperationsRequest] = None, 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 36f34de..34e0238 100644 --- a/google/cloud/channel_v1/services/cloud_channel_service/client.py +++ b/google/cloud/channel_v1/services/cloud_channel_service/client.py @@ -58,6 +58,7 @@ channel_partner_links, common, customers, + entitlement_changes, entitlements, offers, operations, @@ -5927,6 +5928,141 @@ def sample_list_subscribers(): # Done; return the response. return response + def list_entitlement_changes( + self, + request: Optional[Union[service.ListEntitlementChangesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListEntitlementChangesPager: + r"""List entitlement history. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different. + - INVALID_ARGUMENT: Missing or invalid required fields in the + request. + - NOT_FOUND: The parent resource doesn't exist. Usually the + result of an invalid name parameter. + - INTERNAL: Any non-user error related to a technical issue in + the backend. In this case, contact CloudChannel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. In this case, contact Cloud Channel support. + + Return value: List of + [EntitlementChange][google.cloud.channel.v1.EntitlementChange]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_entitlement_changes(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListEntitlementChangesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_entitlement_changes(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.channel_v1.types.ListEntitlementChangesRequest, dict]): + The request object. Request message for + [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + parent (str): + Required. The resource name of the entitlement for which + to list entitlement changes. The ``-`` wildcard may be + used to match entitlements across a customer. Formats: + + - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + - accounts/{account_id}/customers/{customer_id}/entitlements/- + + 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.ListEntitlementChangesPager: + Response message for + [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + + 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.ListEntitlementChangesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, service.ListEntitlementChangesRequest): + request = service.ListEntitlementChangesRequest(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_entitlement_changes] + + # 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.ListEntitlementChangesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + def __enter__(self) -> "CloudChannelServiceClient": return self diff --git a/google/cloud/channel_v1/services/cloud_channel_service/pagers.py b/google/cloud/channel_v1/services/cloud_channel_service/pagers.py index 749b0ef..f497f3d 100644 --- a/google/cloud/channel_v1/services/cloud_channel_service/pagers.py +++ b/google/cloud/channel_v1/services/cloud_channel_service/pagers.py @@ -27,6 +27,7 @@ from google.cloud.channel_v1.types import ( channel_partner_links, customers, + entitlement_changes, entitlements, offers, products, @@ -1703,3 +1704,131 @@ async def async_generator(): def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListEntitlementChangesPager: + """A pager for iterating through ``list_entitlement_changes`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListEntitlementChangesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``entitlement_changes`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListEntitlementChanges`` requests and continue to iterate + through the ``entitlement_changes`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListEntitlementChangesResponse` + 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.ListEntitlementChangesResponse], + request: service.ListEntitlementChangesRequest, + response: service.ListEntitlementChangesResponse, + *, + 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.ListEntitlementChangesRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListEntitlementChangesResponse): + 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.ListEntitlementChangesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListEntitlementChangesResponse]: + 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[entitlement_changes.EntitlementChange]: + for page in self.pages: + yield from page.entitlement_changes + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListEntitlementChangesAsyncPager: + """A pager for iterating through ``list_entitlement_changes`` requests. + + This class thinly wraps an initial + :class:`google.cloud.channel_v1.types.ListEntitlementChangesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``entitlement_changes`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListEntitlementChanges`` requests and continue to iterate + through the ``entitlement_changes`` field on the + corresponding responses. + + All the usual :class:`google.cloud.channel_v1.types.ListEntitlementChangesResponse` + 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.ListEntitlementChangesResponse]], + request: service.ListEntitlementChangesRequest, + response: service.ListEntitlementChangesResponse, + *, + 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.ListEntitlementChangesRequest): + The initial request object. + response (google.cloud.channel_v1.types.ListEntitlementChangesResponse): + 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.ListEntitlementChangesRequest(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.ListEntitlementChangesResponse]: + 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[entitlement_changes.EntitlementChange]: + async def async_generator(): + async for page in self.pages: + for response in page.entitlement_changes: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py b/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py index 53ba26a..186670d 100644 --- a/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py +++ b/google/cloud/channel_v1/services/cloud_channel_service/transports/base.py @@ -356,6 +356,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.list_entitlement_changes: gapic_v1.method.wrap_method( + self.list_entitlement_changes, + default_timeout=None, + client_info=client_info, + ), } def close(self): @@ -838,6 +843,18 @@ def list_subscribers( ]: raise NotImplementedError() + @property + def list_entitlement_changes( + self, + ) -> Callable[ + [service.ListEntitlementChangesRequest], + Union[ + service.ListEntitlementChangesResponse, + Awaitable[service.ListEntitlementChangesResponse], + ], + ]: + raise NotImplementedError() + @property def list_operations( self, 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 d3b2c78..a300161 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 @@ -2450,6 +2450,50 @@ def list_subscribers( ) return self._stubs["list_subscribers"] + @property + def list_entitlement_changes( + self, + ) -> Callable[ + [service.ListEntitlementChangesRequest], service.ListEntitlementChangesResponse + ]: + r"""Return a callable for the list entitlement changes method over gRPC. + + List entitlement history. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different. + - INVALID_ARGUMENT: Missing or invalid required fields in the + request. + - NOT_FOUND: The parent resource doesn't exist. Usually the + result of an invalid name parameter. + - INTERNAL: Any non-user error related to a technical issue in + the backend. In this case, contact CloudChannel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. In this case, contact Cloud Channel support. + + Return value: List of + [EntitlementChange][google.cloud.channel.v1.EntitlementChange]s. + + Returns: + Callable[[~.ListEntitlementChangesRequest], + ~.ListEntitlementChangesResponse]: + 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_entitlement_changes" not in self._stubs: + self._stubs["list_entitlement_changes"] = self.grpc_channel.unary_unary( + "/google.cloud.channel.v1.CloudChannelService/ListEntitlementChanges", + request_serializer=service.ListEntitlementChangesRequest.serialize, + response_deserializer=service.ListEntitlementChangesResponse.deserialize, + ) + return self._stubs["list_entitlement_changes"] + def close(self): self.grpc_channel.close() 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 3bf3655..bf62d47 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 @@ -2494,6 +2494,51 @@ def list_subscribers( ) return self._stubs["list_subscribers"] + @property + def list_entitlement_changes( + self, + ) -> Callable[ + [service.ListEntitlementChangesRequest], + Awaitable[service.ListEntitlementChangesResponse], + ]: + r"""Return a callable for the list entitlement changes method over gRPC. + + List entitlement history. + + Possible error codes: + + - PERMISSION_DENIED: The reseller account making the request + and the provided reseller account are different. + - INVALID_ARGUMENT: Missing or invalid required fields in the + request. + - NOT_FOUND: The parent resource doesn't exist. Usually the + result of an invalid name parameter. + - INTERNAL: Any non-user error related to a technical issue in + the backend. In this case, contact CloudChannel support. + - UNKNOWN: Any non-user error related to a technical issue in + the backend. In this case, contact Cloud Channel support. + + Return value: List of + [EntitlementChange][google.cloud.channel.v1.EntitlementChange]s. + + Returns: + Callable[[~.ListEntitlementChangesRequest], + Awaitable[~.ListEntitlementChangesResponse]]: + 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_entitlement_changes" not in self._stubs: + self._stubs["list_entitlement_changes"] = self.grpc_channel.unary_unary( + "/google.cloud.channel.v1.CloudChannelService/ListEntitlementChanges", + request_serializer=service.ListEntitlementChangesRequest.serialize, + response_deserializer=service.ListEntitlementChangesResponse.deserialize, + ) + return self._stubs["list_entitlement_changes"] + def close(self): return self.grpc_channel.close() diff --git a/google/cloud/channel_v1/types/__init__.py b/google/cloud/channel_v1/types/__init__.py index 51b82f3..452b2f3 100644 --- a/google/cloud/channel_v1/types/__init__.py +++ b/google/cloud/channel_v1/types/__init__.py @@ -20,6 +20,7 @@ ) from .common import AdminUser, CloudIdentityInfo, EduData, Value from .customers import ContactInfo, Customer +from .entitlement_changes import EntitlementChange from .entitlements import ( AssociationInfo, CommitmentSettings, @@ -108,6 +109,8 @@ ListCustomerRepricingConfigsResponse, ListCustomersRequest, ListCustomersResponse, + ListEntitlementChangesRequest, + ListEntitlementChangesResponse, ListEntitlementsRequest, ListEntitlementsResponse, ListOffersRequest, @@ -157,6 +160,7 @@ "Value", "ContactInfo", "Customer", + "EntitlementChange", "AssociationInfo", "CommitmentSettings", "Entitlement", @@ -240,6 +244,8 @@ "ListCustomerRepricingConfigsResponse", "ListCustomersRequest", "ListCustomersResponse", + "ListEntitlementChangesRequest", + "ListEntitlementChangesResponse", "ListEntitlementsRequest", "ListEntitlementsResponse", "ListOffersRequest", diff --git a/google/cloud/channel_v1/types/channel_partner_links.py b/google/cloud/channel_v1/types/channel_partner_links.py index bb05e55..ce29963 100644 --- a/google/cloud/channel_v1/types/channel_partner_links.py +++ b/google/cloud/channel_v1/types/channel_partner_links.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore diff --git a/google/cloud/channel_v1/types/common.py b/google/cloud/channel_v1/types/common.py index 637d2fb..898284b 100644 --- a/google/cloud/channel_v1/types/common.py +++ b/google/cloud/channel_v1/types/common.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import any_pb2 # type: ignore diff --git a/google/cloud/channel_v1/types/customers.py b/google/cloud/channel_v1/types/customers.py index 3d6ecc6..534c1cc 100644 --- a/google/cloud/channel_v1/types/customers.py +++ b/google/cloud/channel_v1/types/customers.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore @@ -82,6 +84,10 @@ class Customer(proto.Message): Cloud Identity ID of the customer's channel partner. Populated only if a channel partner exists for this customer. + correlation_id (str): + Optional. External CRM ID for the customer. + Populated only if a CRM ID exists for this + customer. """ name: str = proto.Field( @@ -137,6 +143,10 @@ class Customer(proto.Message): proto.STRING, number=13, ) + correlation_id: str = proto.Field( + proto.STRING, + number=14, + ) class ContactInfo(proto.Message): diff --git a/google/cloud/channel_v1/types/entitlement_changes.py b/google/cloud/channel_v1/types/entitlement_changes.py new file mode 100644 index 0000000..ac995c6 --- /dev/null +++ b/google/cloud/channel_v1/types/entitlement_changes.py @@ -0,0 +1,276 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 __future__ import annotations + +from typing import MutableMapping, MutableSequence + +from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore + +from google.cloud.channel_v1.types import entitlements + +__protobuf__ = proto.module( + package="google.cloud.channel.v1", + manifest={ + "EntitlementChange", + }, +) + + +class EntitlementChange(proto.Message): + r"""Change event entry for Entitlement order history + + 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: + suspension_reason (google.cloud.channel_v1.types.Entitlement.SuspensionReason): + Suspension reason for the Entitlement. + + This field is a member of `oneof`_ ``change_reason``. + cancellation_reason (google.cloud.channel_v1.types.EntitlementChange.CancellationReason): + Cancellation reason for the Entitlement. + + This field is a member of `oneof`_ ``change_reason``. + activation_reason (google.cloud.channel_v1.types.EntitlementChange.ActivationReason): + The Entitlement's activation reason + + This field is a member of `oneof`_ ``change_reason``. + other_change_reason (str): + e.g. purchase_number change reason, entered by CRS. + + This field is a member of `oneof`_ ``change_reason``. + entitlement (str): + Required. Resource name of an entitlement in the form: + accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + offer (str): + Required. Resource name of the Offer at the time of change. + Takes the form: accounts/{account_id}/offers/{offer_id}. + provisioned_service (google.cloud.channel_v1.types.ProvisionedService): + Service provisioned for an Entitlement. + change_type (google.cloud.channel_v1.types.EntitlementChange.ChangeType): + The change action type. + create_time (google.protobuf.timestamp_pb2.Timestamp): + The submitted time of the change. + operator_type (google.cloud.channel_v1.types.EntitlementChange.OperatorType): + Operator type responsible for the change. + parameters (MutableSequence[google.cloud.channel_v1.types.Parameter]): + Extended parameters, such as: purchase_order_number, + gcp_details; internal_correlation_id, + long_running_operation_id, order_id; etc. + operator (str): + Human-readable identifier that shows what operator made a + change. When the operator_type is RESELLER, this is the + user's email address. For all other operator types, this is + empty. + """ + + class ChangeType(proto.Enum): + r"""Specifies the type of change action + + Values: + CHANGE_TYPE_UNSPECIFIED (0): + Not used. + CREATED (1): + New Entitlement was created. + PRICE_PLAN_SWITCHED (3): + Price plan associated with an Entitlement was + changed. + COMMITMENT_CHANGED (4): + Number of seats committed for a commitment + Entitlement was changed. + RENEWED (5): + An annual Entitlement was renewed. + SUSPENDED (6): + Entitlement was suspended. + ACTIVATED (7): + Entitlement was activated. + CANCELLED (8): + Entitlement was cancelled. + SKU_CHANGED (9): + Entitlement was upgraded or downgraded for + ex. from Google Workspace Business Standard to + Google Workspace Business Plus. + RENEWAL_SETTING_CHANGED (10): + The settings for renewal of an Entitlement + have changed. + PAID_SUBSCRIPTION_STARTED (11): + Use for Google Workspace subscription. + Either a trial was converted to a paid + subscription or a new subscription with no trial + is created. + LICENSE_CAP_CHANGED (12): + License cap was changed for the entitlement. + SUSPENSION_DETAILS_CHANGED (13): + The suspension details have changed (but it + is still suspended). + TRIAL_END_DATE_EXTENDED (14): + The trial end date was extended. + TRIAL_STARTED (15): + Entitlement started trial. + """ + CHANGE_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_SUBSCRIPTION_STARTED = 11 + LICENSE_CAP_CHANGED = 12 + SUSPENSION_DETAILS_CHANGED = 13 + TRIAL_END_DATE_EXTENDED = 14 + TRIAL_STARTED = 15 + + class OperatorType(proto.Enum): + r"""Specifies the type of operator responsible for the change + + Values: + OPERATOR_TYPE_UNSPECIFIED (0): + Not used. + CUSTOMER_SERVICE_REPRESENTATIVE (1): + Customer service representative. + SYSTEM (2): + System auto job. + CUSTOMER (3): + Customer user. + RESELLER (4): + Reseller user. + """ + OPERATOR_TYPE_UNSPECIFIED = 0 + CUSTOMER_SERVICE_REPRESENTATIVE = 1 + SYSTEM = 2 + CUSTOMER = 3 + RESELLER = 4 + + class CancellationReason(proto.Enum): + r"""Cancellation reason for the entitlement + + Values: + CANCELLATION_REASON_UNSPECIFIED (0): + Not used. + SERVICE_TERMINATED (1): + Reseller triggered a cancellation of the + service. + RELATIONSHIP_ENDED (2): + Relationship between the reseller and + customer has ended due to a transfer. + PARTIAL_TRANSFER (3): + Entitlement transferred away from reseller + while still keeping other entitlement(s) with + the reseller. + """ + CANCELLATION_REASON_UNSPECIFIED = 0 + SERVICE_TERMINATED = 1 + RELATIONSHIP_ENDED = 2 + PARTIAL_TRANSFER = 3 + + class ActivationReason(proto.Enum): + r"""The Entitlement's activation reason + + Values: + ACTIVATION_REASON_UNSPECIFIED (0): + Not used. + RESELLER_REVOKED_SUSPENSION (1): + Reseller reactivated a suspended Entitlement. + CUSTOMER_ACCEPTED_PENDING_TOS (2): + Customer accepted pending terms of service. + RENEWAL_SETTINGS_CHANGED (3): + Reseller updated the renewal settings on an + entitlement that was suspended due to + cancellation, and this update reactivated the + entitlement. + OTHER_ACTIVATION_REASON (100): + Other reasons (Activated temporarily for + cancellation, added a payment plan to a trial + entitlement, etc.) + """ + ACTIVATION_REASON_UNSPECIFIED = 0 + RESELLER_REVOKED_SUSPENSION = 1 + CUSTOMER_ACCEPTED_PENDING_TOS = 2 + RENEWAL_SETTINGS_CHANGED = 3 + OTHER_ACTIVATION_REASON = 100 + + suspension_reason: entitlements.Entitlement.SuspensionReason = proto.Field( + proto.ENUM, + number=9, + oneof="change_reason", + enum=entitlements.Entitlement.SuspensionReason, + ) + cancellation_reason: CancellationReason = proto.Field( + proto.ENUM, + number=10, + oneof="change_reason", + enum=CancellationReason, + ) + activation_reason: ActivationReason = proto.Field( + proto.ENUM, + number=11, + oneof="change_reason", + enum=ActivationReason, + ) + other_change_reason: str = proto.Field( + proto.STRING, + number=100, + oneof="change_reason", + ) + entitlement: str = proto.Field( + proto.STRING, + number=1, + ) + offer: str = proto.Field( + proto.STRING, + number=2, + ) + provisioned_service: entitlements.ProvisionedService = proto.Field( + proto.MESSAGE, + number=3, + message=entitlements.ProvisionedService, + ) + change_type: ChangeType = proto.Field( + proto.ENUM, + number=4, + enum=ChangeType, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + operator_type: OperatorType = proto.Field( + proto.ENUM, + number=6, + enum=OperatorType, + ) + parameters: MutableSequence[entitlements.Parameter] = proto.RepeatedField( + proto.MESSAGE, + number=8, + message=entitlements.Parameter, + ) + operator: str = proto.Field( + proto.STRING, + number=12, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/channel_v1/types/entitlements.py b/google/cloud/channel_v1/types/entitlements.py index 81b4c39..7ef7883 100644 --- a/google/cloud/channel_v1/types/entitlements.py +++ b/google/cloud/channel_v1/types/entitlements.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore @@ -86,16 +88,26 @@ class Entitlement(proto.Message): 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. + For Google Workspace, the following Parameters may be + accepted as input: - max_units: The maximum assignable units for a flexible - offer. + offer + + OR - num_units: The total commitment for commitment-based - offers. + offers + + The response may additionally include the following + output-only Parameters: + + - assigned_units: The number of licenses assigned to users. + + For GCP billing subaccounts, the following Parameter may be + accepted as input: + + - display_name: The display name of the billing subaccount. """ class ProvisioningState(proto.Enum): diff --git a/google/cloud/channel_v1/types/offers.py b/google/cloud/channel_v1/types/offers.py index fbd4e39..c098970 100644 --- a/google/cloud/channel_v1/types/offers.py +++ b/google/cloud/channel_v1/types/offers.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore diff --git a/google/cloud/channel_v1/types/operations.py b/google/cloud/channel_v1/types/operations.py index cd11941..227dd22 100644 --- a/google/cloud/channel_v1/types/operations.py +++ b/google/cloud/channel_v1/types/operations.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/google/cloud/channel_v1/types/products.py b/google/cloud/channel_v1/types/products.py index 5ec2a4d..0ece241 100644 --- a/google/cloud/channel_v1/types/products.py +++ b/google/cloud/channel_v1/types/products.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/google/cloud/channel_v1/types/reports_service.py b/google/cloud/channel_v1/types/reports_service.py index bfdd52b..6ab8f87 100644 --- a/google/cloud/channel_v1/types/reports_service.py +++ b/google/cloud/channel_v1/types/reports_service.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore diff --git a/google/cloud/channel_v1/types/repricing.py b/google/cloud/channel_v1/types/repricing.py index 599808f..4bbbca0 100644 --- a/google/cloud/channel_v1/types/repricing.py +++ b/google/cloud/channel_v1/types/repricing.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore diff --git a/google/cloud/channel_v1/types/service.py b/google/cloud/channel_v1/types/service.py index 8830753..4d5e2e1 100644 --- a/google/cloud/channel_v1/types/service.py +++ b/google/cloud/channel_v1/types/service.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence from google.protobuf import field_mask_pb2 # type: ignore @@ -21,6 +23,7 @@ from google.cloud.channel_v1.types import ( channel_partner_links as gcc_channel_partner_links, ) +from google.cloud.channel_v1.types import entitlement_changes as gcc_entitlement_changes 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 @@ -97,6 +100,8 @@ "UnregisterSubscriberResponse", "ListSubscribersRequest", "ListSubscribersResponse", + "ListEntitlementChangesRequest", + "ListEntitlementChangesResponse", }, ) @@ -1915,6 +1920,11 @@ class ListOffersRequest(proto.Message): example, "en-US". The response will localize in the corresponding language code, if specified. The default value is "en-US". + show_future_offers (bool): + Optional. A boolean flag that determines if a response + returns future offers 30 days from now. If the + show_future_offers is true, the response will only contain + offers that are scheduled to be available 30 days from now. """ parent: str = proto.Field( @@ -1937,6 +1947,10 @@ class ListOffersRequest(proto.Message): proto.STRING, number=5, ) + show_future_offers: bool = proto.Field( + proto.BOOL, + number=7, + ) class ListOffersResponse(proto.Message): @@ -2418,4 +2432,81 @@ def raw_page(self): ) +class ListEntitlementChangesRequest(proto.Message): + r"""Request message for + [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + + Attributes: + parent (str): + Required. The resource name of the entitlement for which to + list entitlement changes. The ``-`` wildcard may be used to + match entitlements across a customer. Formats: + + - accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + - accounts/{account_id}/customers/{customer_id}/entitlements/- + page_size (int): + Optional. The maximum number of entitlement + changes to return. The service may return fewer + than this value. If unspecified, returns at most + 10 entitlement changes. The maximum value is 50; + the server will coerce values above 50. + page_token (str): + Optional. A page token, received from a previous + [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + call. Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to + [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + must match the call that provided the page token. + filter (str): + Optional. Filters applied to the list + results. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + + +class ListEntitlementChangesResponse(proto.Message): + r"""Response message for + [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + + Attributes: + entitlement_changes (MutableSequence[google.cloud.channel_v1.types.EntitlementChange]): + The list of entitlement changes. + next_page_token (str): + A token to list the next page of results. + """ + + @property + def raw_page(self): + return self + + entitlement_changes: MutableSequence[ + gcc_entitlement_changes.EntitlementChange + ] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gcc_entitlement_changes.EntitlementChange, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/channel_v1/types/subscriber_event.py b/google/cloud/channel_v1/types/subscriber_event.py index 8397a87..04a119a 100644 --- a/google/cloud/channel_v1/types/subscriber_event.py +++ b/google/cloud/channel_v1/types/subscriber_event.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations + from typing import MutableMapping, MutableSequence import proto # type: ignore diff --git a/noxfile.py b/noxfile.py index e716318..95e58c5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -189,9 +189,9 @@ def unit(session): def install_systemtest_dependencies(session, *constraints): # Use pre-release gRPC for system tests. - # Exclude version 1.49.0rc1 which has a known issue. - # See https://github.com/grpc/grpc/pull/30642 - session.install("--pre", "grpcio!=1.49.0rc1") + # Exclude version 1.52.0rc1 which has a known issue. + # See https://github.com/grpc/grpc/issues/32163 + session.install("--pre", "grpcio!=1.52.0rc1") session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) @@ -346,9 +346,7 @@ def prerelease_deps(session): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS + SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES ) session.install(*system_deps_all) @@ -378,8 +376,8 @@ def prerelease_deps(session): # dependency of grpc "six", "googleapis-common-protos", - # Exclude version 1.49.0rc1 which has a known issue. See https://github.com/grpc/grpc/pull/30642 - "grpcio!=1.49.0rc1", + # Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163 + "grpcio!=1.52.0rc1", "grpcio-status", "google-api-core", "proto-plus", diff --git a/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlement_changes_async.py b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlement_changes_async.py new file mode 100644 index 0000000..079a9c9 --- /dev/null +++ b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlement_changes_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 ListEntitlementChanges +# 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_ListEntitlementChanges_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_entitlement_changes(): + # Create a client + client = channel_v1.CloudChannelServiceAsyncClient() + + # Initialize request argument(s) + request = channel_v1.ListEntitlementChangesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_entitlement_changes(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListEntitlementChanges_async] diff --git a/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlement_changes_sync.py b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlement_changes_sync.py new file mode 100644 index 0000000..fa7c959 --- /dev/null +++ b/samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_entitlement_changes_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 ListEntitlementChanges +# 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_ListEntitlementChanges_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_entitlement_changes(): + # Create a client + client = channel_v1.CloudChannelServiceClient() + + # Initialize request argument(s) + request = channel_v1.ListEntitlementChangesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_entitlement_changes(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudchannel_v1_generated_CloudChannelService_ListEntitlementChanges_sync] diff --git a/samples/generated_samples/snippet_metadata_google.cloud.channel.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.channel.v1.json index 5429b84..da1f15d 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.channel.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.channel.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-channel", - "version": "1.12.1" + "version": "1.13.0" }, "snippets": [ { @@ -4236,6 +4236,167 @@ ], "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_entitlement_changes", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListEntitlementChanges" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListEntitlementChangesRequest" + }, + { + "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.ListEntitlementChangesAsyncPager", + "shortName": "list_entitlement_changes" + }, + "description": "Sample for ListEntitlementChanges", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_entitlement_changes_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListEntitlementChanges_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_entitlement_changes_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient", + "shortName": "CloudChannelServiceClient" + }, + "fullName": "google.cloud.channel_v1.CloudChannelServiceClient.list_entitlement_changes", + "method": { + "fullName": "google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges", + "service": { + "fullName": "google.cloud.channel.v1.CloudChannelService", + "shortName": "CloudChannelService" + }, + "shortName": "ListEntitlementChanges" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.channel_v1.types.ListEntitlementChangesRequest" + }, + { + "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.ListEntitlementChangesPager", + "shortName": "list_entitlement_changes" + }, + "description": "Sample for ListEntitlementChanges", + "file": "cloudchannel_v1_generated_cloud_channel_service_list_entitlement_changes_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "cloudchannel_v1_generated_CloudChannelService_ListEntitlementChanges_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_entitlement_changes_sync.py" + }, { "canonical": true, "clientMethod": { diff --git a/scripts/fixup_channel_v1_keywords.py b/scripts/fixup_channel_v1_keywords.py index 643b44c..407379c 100644 --- a/scripts/fixup_channel_v1_keywords.py +++ b/scripts/fixup_channel_v1_keywords.py @@ -64,8 +64,9 @@ class channelCallTransformer(cst.CSTTransformer): '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_entitlement_changes': ('parent', 'page_size', 'page_token', 'filter', ), 'list_entitlements': ('parent', 'page_size', 'page_token', ), - 'list_offers': ('parent', 'page_size', 'page_token', 'filter', 'language_code', ), + 'list_offers': ('parent', 'page_size', 'page_token', 'filter', 'language_code', 'show_future_offers', ), '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', ), diff --git a/setup.py b/setup.py index aa068ab..1e17713 100644 --- a/setup.py +++ b/setup.py @@ -55,9 +55,7 @@ if package.startswith("google") ] -namespaces = ["google"] -if "google.cloud" in packages: - namespaces.append("google.cloud") +namespaces = ["google", "google.cloud"] setuptools.setup( name=name, diff --git a/tests/unit/gapic/channel_v1/test_cloud_channel_service.py b/tests/unit/gapic/channel_v1/test_cloud_channel_service.py index c04a214..4a8ddc4 100644 --- a/tests/unit/gapic/channel_v1/test_cloud_channel_service.py +++ b/tests/unit/gapic/channel_v1/test_cloud_channel_service.py @@ -64,6 +64,7 @@ channel_partner_links, common, customers, + entitlement_changes, entitlements, offers, operations, @@ -1096,6 +1097,7 @@ def test_get_customer(request_type, transport: str = "grpc"): cloud_identity_id="cloud_identity_id_value", language_code="language_code_value", channel_partner_id="channel_partner_id_value", + correlation_id="correlation_id_value", ) response = client.get_customer(request) @@ -1113,6 +1115,7 @@ def test_get_customer(request_type, transport: str = "grpc"): 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" + assert response.correlation_id == "correlation_id_value" def test_get_customer_empty_call(): @@ -1156,6 +1159,7 @@ async def test_get_customer_async( cloud_identity_id="cloud_identity_id_value", language_code="language_code_value", channel_partner_id="channel_partner_id_value", + correlation_id="correlation_id_value", ) ) response = await client.get_customer(request) @@ -1174,6 +1178,7 @@ async def test_get_customer_async( 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" + assert response.correlation_id == "correlation_id_value" @pytest.mark.asyncio @@ -1503,6 +1508,7 @@ def test_create_customer(request_type, transport: str = "grpc"): cloud_identity_id="cloud_identity_id_value", language_code="language_code_value", channel_partner_id="channel_partner_id_value", + correlation_id="correlation_id_value", ) response = client.create_customer(request) @@ -1520,6 +1526,7 @@ def test_create_customer(request_type, transport: str = "grpc"): 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" + assert response.correlation_id == "correlation_id_value" def test_create_customer_empty_call(): @@ -1563,6 +1570,7 @@ async def test_create_customer_async( cloud_identity_id="cloud_identity_id_value", language_code="language_code_value", channel_partner_id="channel_partner_id_value", + correlation_id="correlation_id_value", ) ) response = await client.create_customer(request) @@ -1581,6 +1589,7 @@ async def test_create_customer_async( 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" + assert response.correlation_id == "correlation_id_value" @pytest.mark.asyncio @@ -1675,6 +1684,7 @@ def test_update_customer(request_type, transport: str = "grpc"): cloud_identity_id="cloud_identity_id_value", language_code="language_code_value", channel_partner_id="channel_partner_id_value", + correlation_id="correlation_id_value", ) response = client.update_customer(request) @@ -1692,6 +1702,7 @@ def test_update_customer(request_type, transport: str = "grpc"): 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" + assert response.correlation_id == "correlation_id_value" def test_update_customer_empty_call(): @@ -1735,6 +1746,7 @@ async def test_update_customer_async( cloud_identity_id="cloud_identity_id_value", language_code="language_code_value", channel_partner_id="channel_partner_id_value", + correlation_id="correlation_id_value", ) ) response = await client.update_customer(request) @@ -1753,6 +1765,7 @@ async def test_update_customer_async( 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" + assert response.correlation_id == "correlation_id_value" @pytest.mark.asyncio @@ -2067,6 +2080,7 @@ def test_import_customer(request_type, transport: str = "grpc"): cloud_identity_id="cloud_identity_id_value", language_code="language_code_value", channel_partner_id="channel_partner_id_value", + correlation_id="correlation_id_value", ) response = client.import_customer(request) @@ -2084,6 +2098,7 @@ def test_import_customer(request_type, transport: str = "grpc"): 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" + assert response.correlation_id == "correlation_id_value" def test_import_customer_empty_call(): @@ -2127,6 +2142,7 @@ async def test_import_customer_async( cloud_identity_id="cloud_identity_id_value", language_code="language_code_value", channel_partner_id="channel_partner_id_value", + correlation_id="correlation_id_value", ) ) response = await client.import_customer(request) @@ -2145,6 +2161,7 @@ async def test_import_customer_async( 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" + assert response.correlation_id == "correlation_id_value" @pytest.mark.asyncio @@ -11406,6 +11423,452 @@ async def test_list_subscribers_async_pages(): assert page_.raw_page.next_page_token == token +@pytest.mark.parametrize( + "request_type", + [ + service.ListEntitlementChangesRequest, + dict, + ], +) +def test_list_entitlement_changes(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_entitlement_changes), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListEntitlementChangesResponse( + next_page_token="next_page_token_value", + ) + response = client.list_entitlement_changes(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.ListEntitlementChangesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListEntitlementChangesPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_entitlement_changes_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_entitlement_changes), "__call__" + ) as call: + client.list_entitlement_changes() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListEntitlementChangesRequest() + + +@pytest.mark.asyncio +async def test_list_entitlement_changes_async( + transport: str = "grpc_asyncio", request_type=service.ListEntitlementChangesRequest +): + 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_entitlement_changes), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + service.ListEntitlementChangesResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_entitlement_changes(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListEntitlementChangesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListEntitlementChangesAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_entitlement_changes_async_from_dict(): + await test_list_entitlement_changes_async(request_type=dict) + + +def test_list_entitlement_changes_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.ListEntitlementChangesRequest() + + request.parent = "parent_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlement_changes), "__call__" + ) as call: + call.return_value = service.ListEntitlementChangesResponse() + client.list_entitlement_changes(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_entitlement_changes_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.ListEntitlementChangesRequest() + + request.parent = "parent_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_entitlement_changes), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + service.ListEntitlementChangesResponse() + ) + await client.list_entitlement_changes(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_entitlement_changes_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_entitlement_changes), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListEntitlementChangesResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_entitlement_changes( + 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_entitlement_changes_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_entitlement_changes( + service.ListEntitlementChangesRequest(), + parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_entitlement_changes_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_entitlement_changes), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListEntitlementChangesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + service.ListEntitlementChangesResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_entitlement_changes( + 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_entitlement_changes_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_entitlement_changes( + service.ListEntitlementChangesRequest(), + parent="parent_value", + ) + + +def test_list_entitlement_changes_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_entitlement_changes), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + ], + next_page_token="abc", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[], + next_page_token="def", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + ], + next_page_token="ghi", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_entitlement_changes(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all( + isinstance(i, entitlement_changes.EntitlementChange) for i in results + ) + + +def test_list_entitlement_changes_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_entitlement_changes), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + ], + next_page_token="abc", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[], + next_page_token="def", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + ], + next_page_token="ghi", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + ], + ), + RuntimeError, + ) + pages = list(client.list_entitlement_changes(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_entitlement_changes_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_entitlement_changes), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + ], + next_page_token="abc", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[], + next_page_token="def", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + ], + next_page_token="ghi", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_entitlement_changes( + 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, entitlement_changes.EntitlementChange) for i in responses + ) + + +@pytest.mark.asyncio +async def test_list_entitlement_changes_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_entitlement_changes), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + ], + next_page_token="abc", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[], + next_page_token="def", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + ], + next_page_token="ghi", + ), + service.ListEntitlementChangesResponse( + entitlement_changes=[ + entitlement_changes.EntitlementChange(), + entitlement_changes.EntitlementChange(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in ( + await client.list_entitlement_changes(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( @@ -11588,6 +12051,7 @@ def test_cloud_channel_service_base_transport(): "register_subscriber", "unregister_subscriber", "list_subscribers", + "list_entitlement_changes", "get_operation", "cancel_operation", "delete_operation",