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

feat: add API ImportCustomer for Cloud Channel API docs: update comments for a few fields #175

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -805,6 +805,92 @@ public final UnaryCallable<DeleteCustomerRequest, Empty> deleteCustomerCallable(
return stub.deleteCustomerCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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.
*
* <p>Possible error codes:
*
* <ul>
* <li>PERMISSION_DENIED: The reseller account making the request is different from the reseller
* account in the API request.
* <li>NOT_FOUND: Cloud Identity doesn't exist or was deleted.
* <li>INVALID_ARGUMENT: Required parameters are missing, or the auth_token is expired or
* invalid.
* <li>ALREADY_EXISTS: A customer already exists and has conflicting critical fields. Requires
* an overwrite.
* </ul>
*
* <p>Return value: The [Customer][google.cloud.channel.v1.Customer].
*
* <p>Sample code:
*
* <pre>{@code
* try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) {
* ImportCustomerRequest request =
* ImportCustomerRequest.newBuilder()
* .setParent("parent-995424086")
* .setAuthToken("authToken1450587441")
* .setOverwriteIfExists(true)
* .setChannelPartnerId("channelPartnerId-170366400")
* .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString())
* .build();
* Customer response = cloudChannelServiceClient.importCustomer(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Customer importCustomer(ImportCustomerRequest request) {
return importCustomerCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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.
*
* <p>Possible error codes:
*
* <ul>
* <li>PERMISSION_DENIED: The reseller account making the request is different from the reseller
* account in the API request.
* <li>NOT_FOUND: Cloud Identity doesn't exist or was deleted.
* <li>INVALID_ARGUMENT: Required parameters are missing, or the auth_token is expired or
* invalid.
* <li>ALREADY_EXISTS: A customer already exists and has conflicting critical fields. Requires
* an overwrite.
* </ul>
*
* <p>Return value: The [Customer][google.cloud.channel.v1.Customer].
*
* <p>Sample code:
*
* <pre>{@code
* try (CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.create()) {
* ImportCustomerRequest request =
* ImportCustomerRequest.newBuilder()
* .setParent("parent-995424086")
* .setAuthToken("authToken1450587441")
* .setOverwriteIfExists(true)
* .setChannelPartnerId("channelPartnerId-170366400")
* .setCustomer(CustomerName.of("[ACCOUNT]", "[CUSTOMER]").toString())
* .build();
* ApiFuture<Customer> future =
* cloudChannelServiceClient.importCustomerCallable().futureCall(request);
* // Do something.
* Customer response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<ImportCustomerRequest, Customer> importCustomerCallable() {
return stub.importCustomerCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Cloud Identity for the given customer using the customer's information, or the
Expand Down
Expand Up @@ -117,6 +117,11 @@ public UnaryCallSettings<DeleteCustomerRequest, Empty> deleteCustomerSettings()
return ((CloudChannelServiceStubSettings) getStubSettings()).deleteCustomerSettings();
}

/** Returns the object with the settings used for calls to importCustomer. */
public UnaryCallSettings<ImportCustomerRequest, Customer> importCustomerSettings() {
return ((CloudChannelServiceStubSettings) getStubSettings()).importCustomerSettings();
}

/** Returns the object with the settings used for calls to provisionCloudIdentity. */
public UnaryCallSettings<ProvisionCloudIdentityRequest, Operation>
provisionCloudIdentitySettings() {
Expand Down Expand Up @@ -499,6 +504,11 @@ public UnaryCallSettings.Builder<DeleteCustomerRequest, Empty> deleteCustomerSet
return getStubSettingsBuilder().deleteCustomerSettings();
}

/** Returns the builder for the settings used for calls to importCustomer. */
public UnaryCallSettings.Builder<ImportCustomerRequest, Customer> importCustomerSettings() {
return getStubSettingsBuilder().importCustomerSettings();
}

/** Returns the builder for the settings used for calls to provisionCloudIdentity. */
public UnaryCallSettings.Builder<ProvisionCloudIdentityRequest, Operation>
provisionCloudIdentitySettings() {
Expand Down
Expand Up @@ -49,6 +49,9 @@
"GetEntitlement": {
"methods": ["getEntitlement", "getEntitlementCallable"]
},
"ImportCustomer": {
"methods": ["importCustomer", "importCustomerCallable"]
},
"ListChannelPartnerLinks": {
"methods": ["listChannelPartnerLinks", "listChannelPartnerLinksPagedCallable", "listChannelPartnerLinksCallable"]
},
Expand Down
Expand Up @@ -48,6 +48,7 @@
import com.google.cloud.channel.v1.GetChannelPartnerLinkRequest;
import com.google.cloud.channel.v1.GetCustomerRequest;
import com.google.cloud.channel.v1.GetEntitlementRequest;
import com.google.cloud.channel.v1.ImportCustomerRequest;
import com.google.cloud.channel.v1.ListChannelPartnerLinksRequest;
import com.google.cloud.channel.v1.ListChannelPartnerLinksResponse;
import com.google.cloud.channel.v1.ListCustomersRequest;
Expand Down Expand Up @@ -135,6 +136,10 @@ public UnaryCallable<DeleteCustomerRequest, Empty> deleteCustomerCallable() {
throw new UnsupportedOperationException("Not implemented: deleteCustomerCallable()");
}

public UnaryCallable<ImportCustomerRequest, Customer> importCustomerCallable() {
throw new UnsupportedOperationException("Not implemented: importCustomerCallable()");
}

public OperationCallable<ProvisionCloudIdentityRequest, Customer, OperationMetadata>
provisionCloudIdentityOperationCallable() {
throw new UnsupportedOperationException(
Expand Down
Expand Up @@ -71,6 +71,7 @@
import com.google.cloud.channel.v1.GetChannelPartnerLinkRequest;
import com.google.cloud.channel.v1.GetCustomerRequest;
import com.google.cloud.channel.v1.GetEntitlementRequest;
import com.google.cloud.channel.v1.ImportCustomerRequest;
import com.google.cloud.channel.v1.ListChannelPartnerLinksRequest;
import com.google.cloud.channel.v1.ListChannelPartnerLinksResponse;
import com.google.cloud.channel.v1.ListCustomersRequest;
Expand Down Expand Up @@ -174,6 +175,7 @@ public class CloudChannelServiceStubSettings extends StubSettings<CloudChannelSe
private final UnaryCallSettings<CreateCustomerRequest, Customer> createCustomerSettings;
private final UnaryCallSettings<UpdateCustomerRequest, Customer> updateCustomerSettings;
private final UnaryCallSettings<DeleteCustomerRequest, Empty> deleteCustomerSettings;
private final UnaryCallSettings<ImportCustomerRequest, Customer> importCustomerSettings;
private final UnaryCallSettings<ProvisionCloudIdentityRequest, Operation>
provisionCloudIdentitySettings;
private final OperationCallSettings<ProvisionCloudIdentityRequest, Customer, OperationMetadata>
Expand Down Expand Up @@ -953,6 +955,11 @@ public UnaryCallSettings<DeleteCustomerRequest, Empty> deleteCustomerSettings()
return deleteCustomerSettings;
}

/** Returns the object with the settings used for calls to importCustomer. */
public UnaryCallSettings<ImportCustomerRequest, Customer> importCustomerSettings() {
return importCustomerSettings;
}

/** Returns the object with the settings used for calls to provisionCloudIdentity. */
public UnaryCallSettings<ProvisionCloudIdentityRequest, Operation>
provisionCloudIdentitySettings() {
Expand Down Expand Up @@ -1276,6 +1283,7 @@ protected CloudChannelServiceStubSettings(Builder settingsBuilder) throws IOExce
createCustomerSettings = settingsBuilder.createCustomerSettings().build();
updateCustomerSettings = settingsBuilder.updateCustomerSettings().build();
deleteCustomerSettings = settingsBuilder.deleteCustomerSettings().build();
importCustomerSettings = settingsBuilder.importCustomerSettings().build();
provisionCloudIdentitySettings = settingsBuilder.provisionCloudIdentitySettings().build();
provisionCloudIdentityOperationSettings =
settingsBuilder.provisionCloudIdentityOperationSettings().build();
Expand Down Expand Up @@ -1340,6 +1348,7 @@ public static class Builder
private final UnaryCallSettings.Builder<CreateCustomerRequest, Customer> createCustomerSettings;
private final UnaryCallSettings.Builder<UpdateCustomerRequest, Customer> updateCustomerSettings;
private final UnaryCallSettings.Builder<DeleteCustomerRequest, Empty> deleteCustomerSettings;
private final UnaryCallSettings.Builder<ImportCustomerRequest, Customer> importCustomerSettings;
private final UnaryCallSettings.Builder<ProvisionCloudIdentityRequest, Operation>
provisionCloudIdentitySettings;
private final OperationCallSettings.Builder<
Expand Down Expand Up @@ -1500,6 +1509,7 @@ protected Builder(ClientContext clientContext) {
createCustomerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
updateCustomerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
deleteCustomerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
importCustomerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
provisionCloudIdentitySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
provisionCloudIdentityOperationSettings = OperationCallSettings.newBuilder();
listEntitlementsSettings = PagedCallSettings.newBuilder(LIST_ENTITLEMENTS_PAGE_STR_FACT);
Expand Down Expand Up @@ -1553,6 +1563,7 @@ protected Builder(ClientContext clientContext) {
createCustomerSettings,
updateCustomerSettings,
deleteCustomerSettings,
importCustomerSettings,
provisionCloudIdentitySettings,
listEntitlementsSettings,
listTransferableSkusSettings,
Expand Down Expand Up @@ -1594,6 +1605,7 @@ protected Builder(CloudChannelServiceStubSettings settings) {
createCustomerSettings = settings.createCustomerSettings.toBuilder();
updateCustomerSettings = settings.updateCustomerSettings.toBuilder();
deleteCustomerSettings = settings.deleteCustomerSettings.toBuilder();
importCustomerSettings = settings.importCustomerSettings.toBuilder();
provisionCloudIdentitySettings = settings.provisionCloudIdentitySettings.toBuilder();
provisionCloudIdentityOperationSettings =
settings.provisionCloudIdentityOperationSettings.toBuilder();
Expand Down Expand Up @@ -1649,6 +1661,7 @@ protected Builder(CloudChannelServiceStubSettings settings) {
createCustomerSettings,
updateCustomerSettings,
deleteCustomerSettings,
importCustomerSettings,
provisionCloudIdentitySettings,
listEntitlementsSettings,
listTransferableSkusSettings,
Expand Down Expand Up @@ -1723,6 +1736,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

builder
.importCustomerSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

builder
.provisionCloudIdentitySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
Expand Down Expand Up @@ -2180,6 +2198,11 @@ public UnaryCallSettings.Builder<DeleteCustomerRequest, Empty> deleteCustomerSet
return deleteCustomerSettings;
}

/** Returns the builder for the settings used for calls to importCustomer. */
public UnaryCallSettings.Builder<ImportCustomerRequest, Customer> importCustomerSettings() {
return importCustomerSettings;
}

/** Returns the builder for the settings used for calls to provisionCloudIdentity. */
public UnaryCallSettings.Builder<ProvisionCloudIdentityRequest, Operation>
provisionCloudIdentitySettings() {
Expand Down
Expand Up @@ -52,6 +52,7 @@
import com.google.cloud.channel.v1.GetChannelPartnerLinkRequest;
import com.google.cloud.channel.v1.GetCustomerRequest;
import com.google.cloud.channel.v1.GetEntitlementRequest;
import com.google.cloud.channel.v1.ImportCustomerRequest;
import com.google.cloud.channel.v1.ListChannelPartnerLinksRequest;
import com.google.cloud.channel.v1.ListChannelPartnerLinksResponse;
import com.google.cloud.channel.v1.ListCustomersRequest;
Expand Down Expand Up @@ -173,6 +174,16 @@ public class GrpcCloudChannelServiceStub extends CloudChannelServiceStub {
.setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance()))
.build();

private static final MethodDescriptor<ImportCustomerRequest, Customer>
importCustomerMethodDescriptor =
MethodDescriptor.<ImportCustomerRequest, Customer>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.channel.v1.CloudChannelService/ImportCustomer")
.setRequestMarshaller(
ProtoUtils.marshaller(ImportCustomerRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Customer.getDefaultInstance()))
.build();

private static final MethodDescriptor<ProvisionCloudIdentityRequest, Operation>
provisionCloudIdentityMethodDescriptor =
MethodDescriptor.<ProvisionCloudIdentityRequest, Operation>newBuilder()
Expand Down Expand Up @@ -479,6 +490,7 @@ public class GrpcCloudChannelServiceStub extends CloudChannelServiceStub {
private final UnaryCallable<CreateCustomerRequest, Customer> createCustomerCallable;
private final UnaryCallable<UpdateCustomerRequest, Customer> updateCustomerCallable;
private final UnaryCallable<DeleteCustomerRequest, Empty> deleteCustomerCallable;
private final UnaryCallable<ImportCustomerRequest, Customer> importCustomerCallable;
private final UnaryCallable<ProvisionCloudIdentityRequest, Operation>
provisionCloudIdentityCallable;
private final OperationCallable<ProvisionCloudIdentityRequest, Customer, OperationMetadata>
Expand Down Expand Up @@ -672,6 +684,16 @@ protected GrpcCloudChannelServiceStub(
return params.build();
})
.build();
GrpcCallSettings<ImportCustomerRequest, Customer> importCustomerTransportSettings =
GrpcCallSettings.<ImportCustomerRequest, Customer>newBuilder()
.setMethodDescriptor(importCustomerMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
})
.build();
GrpcCallSettings<ProvisionCloudIdentityRequest, Operation>
provisionCloudIdentityTransportSettings =
GrpcCallSettings.<ProvisionCloudIdentityRequest, Operation>newBuilder()
Expand Down Expand Up @@ -988,6 +1010,9 @@ protected GrpcCloudChannelServiceStub(
this.deleteCustomerCallable =
callableFactory.createUnaryCallable(
deleteCustomerTransportSettings, settings.deleteCustomerSettings(), clientContext);
this.importCustomerCallable =
callableFactory.createUnaryCallable(
importCustomerTransportSettings, settings.importCustomerSettings(), clientContext);
this.provisionCloudIdentityCallable =
callableFactory.createUnaryCallable(
provisionCloudIdentityTransportSettings,
Expand Down Expand Up @@ -1261,6 +1286,11 @@ public UnaryCallable<DeleteCustomerRequest, Empty> deleteCustomerCallable() {
return deleteCustomerCallable;
}

@Override
public UnaryCallable<ImportCustomerRequest, Customer> importCustomerCallable() {
return importCustomerCallable;
}

@Override
public UnaryCallable<ProvisionCloudIdentityRequest, Operation> provisionCloudIdentityCallable() {
return provisionCloudIdentityCallable;
Expand Down