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

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: Add/Update API definitions for Cloud Channel API (#53)
PiperOrigin-RevId: 378177991

Source-Link: googleapis/googleapis@97d42c6

Source-Link: googleapis/googleapis-gen@13ecac3

feat: Update descriptions of APIs.
feat: Add additional_bindings to HTTP annotations of Customer related APIs (list/create/get/update/delete).
feat: Add a new LookupOffer RPC and LookupOfferRequest proto.
feat: Add a new enum value LICENSE_CAP_CHANGED to enum EntitlementEvent.Type.
  • Loading branch information
gcf-owl-bot[bot] committed Jun 10, 2021
1 parent 2ec8b7f commit 164539d
Show file tree
Hide file tree
Showing 15 changed files with 436 additions and 60 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Expand Up @@ -2,7 +2,6 @@
branch = True

[report]
fail_under = 100
show_missing = True
omit =
google/cloud/channel/__init__.py
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/channel/__init__.py
Expand Up @@ -99,6 +99,7 @@
from google.cloud.channel_v1.types.service import ListTransferableOffersResponse
from google.cloud.channel_v1.types.service import ListTransferableSkusRequest
from google.cloud.channel_v1.types.service import ListTransferableSkusResponse
from google.cloud.channel_v1.types.service import LookupOfferRequest
from google.cloud.channel_v1.types.service import ProvisionCloudIdentityRequest
from google.cloud.channel_v1.types.service import PurchasableOffer
from google.cloud.channel_v1.types.service import PurchasableSku
Expand Down Expand Up @@ -197,6 +198,7 @@
"ListTransferableOffersResponse",
"ListTransferableSkusRequest",
"ListTransferableSkusResponse",
"LookupOfferRequest",
"ProvisionCloudIdentityRequest",
"PurchasableOffer",
"PurchasableSku",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/channel_v1/__init__.py
Expand Up @@ -93,6 +93,7 @@
from .types.service import ListTransferableOffersResponse
from .types.service import ListTransferableSkusRequest
from .types.service import ListTransferableSkusResponse
from .types.service import LookupOfferRequest
from .types.service import ProvisionCloudIdentityRequest
from .types.service import PurchasableOffer
from .types.service import PurchasableSku
Expand Down Expand Up @@ -167,6 +168,7 @@
"ListTransferableOffersResponse",
"ListTransferableSkusRequest",
"ListTransferableSkusResponse",
"LookupOfferRequest",
"MarketingInfo",
"Media",
"MediaType",
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/channel_v1/gapic_metadata.json
Expand Up @@ -130,6 +130,11 @@
"list_transferable_skus"
]
},
"LookupOffer": {
"methods": [
"lookup_offer"
]
},
"ProvisionCloudIdentity": {
"methods": [
"provision_cloud_identity"
Expand Down Expand Up @@ -300,6 +305,11 @@
"list_transferable_skus"
]
},
"LookupOffer": {
"methods": [
"lookup_offer"
]
},
"ProvisionCloudIdentity": {
"methods": [
"provision_cloud_identity"
Expand Down
Expand Up @@ -285,8 +285,8 @@ async def get_customer(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> customers.Customer:
r"""Returns a requested [Customer][google.cloud.channel.v1.Customer]
resource.
r"""Returns the requested
[Customer][google.cloud.channel.v1.Customer] resource.
Possible error codes:
Expand Down Expand Up @@ -565,7 +565,7 @@ async def delete_customer(
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes the given [Customer][google.cloud.channel.v1.Customer]
permanently and irreversibly.
permanently.
Possible error codes:
Expand Down Expand Up @@ -951,7 +951,7 @@ async def get_entitlement(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> entitlements.Entitlement:
r"""Returns a requested
r"""Returns the requested
[Entitlement][google.cloud.channel.v1.Entitlement] resource.
Possible error codes:
Expand Down Expand Up @@ -2000,7 +2000,7 @@ async def get_channel_partner_link(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> channel_partner_links.ChannelPartnerLink:
r"""Returns a requested
r"""Returns the requested
[ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]
resource. You must be a distributor to call this method.
Expand Down Expand Up @@ -2205,6 +2205,71 @@ async def update_channel_partner_link(
# Done; return the response.
return response

async def lookup_offer(
self,
request: service.LookupOfferRequest = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> offers.Offer:
r"""Returns the requested [Offer][google.cloud.channel.v1.Offer]
resource.
Possible error codes:
- PERMISSION_DENIED: The entitlement doesn't belong to the
reseller.
- INVALID_ARGUMENT: Required request parameters are missing or
invalid.
- NOT_FOUND: Entitlement or offer was not found.
Return value: The [Offer][google.cloud.channel.v1.Offer]
resource.
Args:
request (:class:`google.cloud.channel_v1.types.LookupOfferRequest`):
The request object. Request message for LookupOffer.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.channel_v1.types.Offer:
Represents an offer made to resellers for purchase.
An offer is associated with a
[Sku][google.cloud.channel.v1.Sku], has a plan for
payment, a price, and defines the constraints for
buying.
"""
# Create or coerce a protobuf request object.
request = service.LookupOfferRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.lookup_offer,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("entitlement", request.entitlement),)
),
)

# Send the request.
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response

async def list_products(
self,
request: service.ListProductsRequest = None,
Expand Down
76 changes: 71 additions & 5 deletions google/cloud/channel_v1/services/cloud_channel_service/client.py
Expand Up @@ -508,8 +508,8 @@ def get_customer(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> customers.Customer:
r"""Returns a requested [Customer][google.cloud.channel.v1.Customer]
resource.
r"""Returns the requested
[Customer][google.cloud.channel.v1.Customer] resource.
Possible error codes:
Expand Down Expand Up @@ -793,7 +793,7 @@ def delete_customer(
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes the given [Customer][google.cloud.channel.v1.Customer]
permanently and irreversibly.
permanently.
Possible error codes:
Expand Down Expand Up @@ -1183,7 +1183,7 @@ def get_entitlement(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> entitlements.Entitlement:
r"""Returns a requested
r"""Returns the requested
[Entitlement][google.cloud.channel.v1.Entitlement] resource.
Possible error codes:
Expand Down Expand Up @@ -2248,7 +2248,7 @@ def get_channel_partner_link(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> channel_partner_links.ChannelPartnerLink:
r"""Returns a requested
r"""Returns the requested
[ChannelPartnerLink][google.cloud.channel.v1.ChannelPartnerLink]
resource. You must be a distributor to call this method.
Expand Down Expand Up @@ -2460,6 +2460,72 @@ def update_channel_partner_link(
# Done; return the response.
return response

def lookup_offer(
self,
request: service.LookupOfferRequest = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> offers.Offer:
r"""Returns the requested [Offer][google.cloud.channel.v1.Offer]
resource.
Possible error codes:
- PERMISSION_DENIED: The entitlement doesn't belong to the
reseller.
- INVALID_ARGUMENT: Required request parameters are missing or
invalid.
- NOT_FOUND: Entitlement or offer was not found.
Return value: The [Offer][google.cloud.channel.v1.Offer]
resource.
Args:
request (google.cloud.channel_v1.types.LookupOfferRequest):
The request object. Request message for LookupOffer.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.channel_v1.types.Offer:
Represents an offer made to resellers for purchase.
An offer is associated with a
[Sku][google.cloud.channel.v1.Sku], has a plan for
payment, a price, and defines the constraints for
buying.
"""
# Create or coerce a protobuf request object.
# Minor optimization to avoid making a copy if the user passes
# in a service.LookupOfferRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, service.LookupOfferRequest):
request = service.LookupOfferRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.lookup_offer]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("entitlement", request.entitlement),)
),
)

# Send the request.
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)

# Done; return the response.
return response

def list_products(
self,
request: service.ListProductsRequest = None,
Expand Down
Expand Up @@ -29,6 +29,7 @@
from google.cloud.channel_v1.types import channel_partner_links
from google.cloud.channel_v1.types import customers
from google.cloud.channel_v1.types import entitlements
from google.cloud.channel_v1.types import offers
from google.cloud.channel_v1.types import service
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
Expand Down Expand Up @@ -269,6 +270,9 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.lookup_offer: gapic_v1.method.wrap_method(
self.lookup_offer, default_timeout=None, client_info=client_info,
),
self.list_products: gapic_v1.method.wrap_method(
self.list_products, default_timeout=None, client_info=client_info,
),
Expand Down Expand Up @@ -555,6 +559,14 @@ def update_channel_partner_link(
]:
raise NotImplementedError()

@property
def lookup_offer(
self,
) -> Callable[
[service.LookupOfferRequest], Union[offers.Offer, Awaitable[offers.Offer]]
]:
raise NotImplementedError()

@property
def list_products(
self,
Expand Down

0 comments on commit 164539d

Please sign in to comment.