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

fix!: mark some bools as optional, correct response type of DeleteCaPool #216

Merged
merged 2 commits into from Aug 10, 2021
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 @@ -2858,7 +2858,7 @@ public final UnaryCallable<ListCaPoolsRequest, ListCaPoolsResponse> listCaPoolsC
* try (CertificateAuthorityServiceClient certificateAuthorityServiceClient =
* CertificateAuthorityServiceClient.create()) {
* CaPoolName name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]");
* CaPool response = certificateAuthorityServiceClient.deleteCaPoolAsync(name).get();
* certificateAuthorityServiceClient.deleteCaPoolAsync(name).get();
* }
* }</pre>
*
Expand All @@ -2867,7 +2867,7 @@ public final UnaryCallable<ListCaPoolsRequest, ListCaPoolsResponse> listCaPoolsC
* `projects/&#42;/locations/&#42;/caPools/&#42;`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<CaPool, OperationMetadata> deleteCaPoolAsync(CaPoolName name) {
public final OperationFuture<Empty, OperationMetadata> deleteCaPoolAsync(CaPoolName name) {
DeleteCaPoolRequest request =
DeleteCaPoolRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deleteCaPoolAsync(request);
Expand All @@ -2883,7 +2883,7 @@ public final OperationFuture<CaPool, OperationMetadata> deleteCaPoolAsync(CaPool
* try (CertificateAuthorityServiceClient certificateAuthorityServiceClient =
* CertificateAuthorityServiceClient.create()) {
* String name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString();
* CaPool response = certificateAuthorityServiceClient.deleteCaPoolAsync(name).get();
* certificateAuthorityServiceClient.deleteCaPoolAsync(name).get();
* }
* }</pre>
*
Expand All @@ -2892,7 +2892,7 @@ public final OperationFuture<CaPool, OperationMetadata> deleteCaPoolAsync(CaPool
* `projects/&#42;/locations/&#42;/caPools/&#42;`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<CaPool, OperationMetadata> deleteCaPoolAsync(String name) {
public final OperationFuture<Empty, OperationMetadata> deleteCaPoolAsync(String name) {
DeleteCaPoolRequest request = DeleteCaPoolRequest.newBuilder().setName(name).build();
return deleteCaPoolAsync(request);
}
Expand All @@ -2911,14 +2911,14 @@ public final OperationFuture<CaPool, OperationMetadata> deleteCaPoolAsync(String
* .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString())
* .setRequestId("requestId693933066")
* .build();
* CaPool response = certificateAuthorityServiceClient.deleteCaPoolAsync(request).get();
* certificateAuthorityServiceClient.deleteCaPoolAsync(request).get();
* }
* }</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 OperationFuture<CaPool, OperationMetadata> deleteCaPoolAsync(
public final OperationFuture<Empty, OperationMetadata> deleteCaPoolAsync(
DeleteCaPoolRequest request) {
return deleteCaPoolOperationCallable().futureCall(request);
}
Expand All @@ -2937,14 +2937,14 @@ public final OperationFuture<CaPool, OperationMetadata> deleteCaPoolAsync(
* .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString())
* .setRequestId("requestId693933066")
* .build();
* OperationFuture<CaPool, OperationMetadata> future =
* OperationFuture<Empty, OperationMetadata> future =
* certificateAuthorityServiceClient.deleteCaPoolOperationCallable().futureCall(request);
* // Do something.
* CaPool response = future.get();
* future.get();
* }
* }</pre>
*/
public final OperationCallable<DeleteCaPoolRequest, CaPool, OperationMetadata>
public final OperationCallable<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationCallable() {
return stub.deleteCaPoolOperationCallable();
}
Expand All @@ -2966,7 +2966,7 @@ public final OperationFuture<CaPool, OperationMetadata> deleteCaPoolAsync(
* ApiFuture<Operation> future =
* certificateAuthorityServiceClient.deleteCaPoolCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* future.get();
* }
* }</pre>
*/
Expand Down
Expand Up @@ -279,7 +279,7 @@ public UnaryCallSettings<DeleteCaPoolRequest, Operation> deleteCaPoolSettings()
}

/** Returns the object with the settings used for calls to deleteCaPool. */
public OperationCallSettings<DeleteCaPoolRequest, CaPool, OperationMetadata>
public OperationCallSettings<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationSettings() {
return ((CertificateAuthorityServiceStubSettings) getStubSettings())
.deleteCaPoolOperationSettings();
Expand Down Expand Up @@ -665,7 +665,7 @@ public UnaryCallSettings.Builder<DeleteCaPoolRequest, Operation> deleteCaPoolSet
}

/** Returns the builder for the settings used for calls to deleteCaPool. */
public OperationCallSettings.Builder<DeleteCaPoolRequest, CaPool, OperationMetadata>
public OperationCallSettings.Builder<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationSettings() {
return getStubSettingsBuilder().deleteCaPoolOperationSettings();
}
Expand Down
Expand Up @@ -255,7 +255,7 @@ public UnaryCallable<ListCaPoolsRequest, ListCaPoolsResponse> listCaPoolsCallabl
throw new UnsupportedOperationException("Not implemented: listCaPoolsCallable()");
}

