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

Commit

Permalink
feat: add ImportCustomer (#90)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 394721709

Source-Link: googleapis/googleapis@bf57b2c

Source-Link: googleapis/googleapis-gen@699e6d5
  • Loading branch information
gcf-owl-bot[bot] committed Sep 23, 2021
1 parent d338a34 commit 2bb2d89
Show file tree
Hide file tree
Showing 13 changed files with 461 additions and 2 deletions.
2 changes: 2 additions & 0 deletions google/cloud/channel/__init__.py
Expand Up @@ -77,6 +77,7 @@
from google.cloud.channel_v1.types.service import GetChannelPartnerLinkRequest
from google.cloud.channel_v1.types.service import GetCustomerRequest
from google.cloud.channel_v1.types.service import GetEntitlementRequest
from google.cloud.channel_v1.types.service import ImportCustomerRequest
from google.cloud.channel_v1.types.service import ListChannelPartnerLinksRequest
from google.cloud.channel_v1.types.service import ListChannelPartnerLinksResponse
from google.cloud.channel_v1.types.service import ListCustomersRequest
Expand Down Expand Up @@ -176,6 +177,7 @@
"GetChannelPartnerLinkRequest",
"GetCustomerRequest",
"GetEntitlementRequest",
"ImportCustomerRequest",
"ListChannelPartnerLinksRequest",
"ListChannelPartnerLinksResponse",
"ListCustomersRequest",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/channel_v1/__init__.py
Expand Up @@ -71,6 +71,7 @@
from .types.service import GetChannelPartnerLinkRequest
from .types.service import GetCustomerRequest
from .types.service import GetEntitlementRequest
from .types.service import ImportCustomerRequest
from .types.service import ListChannelPartnerLinksRequest
from .types.service import ListChannelPartnerLinksResponse
from .types.service import ListCustomersRequest
Expand Down Expand Up @@ -146,6 +147,7 @@
"GetChannelPartnerLinkRequest",
"GetCustomerRequest",
"GetEntitlementRequest",
"ImportCustomerRequest",
"ListChannelPartnerLinksRequest",
"ListChannelPartnerLinksResponse",
"ListCustomersRequest",
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/channel_v1/gapic_metadata.json
Expand Up @@ -75,6 +75,11 @@
"get_entitlement"
]
},
"ImportCustomer": {
"methods": [
"import_customer"
]
},
"ListChannelPartnerLinks": {
"methods": [
"list_channel_partner_links"
Expand Down Expand Up @@ -250,6 +255,11 @@
"get_entitlement"
]
},
"ImportCustomer": {
"methods": [
"import_customer"
]
},
"ListChannelPartnerLinks": {
"methods": [
"list_channel_partner_links"
Expand Down
Expand Up @@ -630,6 +630,71 @@ async def delete_customer(
request, retry=retry, timeout=timeout, metadata=metadata,
)

async def import_customer(
self,
request: service.ImportCustomerRequest = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> customers.Customer:
r"""Imports a [Customer][google.cloud.channel.v1.Customer] from the
Cloud Identity associated with the provided Cloud Identity ID or
domain before a TransferEntitlements call. If a linked Customer
already exists and overwrite_if_exists is true, it will update
that Customer's data.
Possible error codes:
- PERMISSION_DENIED: The reseller account making the request is
different from the reseller account in the API request.
- NOT_FOUND: Cloud Identity doesn't exist or was deleted.
- INVALID_ARGUMENT: Required parameters are missing, or the
auth_token is expired or invalid.
- ALREADY_EXISTS: A customer already exists and has conflicting
critical fields. Requires an overwrite.
Return value: The [Customer][google.cloud.channel.v1.Customer].
Args:
request (:class:`google.cloud.channel_v1.types.ImportCustomerRequest`):
The request object. Request message for
[CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer]
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.channel_v1.types.Customer:
Entity representing a customer of a
reseller or distributor.
"""
# Create or coerce a protobuf request object.
request = service.ImportCustomerRequest(request)

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

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

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

# Done; return the response.
return response

async def provision_cloud_identity(
self,
request: service.ProvisionCloudIdentityRequest = None,
Expand Down
66 changes: 66 additions & 0 deletions google/cloud/channel_v1/services/cloud_channel_service/client.py
Expand Up @@ -863,6 +863,72 @@ def delete_customer(
request, retry=retry, timeout=timeout, metadata=metadata,
)

def import_customer(
self,
request: service.ImportCustomerRequest = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> customers.Customer:
r"""Imports a [Customer][google.cloud.channel.v1.Customer] from the
Cloud Identity associated with the provided Cloud Identity ID or
domain before a TransferEntitlements call. If a linked Customer
already exists and overwrite_if_exists is true, it will update
that Customer's data.
Possible error codes:
- PERMISSION_DENIED: The reseller account making the request is
different from the reseller account in the API request.
- NOT_FOUND: Cloud Identity doesn't exist or was deleted.
- INVALID_ARGUMENT: Required parameters are missing, or the
auth_token is expired or invalid.
- ALREADY_EXISTS: A customer already exists and has conflicting
critical fields. Requires an overwrite.
Return value: The [Customer][google.cloud.channel.v1.Customer].
Args:
request (google.cloud.channel_v1.types.ImportCustomerRequest):
The request object. Request message for
[CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer]
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.channel_v1.types.Customer:
Entity representing a customer of a
reseller or distributor.
"""
# Create or coerce a protobuf request object.
# Minor optimization to avoid making a copy if the user passes
# in a service.ImportCustomerRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, service.ImportCustomerRequest):
request = service.ImportCustomerRequest(request)

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

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

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

# Done; return the response.
return response

def provision_cloud_identity(
self,
request: service.ProvisionCloudIdentityRequest = None,
Expand Down
Expand Up @@ -179,6 +179,9 @@ def _prep_wrapped_messages(self, client_info):
self.delete_customer: gapic_v1.method.wrap_method(
self.delete_customer, default_timeout=None, client_info=client_info,
),
self.import_customer: gapic_v1.method.wrap_method(
self.import_customer, default_timeout=None, client_info=client_info,
),
self.provision_cloud_identity: gapic_v1.method.wrap_method(
self.provision_cloud_identity,
default_timeout=60.0,
Expand Down Expand Up @@ -355,6 +358,15 @@ def delete_customer(
]:
raise NotImplementedError()

@property
def import_customer(
self,
) -> Callable[
[service.ImportCustomerRequest],
Union[customers.Customer, Awaitable[customers.Customer]],
]:
raise NotImplementedError()

@property
def provision_cloud_identity(
self,
Expand Down
Expand Up @@ -511,6 +511,48 @@ def delete_customer(
)
return self._stubs["delete_customer"]

@property
def import_customer(
self,
) -> Callable[[service.ImportCustomerRequest], customers.Customer]:
r"""Return a callable for the import customer method over gRPC.
Imports a [Customer][google.cloud.channel.v1.Customer] from the
Cloud Identity associated with the provided Cloud Identity ID or
domain before a TransferEntitlements call. If a linked Customer
already exists and overwrite_if_exists is true, it will update
that Customer's data.
Possible error codes:
- PERMISSION_DENIED: The reseller account making the request is
different from the reseller account in the API request.
- NOT_FOUND: Cloud Identity doesn't exist or was deleted.
- INVALID_ARGUMENT: Required parameters are missing, or the
auth_token is expired or invalid.
- ALREADY_EXISTS: A customer already exists and has conflicting
critical fields. Requires an overwrite.
Return value: The [Customer][google.cloud.channel.v1.Customer].
Returns:
Callable[[~.ImportCustomerRequest],
~.Customer]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "import_customer" not in self._stubs:
self._stubs["import_customer"] = self.grpc_channel.unary_unary(
"/google.cloud.channel.v1.CloudChannelService/ImportCustomer",
request_serializer=service.ImportCustomerRequest.serialize,
response_deserializer=customers.Customer.deserialize,
)
return self._stubs["import_customer"]

@property
def provision_cloud_identity(
self,
Expand Down
Expand Up @@ -518,6 +518,48 @@ def delete_customer(
)
return self._stubs["delete_customer"]

@property
def import_customer(
self,
) -> Callable[[service.ImportCustomerRequest], Awaitable[customers.Customer]]:
r"""Return a callable for the import customer method over gRPC.
Imports a [Customer][google.cloud.channel.v1.Customer] from the
Cloud Identity associated with the provided Cloud Identity ID or
domain before a TransferEntitlements call. If a linked Customer
already exists and overwrite_if_exists is true, it will update
that Customer's data.
Possible error codes:
- PERMISSION_DENIED: The reseller account making the request is
different from the reseller account in the API request.
- NOT_FOUND: Cloud Identity doesn't exist or was deleted.
- INVALID_ARGUMENT: Required parameters are missing, or the
auth_token is expired or invalid.
- ALREADY_EXISTS: A customer already exists and has conflicting
critical fields. Requires an overwrite.
Return value: The [Customer][google.cloud.channel.v1.Customer].
Returns:
Callable[[~.ImportCustomerRequest],
Awaitable[~.Customer]]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "import_customer" not in self._stubs:
self._stubs["import_customer"] = self.grpc_channel.unary_unary(
"/google.cloud.channel.v1.CloudChannelService/ImportCustomer",
request_serializer=service.ImportCustomerRequest.serialize,
response_deserializer=customers.Customer.deserialize,
)
return self._stubs["import_customer"]

@property
def provision_cloud_identity(
self,
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/channel_v1/types/__init__.py
Expand Up @@ -80,6 +80,7 @@
GetChannelPartnerLinkRequest,
GetCustomerRequest,
GetEntitlementRequest,
ImportCustomerRequest,
ListChannelPartnerLinksRequest,
ListChannelPartnerLinksResponse,
ListCustomersRequest,
Expand Down Expand Up @@ -180,6 +181,7 @@
"GetChannelPartnerLinkRequest",
"GetCustomerRequest",
"GetEntitlementRequest",
"ImportCustomerRequest",
"ListChannelPartnerLinksRequest",
"ListChannelPartnerLinksResponse",
"ListCustomersRequest",
Expand Down
8 changes: 6 additions & 2 deletions google/cloud/channel_v1/types/customers.py
Expand Up @@ -50,7 +50,8 @@ class Customer(proto.Message):
will receive a notification with credentials
when you create an admin.google.com account.
Secondary emails are also recovery email
addresses.
addresses. Alternate emails are optional when
you create Team customers.
domain (str):
Required. The customer's primary domain. Must
match the primary contact email's domain.
Expand Down Expand Up @@ -100,8 +101,10 @@ class ContactInfo(proto.Message):
Attributes:
first_name (str):
The customer account contact's first name.
Optional for Team customers.
last_name (str):
The customer account contact's last name.
Optional for Team customers.
display_name (str):
Output only. The customer account contact's
display name, formatted as a combination of the
Expand All @@ -110,7 +113,8 @@ class ContactInfo(proto.Message):
The customer account's contact email.
Required for entitlements that create
admin.google.com accounts, and serves as the
customer's username for those accounts.
customer's username for those accounts. Use this
email to invite Team customers.
title (str):
Optional. The customer account contact's job
title.
Expand Down

0 comments on commit 2bb2d89

Please sign in to comment.