Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
feat: add show_future_offers to ListOffers (#230)
Browse files Browse the repository at this point in the history
* feat: add show_future_offers to ListOffers
feat: add ListEntitlementChanges

PiperOrigin-RevId: 516294330

Source-Link: googleapis/googleapis@c0eb8fa

Source-Link: googleapis/googleapis-gen@7217f21
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzIxN2YyMTJjNDFkNmVjMzVkMzVhZjYxYjU4N2JkZWU5MmViZDExYSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Mar 14, 2023
1 parent 635640a commit da4f098
Show file tree
Hide file tree
Showing 19 changed files with 1,657 additions and 7 deletions.
6 changes: 6 additions & 0 deletions google/cloud/channel/__init__.py
Expand Up @@ -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,
Expand Down Expand Up @@ -136,6 +137,8 @@
ListCustomerRepricingConfigsResponse,
ListCustomersRequest,
ListCustomersResponse,
ListEntitlementChangesRequest,
ListEntitlementChangesResponse,
ListEntitlementsRequest,
ListEntitlementsResponse,
ListOffersRequest,
Expand Down Expand Up @@ -193,6 +196,7 @@
"Value",
"ContactInfo",
"Customer",
"EntitlementChange",
"AssociationInfo",
"CommitmentSettings",
"Entitlement",
Expand Down Expand Up @@ -276,6 +280,8 @@
"ListCustomerRepricingConfigsResponse",
"ListCustomersRequest",
"ListCustomersResponse",
"ListEntitlementChangesRequest",
"ListEntitlementChangesResponse",
"ListEntitlementsRequest",
"ListEntitlementsResponse",
"ListOffersRequest",
Expand Down
6 changes: 6 additions & 0 deletions google/cloud/channel_v1/__init__.py
Expand Up @@ -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,
Expand Down Expand Up @@ -121,6 +122,8 @@
ListCustomerRepricingConfigsResponse,
ListCustomersRequest,
ListCustomersResponse,
ListEntitlementChangesRequest,
ListEntitlementChangesResponse,
ListEntitlementsRequest,
ListEntitlementsResponse,
ListOffersRequest,
Expand Down Expand Up @@ -200,6 +203,7 @@
"DeleteCustomerRequest",
"EduData",
"Entitlement",
"EntitlementChange",
"EntitlementEvent",
"FetchReportResultsRequest",
"FetchReportResultsResponse",
Expand All @@ -217,6 +221,8 @@
"ListCustomerRepricingConfigsResponse",
"ListCustomersRequest",
"ListCustomersResponse",
"ListEntitlementChangesRequest",
"ListEntitlementChangesResponse",
"ListEntitlementsRequest",
"ListEntitlementsResponse",
"ListOffersRequest",
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/channel_v1/gapic_metadata.json
Expand Up @@ -174,6 +174,11 @@
"list_customers"
]
},
"ListEntitlementChanges": {
"methods": [
"list_entitlement_changes"
]
},
"ListEntitlements": {
"methods": [
"list_entitlements"
Expand Down Expand Up @@ -404,6 +409,11 @@
"list_customers"
]
},
"ListEntitlementChanges": {
"methods": [
"list_entitlement_changes"
]
},
"ListEntitlements": {
"methods": [
"list_entitlements"
Expand Down
136 changes: 136 additions & 0 deletions google/cloud/channel_v1/services/cloud_channel_service/async_client.py
Expand Up @@ -54,6 +54,7 @@
channel_partner_links,
common,
customers,
entitlement_changes,
entitlements,
offers,
operations,
Expand Down Expand Up @@ -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,
Expand Down
136 changes: 136 additions & 0 deletions google/cloud/channel_v1/services/cloud_channel_service/client.py
Expand Up @@ -58,6 +58,7 @@
channel_partner_links,
common,
customers,
entitlement_changes,
entitlements,
offers,
operations,
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit da4f098

Please sign in to comment.