public OperationCallable<DeleteCaPoolRequest, CaPool, OperationMetadata>
public OperationCallable<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationCallable() {
throw new UnsupportedOperationException("Not implemented: deleteCaPoolOperationCallable()");
}
Expand Down
Expand Up @@ -203,7 +203,7 @@ public class CertificateAuthorityServiceStubSettings
private final PagedCallSettings<ListCaPoolsRequest, ListCaPoolsResponse, ListCaPoolsPagedResponse>
listCaPoolsSettings;
private final UnaryCallSettings<DeleteCaPoolRequest, Operation> deleteCaPoolSettings;
private final OperationCallSettings<DeleteCaPoolRequest, CaPool, OperationMetadata>
private final OperationCallSettings<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationSettings;
private final UnaryCallSettings<FetchCaCertsRequest, FetchCaCertsResponse> fetchCaCertsSettings;
private final UnaryCallSettings<GetCertificateRevocationListRequest, CertificateRevocationList>
Expand Down Expand Up @@ -764,7 +764,7 @@ public UnaryCallSettings<DeleteCaPoolRequest, Operation> deleteCaPoolSettings()
}

/** Returns the object with the settings used for calls to deleteCaPool. */
public OperationCallSettings<DeleteCaPoolRequest, CaPool, OperationMetadata>
public OperationCallSettings<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationSettings() {
return deleteCaPoolOperationSettings;
}
Expand Down Expand Up @@ -1068,7 +1068,7 @@ public static class Builder
ListCaPoolsRequest, ListCaPoolsResponse, ListCaPoolsPagedResponse>
listCaPoolsSettings;
private final UnaryCallSettings.Builder<DeleteCaPoolRequest, Operation> deleteCaPoolSettings;
private final OperationCallSettings.Builder<DeleteCaPoolRequest, CaPool, OperationMetadata>
private final OperationCallSettings.Builder<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationSettings;
private final UnaryCallSettings.Builder<FetchCaCertsRequest, FetchCaCertsResponse>
fetchCaCertsSettings;
Expand Down Expand Up @@ -1719,7 +1719,7 @@ private static Builder initDefaults(Builder builder) {
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(CaPool.class))
ProtoOperationTransformers.ResponseTransformer.create(Empty.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class))
.setPollingAlgorithm(
Expand Down Expand Up @@ -2057,7 +2057,7 @@ public UnaryCallSettings.Builder<DeleteCaPoolRequest, Operation> deleteCaPoolSet
/** Returns the builder for the settings used for calls to deleteCaPool. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<DeleteCaPoolRequest, CaPool, OperationMetadata>
public OperationCallSettings.Builder<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationSettings() {
return deleteCaPoolOperationSettings;
}
Expand Down
Expand Up @@ -491,7 +491,7 @@ public class GrpcCertificateAuthorityServiceStub extends CertificateAuthoritySer
private final UnaryCallable<ListCaPoolsRequest, ListCaPoolsPagedResponse>
listCaPoolsPagedCallable;
private final UnaryCallable<DeleteCaPoolRequest, Operation> deleteCaPoolCallable;
private final OperationCallable<DeleteCaPoolRequest, CaPool, OperationMetadata>
private final OperationCallable<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationCallable;
private final UnaryCallable<FetchCaCertsRequest, FetchCaCertsResponse> fetchCaCertsCallable;
private final UnaryCallable<GetCertificateRevocationListRequest, CertificateRevocationList>
Expand Down Expand Up @@ -1432,7 +1432,7 @@ public UnaryCallable<DeleteCaPoolRequest, Operation> deleteCaPoolCallable() {
}

@Override
public OperationCallable<DeleteCaPoolRequest, CaPool, OperationMetadata>
public OperationCallable<DeleteCaPoolRequest, Empty, OperationMetadata>
deleteCaPoolOperationCallable() {
return deleteCaPoolOperationCallable;
}
Expand Down
Expand Up @@ -2075,13 +2075,7 @@ public void listCaPoolsExceptionTest2() throws Exception {

@Test
public void deleteCaPoolTest() throws Exception {
CaPool expectedResponse =
CaPool.newBuilder()
.setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString())
.setIssuancePolicy(CaPool.IssuancePolicy.newBuilder().build())
.setPublishingOptions(CaPool.PublishingOptions.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.build();
Empty expectedResponse = Empty.newBuilder().build();
Operation resultOperation =
Operation.newBuilder()
.setName("deleteCaPoolTest")
Expand All @@ -2092,8 +2086,7 @@ public void deleteCaPoolTest() throws Exception {

CaPoolName name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]");

CaPool actualResponse = client.deleteCaPoolAsync(name).get();
Assert.assertEquals(expectedResponse, actualResponse);
client.deleteCaPoolAsync(name).get();

List<AbstractMessage> actualRequests = mockCertificateAuthorityService.getRequests();
Assert.assertEquals(1, actualRequests.size());
Expand Down Expand Up @@ -2124,13 +2117,7 @@ public void deleteCaPoolExceptionTest() throws Exception {

@Test
public void deleteCaPoolTest2() throws Exception {
CaPool expectedResponse =
CaPool.newBuilder()
.setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString())
.setIssuancePolicy(CaPool.IssuancePolicy.newBuilder().build())
.setPublishingOptions(CaPool.PublishingOptions.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.build();
Empty expectedResponse = Empty.newBuilder().build();
Operation resultOperation =
Operation.newBuilder()
.setName("deleteCaPoolTest")
Expand All @@ -2141,8 +2128,7 @@ public void deleteCaPoolTest2() throws Exception {

String name = "name3373707";

CaPool actualResponse = client.deleteCaPoolAsync(name).get();
Assert.assertEquals(expectedResponse, actualResponse);
client.deleteCaPoolAsync(name).get();

List<AbstractMessage> actualRequests = mockCertificateAuthorityService.getRequests();
Assert.assertEquals(1, actualRequests.size());
Expand Down