Skip to content
Permalink
Browse files
feat: add ImportCustomer (#90)
- [ ] 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 committed Sep 23, 2021
1 parent d338a34 commit 2bb2d8987da8a6138bef45c5fd278cb25235cfa7
@@ -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
@@ -176,6 +177,7 @@
"GetChannelPartnerLinkRequest",
"GetCustomerRequest",
"GetEntitlementRequest",
"ImportCustomerRequest",
"ListChannelPartnerLinksRequest",
"ListChannelPartnerLinksResponse",
"ListCustomersRequest",
@@ -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
@@ -146,6 +147,7 @@
"GetChannelPartnerLinkRequest",
"GetCustomerRequest",
"GetEntitlementRequest",
"ImportCustomerRequest",
"ListChannelPartnerLinksRequest",
"ListChannelPartnerLinksResponse",
"ListCustomersRequest",
@@ -75,6 +75,11 @@
"get_entitlement"
]
},
"ImportCustomer": {
"methods": [
"import_customer"
]
},
"ListChannelPartnerLinks": {
"methods": [
"list_channel_partner_links"
@@ -250,6 +255,11 @@
"get_entitlement"
]
},
"ImportCustomer": {
"methods": [
"import_customer"
]
},
"ListChannelPartnerLinks": {
"methods": [
"list_channel_partner_links"
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -80,6 +80,7 @@
GetChannelPartnerLinkRequest,
GetCustomerRequest,
GetEntitlementRequest,
ImportCustomerRequest,
ListChannelPartnerLinksRequest,
ListChannelPartnerLinksResponse,
ListCustomersRequest,
@@ -180,6 +181,7 @@
"GetChannelPartnerLinkRequest",
"GetCustomerRequest",
"GetEntitlementRequest",
"ImportCustomerRequest",
"ListChannelPartnerLinksRequest",
"ListChannelPartnerLinksResponse",
"ListCustomersRequest",
@@ -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.
@@ -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
@@ -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.
Loading

0 comments on commit 2bb2d89

Please sign in to comment.