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

Commit 2bb2d89

Browse files
feat: add ImportCustomer (#90)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 394721709 Source-Link: googleapis/googleapis@bf57b2c Source-Link: https://github.com/googleapis/googleapis-gen/commit/699e6d5fdcb12daac24587c0643016855ccb2e16
1 parent d338a34 commit 2bb2d89

13 files changed

Lines changed: 461 additions & 2 deletions

File tree

google/cloud/channel/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
from google.cloud.channel_v1.types.service import GetChannelPartnerLinkRequest
7878
from google.cloud.channel_v1.types.service import GetCustomerRequest
7979
from google.cloud.channel_v1.types.service import GetEntitlementRequest
80+
from google.cloud.channel_v1.types.service import ImportCustomerRequest
8081
from google.cloud.channel_v1.types.service import ListChannelPartnerLinksRequest
8182
from google.cloud.channel_v1.types.service import ListChannelPartnerLinksResponse
8283
from google.cloud.channel_v1.types.service import ListCustomersRequest
@@ -176,6 +177,7 @@
176177
"GetChannelPartnerLinkRequest",
177178
"GetCustomerRequest",
178179
"GetEntitlementRequest",
180+
"ImportCustomerRequest",
179181
"ListChannelPartnerLinksRequest",
180182
"ListChannelPartnerLinksResponse",
181183
"ListCustomersRequest",

google/cloud/channel_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
from .types.service import GetChannelPartnerLinkRequest
7272
from .types.service import GetCustomerRequest
7373
from .types.service import GetEntitlementRequest
74+
from .types.service import ImportCustomerRequest
7475
from .types.service import ListChannelPartnerLinksRequest
7576
from .types.service import ListChannelPartnerLinksResponse
7677
from .types.service import ListCustomersRequest
@@ -146,6 +147,7 @@
146147
"GetChannelPartnerLinkRequest",
147148
"GetCustomerRequest",
148149
"GetEntitlementRequest",
150+
"ImportCustomerRequest",
149151
"ListChannelPartnerLinksRequest",
150152
"ListChannelPartnerLinksResponse",
151153
"ListCustomersRequest",

google/cloud/channel_v1/gapic_metadata.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
"get_entitlement"
7676
]
7777
},
78+
"ImportCustomer": {
79+
"methods": [
80+
"import_customer"
81+
]
82+
},
7883
"ListChannelPartnerLinks": {
7984
"methods": [
8085
"list_channel_partner_links"
@@ -250,6 +255,11 @@
250255
"get_entitlement"
251256
]
252257
},
258+
"ImportCustomer": {
259+
"methods": [
260+
"import_customer"
261+
]
262+
},
253263
"ListChannelPartnerLinks": {
254264
"methods": [
255265
"list_channel_partner_links"

google/cloud/channel_v1/services/cloud_channel_service/async_client.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,71 @@ async def delete_customer(
630630
request, retry=retry, timeout=timeout, metadata=metadata,
631631
)
632632

633+
async def import_customer(
634+
self,
635+
request: service.ImportCustomerRequest = None,
636+
*,
637+
retry: retries.Retry = gapic_v1.method.DEFAULT,
638+
timeout: float = None,
639+
metadata: Sequence[Tuple[str, str]] = (),
640+
) -> customers.Customer:
641+
r"""Imports a [Customer][google.cloud.channel.v1.Customer] from the
642+
Cloud Identity associated with the provided Cloud Identity ID or
643+
domain before a TransferEntitlements call. If a linked Customer
644+
already exists and overwrite_if_exists is true, it will update
645+
that Customer's data.
646+
647+
Possible error codes:
648+
649+
- PERMISSION_DENIED: The reseller account making the request is
650+
different from the reseller account in the API request.
651+
- NOT_FOUND: Cloud Identity doesn't exist or was deleted.
652+
- INVALID_ARGUMENT: Required parameters are missing, or the
653+
auth_token is expired or invalid.
654+
- ALREADY_EXISTS: A customer already exists and has conflicting
655+
critical fields. Requires an overwrite.
656+
657+
Return value: The [Customer][google.cloud.channel.v1.Customer].
658+
659+
Args:
660+
request (:class:`google.cloud.channel_v1.types.ImportCustomerRequest`):
661+
The request object. Request message for
662+
[CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer]
663+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
664+
should be retried.
665+
timeout (float): The timeout for this request.
666+
metadata (Sequence[Tuple[str, str]]): Strings which should be
667+
sent along with the request as metadata.
668+
669+
Returns:
670+
google.cloud.channel_v1.types.Customer:
671+
Entity representing a customer of a
672+
reseller or distributor.
673+
674+
"""
675+
# Create or coerce a protobuf request object.
676+
request = service.ImportCustomerRequest(request)
677+
678+
# Wrap the RPC method; this adds retry and timeout information,
679+
# and friendly error handling.
680+
rpc = gapic_v1.method_async.wrap_method(
681+
self._client._transport.import_customer,
682+
default_timeout=None,
683+
client_info=DEFAULT_CLIENT_INFO,
684+
)
685+
686+
# Certain fields should be provided within the metadata header;
687+
# add these here.
688+
metadata = tuple(metadata) + (
689+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
690+
)
691+
692+
# Send the request.
693+
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
694+
695+
# Done; return the response.
696+
return response
697+
633698
async def provision_cloud_identity(
634699
self,
635700
request: service.ProvisionCloudIdentityRequest = None,

google/cloud/channel_v1/services/cloud_channel_service/client.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,72 @@ def delete_customer(
863863
request, retry=retry, timeout=timeout, metadata=metadata,
864864
)
865865

866+
def import_customer(
867+
self,
868+
request: service.ImportCustomerRequest = None,
869+
*,
870+
retry: retries.Retry = gapic_v1.method.DEFAULT,
871+
timeout: float = None,
872+
metadata: Sequence[Tuple[str, str]] = (),
873+
) -> customers.Customer:
874+
r"""Imports a [Customer][google.cloud.channel.v1.Customer] from the
875+
Cloud Identity associated with the provided Cloud Identity ID or
876+
domain before a TransferEntitlements call. If a linked Customer
877+
already exists and overwrite_if_exists is true, it will update
878+
that Customer's data.
879+
880+
Possible error codes:
881+
882+
- PERMISSION_DENIED: The reseller account making the request is
883+
different from the reseller account in the API request.
884+
- NOT_FOUND: Cloud Identity doesn't exist or was deleted.
885+
- INVALID_ARGUMENT: Required parameters are missing, or the
886+
auth_token is expired or invalid.
887+
- ALREADY_EXISTS: A customer already exists and has conflicting
888+
critical fields. Requires an overwrite.
889+
890+
Return value: The [Customer][google.cloud.channel.v1.Customer].
891+
892+
Args:
893+
request (google.cloud.channel_v1.types.ImportCustomerRequest):
894+
The request object. Request message for
895+
[CloudChannelService.ImportCustomer][google.cloud.channel.v1.CloudChannelService.ImportCustomer]
896+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
897+
should be retried.
898+
timeout (float): The timeout for this request.
899+
metadata (Sequence[Tuple[str, str]]): Strings which should be
900+
sent along with the request as metadata.
901+
902+
Returns:
903+
google.cloud.channel_v1.types.Customer:
904+
Entity representing a customer of a
905+
reseller or distributor.
906+
907+
"""
908+
# Create or coerce a protobuf request object.
909+
# Minor optimization to avoid making a copy if the user passes
910+
# in a service.ImportCustomerRequest.
911+
# There's no risk of modifying the input as we've already verified
912+
# there are no flattened fields.
913+
if not isinstance(request, service.ImportCustomerRequest):
914+
request = service.ImportCustomerRequest(request)
915+
916+
# Wrap the RPC method; this adds retry and timeout information,
917+
# and friendly error handling.
918+
rpc = self._transport._wrapped_methods[self._transport.import_customer]
919+
920+
# Certain fields should be provided within the metadata header;
921+
# add these here.
922+
metadata = tuple(metadata) + (
923+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
924+
)
925+
926+
# Send the request.
927+
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
928+
929+
# Done; return the response.
930+
return response
931+
866932
def provision_cloud_identity(
867933
self,
868934
request: service.ProvisionCloudIdentityRequest = None,

google/cloud/channel_v1/services/cloud_channel_service/transports/base.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ def _prep_wrapped_messages(self, client_info):
179179
self.delete_customer: gapic_v1.method.wrap_method(
180180
self.delete_customer, default_timeout=None, client_info=client_info,
181181
),
182+
self.import_customer: gapic_v1.method.wrap_method(
183+
self.import_customer, default_timeout=None, client_info=client_info,
184+
),
182185
self.provision_cloud_identity: gapic_v1.method.wrap_method(
183186
self.provision_cloud_identity,
184187
default_timeout=60.0,
@@ -355,6 +358,15 @@ def delete_customer(
355358
]:
356359
raise NotImplementedError()
357360

361+
@property
362+
def import_customer(
363+
self,
364+
) -> Callable[
365+
[service.ImportCustomerRequest],
366+
Union[customers.Customer, Awaitable[customers.Customer]],
367+
]:
368+
raise NotImplementedError()
369+
358370
@property
359371
def provision_cloud_identity(
360372
self,

google/cloud/channel_v1/services/cloud_channel_service/transports/grpc.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,48 @@ def delete_customer(
511511
)
512512
return self._stubs["delete_customer"]
513513

514+
@property
515+
def import_customer(
516+
self,
517+
) -> Callable[[service.ImportCustomerRequest], customers.Customer]:
518+
r"""Return a callable for the import customer method over gRPC.
519+
520+
Imports a [Customer][google.cloud.channel.v1.Customer] from the
521+
Cloud Identity associated with the provided Cloud Identity ID or
522+
domain before a TransferEntitlements call. If a linked Customer
523+
already exists and overwrite_if_exists is true, it will update
524+
that Customer's data.
525+
526+
Possible error codes:
527+
528+
- PERMISSION_DENIED: The reseller account making the request is
529+
different from the reseller account in the API request.
530+
- NOT_FOUND: Cloud Identity doesn't exist or was deleted.
531+
- INVALID_ARGUMENT: Required parameters are missing, or the
532+
auth_token is expired or invalid.
533+
- ALREADY_EXISTS: A customer already exists and has conflicting
534+
critical fields. Requires an overwrite.
535+
536+
Return value: The [Customer][google.cloud.channel.v1.Customer].
537+
538+
Returns:
539+
Callable[[~.ImportCustomerRequest],
540+
~.Customer]:
541+
A function that, when called, will call the underlying RPC
542+
on the server.
543+
"""
544+
# Generate a "stub function" on-the-fly which will actually make
545+
# the request.
546+
# gRPC handles serialization and deserialization, so we just need
547+
# to pass in the functions for each.
548+
if "import_customer" not in self._stubs:
549+
self._stubs["import_customer"] = self.grpc_channel.unary_unary(
550+
"/google.cloud.channel.v1.CloudChannelService/ImportCustomer",
551+
request_serializer=service.ImportCustomerRequest.serialize,
552+
response_deserializer=customers.Customer.deserialize,
553+
)
554+
return self._stubs["import_customer"]
555+
514556
@property
515557
def provision_cloud_identity(
516558
self,

google/cloud/channel_v1/services/cloud_channel_service/transports/grpc_asyncio.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,48 @@ def delete_customer(
518518
)
519519
return self._stubs["delete_customer"]
520520

521+
@property
522+
def import_customer(
523+
self,
524+
) -> Callable[[service.ImportCustomerRequest], Awaitable[customers.Customer]]:
525+
r"""Return a callable for the import customer method over gRPC.
526+
527+
Imports a [Customer][google.cloud.channel.v1.Customer] from the
528+
Cloud Identity associated with the provided Cloud Identity ID or
529+
domain before a TransferEntitlements call. If a linked Customer
530+
already exists and overwrite_if_exists is true, it will update
531+
that Customer's data.
532+
533+
Possible error codes:
534+
535+
- PERMISSION_DENIED: The reseller account making the request is
536+
different from the reseller account in the API request.
537+
- NOT_FOUND: Cloud Identity doesn't exist or was deleted.
538+
- INVALID_ARGUMENT: Required parameters are missing, or the
539+
auth_token is expired or invalid.
540+
- ALREADY_EXISTS: A customer already exists and has conflicting
541+
critical fields. Requires an overwrite.
542+
543+
Return value: The [Customer][google.cloud.channel.v1.Customer].
544+
545+
Returns:
546+
Callable[[~.ImportCustomerRequest],
547+
Awaitable[~.Customer]]:
548+
A function that, when called, will call the underlying RPC
549+
on the server.
550+
"""
551+
# Generate a "stub function" on-the-fly which will actually make
552+
# the request.
553+
# gRPC handles serialization and deserialization, so we just need
554+
# to pass in the functions for each.
555+
if "import_customer" not in self._stubs:
556+
self._stubs["import_customer"] = self.grpc_channel.unary_unary(
557+
"/google.cloud.channel.v1.CloudChannelService/ImportCustomer",
558+
request_serializer=service.ImportCustomerRequest.serialize,
559+
response_deserializer=customers.Customer.deserialize,
560+
)
561+
return self._stubs["import_customer"]
562+
521563
@property
522564
def provision_cloud_identity(
523565
self,

google/cloud/channel_v1/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
GetChannelPartnerLinkRequest,
8181
GetCustomerRequest,
8282
GetEntitlementRequest,
83+
ImportCustomerRequest,
8384
ListChannelPartnerLinksRequest,
8485
ListChannelPartnerLinksResponse,
8586
ListCustomersRequest,
@@ -180,6 +181,7 @@
180181
"GetChannelPartnerLinkRequest",
181182
"GetCustomerRequest",
182183
"GetEntitlementRequest",
184+
"ImportCustomerRequest",
183185
"ListChannelPartnerLinksRequest",
184186
"ListChannelPartnerLinksResponse",
185187
"ListCustomersRequest",

google/cloud/channel_v1/types/customers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class Customer(proto.Message):
5050
will receive a notification with credentials
5151
when you create an admin.google.com account.
5252
Secondary emails are also recovery email
53-
addresses.
53+
addresses. Alternate emails are optional when
54+
you create Team customers.
5455
domain (str):
5556
Required. The customer's primary domain. Must
5657
match the primary contact email's domain.
@@ -100,8 +101,10 @@ class ContactInfo(proto.Message):
100101
Attributes:
101102
first_name (str):
102103
The customer account contact's first name.
104+
Optional for Team customers.
103105
last_name (str):
104106
The customer account contact's last name.
107+
Optional for Team customers.
105108
display_name (str):
106109
Output only. The customer account contact's
107110
display name, formatted as a combination of the
@@ -110,7 +113,8 @@ class ContactInfo(proto.Message):
110113
The customer account's contact email.
111114
Required for entitlements that create
112115
admin.google.com accounts, and serves as the
113-
customer's username for those accounts.
116+
customer's username for those accounts. Use this
117+
email to invite Team customers.
114118
title (str):
115119
Optional. The customer account contact's job
116120
title.

0 commit comments

Comments
 (0)