From f9bbbcad94978f4a8dde60e68c341e8738348146 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 5 Aug 2022 06:26:11 +0000 Subject: [PATCH] fix!: Removed resource definition of Compute API resources and incorrect resource references that used them (#58) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 459444490 Source-Link: https://github.com/googleapis/googleapis/commit/24f07365460e63c486a99eab4a883cfc3c49ed7d Source-Link: https://github.com/googleapis/googleapis-gen/commit/cd5440ba0eed0fc86bc3a510ba5a1dfba82c82b0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2Q1NDQwYmEwZWVkMGZjODZiYzNhNTEwYmE1YTFkZmJhODJjODJiMCJ9 --- .../google-cloud-certificate-manager/pom.xml | 5 +- .../v1/CertificateManagerClient.java | 222 ++++++++++ .../v1/CertificateManagerSettings.java | 28 ++ .../certificatemanager/v1/gapic_metadata.json | 6 + .../v1/stub/CertificateManagerStub.java | 18 + .../stub/CertificateManagerStubSettings.java | 116 +++++- .../v1/stub/GrpcCertificateManagerStub.java | 73 ++++ .../stub/HttpJsonCertificateManagerStub.java | 113 ++++++ .../CertificateManagerClientHttpJsonTest.java | 121 ++++++ .../v1/CertificateManagerClientTest.java | 111 ++++- .../certificatemanager/v1/MockLocations.java | 59 +++ .../v1/MockLocationsImpl.java | 105 +++++ .../v1/CertificateManagerProto.java | 384 +++++++++--------- .../certificatemanager/v1/CertificateMap.java | 144 +++---- .../v1/certificate_manager.proto | 26 +- .../getlocation/AsyncGetLocation.java | 43 ++ .../getlocation/SyncGetLocation.java | 39 ++ .../listlocations/AsyncListLocations.java | 51 +++ .../AsyncListLocationsPaged.java | 59 +++ .../listlocations/SyncListLocations.java | 47 +++ 20 files changed, 1478 insertions(+), 292 deletions(-) create mode 100644 java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/MockLocations.java create mode 100644 java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/MockLocationsImpl.java create mode 100644 java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getlocation/AsyncGetLocation.java create mode 100644 java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getlocation/SyncGetLocation.java create mode 100644 java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/AsyncListLocations.java create mode 100644 java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/AsyncListLocationsPaged.java create mode 100644 java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/SyncListLocations.java diff --git a/java-certificate-manager/google-cloud-certificate-manager/pom.xml b/java-certificate-manager/google-cloud-certificate-manager/pom.xml index eae1175d04cc..5bdca8cbd2f0 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/pom.xml +++ b/java-certificate-manager/google-cloud-certificate-manager/pom.xml @@ -41,7 +41,10 @@ com.google.api.grpc proto-google-common-protos - + + com.google.api.grpc + grpc-google-common-protos + com.google.api.grpc proto-google-cloud-certificate-manager-v1 diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerClient.java b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerClient.java index 0b39e2aeb052..bd880e568ec4 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerClient.java +++ b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerClient.java @@ -30,6 +30,10 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.certificatemanager.v1.stub.CertificateManagerStub; import com.google.cloud.certificatemanager.v1.stub.CertificateManagerStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.protobuf.Empty; @@ -2958,6 +2962,148 @@ public final OperationFuture deleteDnsAuthorizationAsy return stub.deleteDnsAuthorizationCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : certificateManagerClient.listLocations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @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 ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       certificateManagerClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response =
+   *         certificateManagerClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = certificateManagerClient.getLocation(request);
+   * }
+   * }
+ * + * @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 Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       certificateManagerClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + @Override public final void close() { stub.close(); @@ -3328,4 +3474,80 @@ protected ListDnsAuthorizationsFixedSizeCollection createCollection( return new ListDnsAuthorizationsFixedSizeCollection(pages, collectionSize); } } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } } diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerSettings.java b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerSettings.java index 972dcfca4118..6ce55076d10d 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerSettings.java +++ b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerSettings.java @@ -20,6 +20,7 @@ import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapsPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificatesPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListDnsAuthorizationsPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; @@ -35,6 +36,10 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.certificatemanager.v1.stub.CertificateManagerStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import java.io.IOException; @@ -286,6 +291,17 @@ public UnaryCallSettings deleteCertifica .deleteDnsAuthorizationOperationSettings(); } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((CertificateManagerStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((CertificateManagerStubSettings) getStubSettings()).getLocationSettings(); + } + public static final CertificateManagerSettings create(CertificateManagerStubSettings stub) throws IOException { return new CertificateManagerSettings.Builder(stub.toBuilder()).build(); @@ -608,6 +624,18 @@ public UnaryCallSettings.Builder getCertific return getStubSettingsBuilder().deleteDnsAuthorizationOperationSettings(); } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + @Override public CertificateManagerSettings build() throws IOException { return new CertificateManagerSettings(this); diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/gapic_metadata.json b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/gapic_metadata.json index d20ad25fc593..66298393c61f 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/gapic_metadata.json +++ b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/gapic_metadata.json @@ -46,6 +46,9 @@ "GetDnsAuthorization": { "methods": ["getDnsAuthorization", "getDnsAuthorization", "getDnsAuthorization", "getDnsAuthorizationCallable"] }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, "ListCertificateMapEntries": { "methods": ["listCertificateMapEntries", "listCertificateMapEntries", "listCertificateMapEntries", "listCertificateMapEntriesPagedCallable", "listCertificateMapEntriesCallable"] }, @@ -58,6 +61,9 @@ "ListDnsAuthorizations": { "methods": ["listDnsAuthorizations", "listDnsAuthorizations", "listDnsAuthorizations", "listDnsAuthorizationsPagedCallable", "listDnsAuthorizationsCallable"] }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, "UpdateCertificate": { "methods": ["updateCertificateAsync", "updateCertificateAsync", "updateCertificateOperationCallable", "updateCertificateCallable"] }, diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStub.java b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStub.java index b91593e9c045..e7f827b5415b 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStub.java +++ b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStub.java @@ -20,6 +20,7 @@ import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapsPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificatesPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListDnsAuthorizationsPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -53,6 +54,10 @@ import com.google.cloud.certificatemanager.v1.UpdateCertificateMapRequest; import com.google.cloud.certificatemanager.v1.UpdateCertificateRequest; import com.google.cloud.certificatemanager.v1.UpdateDnsAuthorizationRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -257,6 +262,19 @@ public UnaryCallable deleteDnsAuthoriz throw new UnsupportedOperationException("Not implemented: deleteDnsAuthorizationCallable()"); } + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + @Override public abstract void close(); } diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStubSettings.java b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStubSettings.java index 66f842a78e48..1bf1fd32a576 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStubSettings.java +++ b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/CertificateManagerStubSettings.java @@ -20,6 +20,7 @@ import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapsPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificatesPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListDnsAuthorizationsPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListLocationsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; @@ -79,6 +80,10 @@ import com.google.cloud.certificatemanager.v1.UpdateCertificateMapRequest; import com.google.cloud.certificatemanager.v1.UpdateCertificateRequest; import com.google.cloud.certificatemanager.v1.UpdateDnsAuthorizationRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -206,6 +211,10 @@ public class CertificateManagerStubSettings extends StubSettings deleteDnsAuthorizationOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; private static final PagedListDescriptor< ListCertificatesRequest, ListCertificatesResponse, Certificate> @@ -375,6 +384,42 @@ public Iterable extractResources( } }; + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + private static final PagedListResponseFactory< ListCertificatesRequest, ListCertificatesResponse, ListCertificatesPagedResponse> LIST_CERTIFICATES_PAGE_STR_FACT = @@ -467,6 +512,23 @@ public ApiFuture getFuturePagedResponse( } }; + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listCertificates. */ public PagedCallSettings< ListCertificatesRequest, ListCertificatesResponse, ListCertificatesPagedResponse> @@ -661,6 +723,17 @@ public UnaryCallSettings deleteCertifica return deleteDnsAuthorizationOperationSettings; } + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + public CertificateManagerStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -811,6 +884,8 @@ protected CertificateManagerStubSettings(Builder settingsBuilder) throws IOExcep deleteDnsAuthorizationSettings = settingsBuilder.deleteDnsAuthorizationSettings().build(); deleteDnsAuthorizationOperationSettings = settingsBuilder.deleteDnsAuthorizationOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); } /** Builder for CertificateManagerStubSettings. */ @@ -902,6 +977,10 @@ public static class Builder private final OperationCallSettings.Builder< DeleteDnsAuthorizationRequest, Empty, OperationMetadata> deleteDnsAuthorizationOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -911,6 +990,7 @@ public static class Builder definitions.put( "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -930,6 +1010,8 @@ public static class Builder .setTotalTimeout(Duration.ofMillis(60000L)) .build(); definitions.put("retry_policy_0_params", settings); + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } @@ -975,6 +1057,8 @@ protected Builder(ClientContext clientContext) { updateDnsAuthorizationOperationSettings = OperationCallSettings.newBuilder(); deleteDnsAuthorizationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteDnsAuthorizationOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -997,7 +1081,9 @@ protected Builder(ClientContext clientContext) { getDnsAuthorizationSettings, createDnsAuthorizationSettings, updateDnsAuthorizationSettings, - deleteDnsAuthorizationSettings); + deleteDnsAuthorizationSettings, + listLocationsSettings, + getLocationSettings); initDefaults(this); } @@ -1045,6 +1131,8 @@ protected Builder(CertificateManagerStubSettings settings) { deleteDnsAuthorizationSettings = settings.deleteDnsAuthorizationSettings.toBuilder(); deleteDnsAuthorizationOperationSettings = settings.deleteDnsAuthorizationOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -1067,7 +1155,9 @@ protected Builder(CertificateManagerStubSettings settings) { getDnsAuthorizationSettings, createDnsAuthorizationSettings, updateDnsAuthorizationSettings, - deleteDnsAuthorizationSettings); + deleteDnsAuthorizationSettings, + listLocationsSettings, + getLocationSettings); } private static Builder createDefault() { @@ -1197,6 +1287,16 @@ 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 + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder .createCertificateOperationSettings() .setInitialCallSettings( @@ -1737,6 +1837,18 @@ public UnaryCallSettings.Builder getCertific return deleteDnsAuthorizationOperationSettings; } + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + @Override public CertificateManagerStubSettings build() throws IOException { return new CertificateManagerStubSettings(this); diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/GrpcCertificateManagerStub.java b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/GrpcCertificateManagerStub.java index d5905464d279..8a9cf1450faa 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/GrpcCertificateManagerStub.java +++ b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/GrpcCertificateManagerStub.java @@ -20,6 +20,7 @@ import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapsPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificatesPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListDnsAuthorizationsPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -57,6 +58,10 @@ import com.google.cloud.certificatemanager.v1.UpdateCertificateMapRequest; import com.google.cloud.certificatemanager.v1.UpdateCertificateRequest; import com.google.cloud.certificatemanager.v1.UpdateDnsAuthorizationRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; @@ -302,6 +307,25 @@ public class GrpcCertificateManagerStub extends CertificateManagerStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + private final UnaryCallable listCertificatesCallable; private final UnaryCallable @@ -371,6 +395,10 @@ public class GrpcCertificateManagerStub extends CertificateManagerStub { deleteDnsAuthorizationCallable; private final OperationCallable deleteDnsAuthorizationOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -637,6 +665,26 @@ protected GrpcCertificateManagerStub( return params.build(); }) .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); this.listCertificatesCallable = callableFactory.createUnaryCallable( @@ -824,6 +872,15 @@ protected GrpcCertificateManagerStub( settings.deleteDnsAuthorizationOperationSettings(), clientContext, operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -1037,6 +1094,22 @@ public UnaryCallable deleteDnsAuthoriz return deleteDnsAuthorizationOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerStub.java b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerStub.java index 0683ebefcd97..fc9c23216bad 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerStub.java +++ b/java-certificate-manager/google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/stub/HttpJsonCertificateManagerStub.java @@ -20,6 +20,7 @@ import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapsPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificatesPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListDnsAuthorizationsPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListLocationsPagedResponse; import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; @@ -65,6 +66,10 @@ import com.google.cloud.certificatemanager.v1.UpdateCertificateMapRequest; import com.google.cloud.certificatemanager.v1.UpdateCertificateRequest; import com.google.cloud.certificatemanager.v1.UpdateDnsAuthorizationRequest; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; @@ -879,6 +884,72 @@ public class HttpJsonCertificateManagerStub extends CertificateManagerStub { HttpJsonOperationSnapshot.create(response)) .build(); + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private final UnaryCallable listCertificatesCallable; private final UnaryCallable @@ -948,6 +1019,10 @@ public class HttpJsonCertificateManagerStub extends CertificateManagerStub { deleteDnsAuthorizationCallable; private final OperationCallable deleteDnsAuthorizationOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -1115,6 +1190,17 @@ protected HttpJsonCertificateManagerStub( .setMethodDescriptor(deleteDnsAuthorizationMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listCertificatesCallable = callableFactory.createUnaryCallable( @@ -1302,6 +1388,15 @@ protected HttpJsonCertificateManagerStub( settings.deleteDnsAuthorizationOperationSettings(), clientContext, httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -1330,6 +1425,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(createDnsAuthorizationMethodDescriptor); methodDescriptors.add(updateDnsAuthorizationMethodDescriptor); methodDescriptors.add(deleteDnsAuthorizationMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @@ -1541,6 +1638,22 @@ public UnaryCallable deleteDnsAuthoriz return deleteDnsAuthorizationOperationCallable; } + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + @Override public final void close() { try { diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientHttpJsonTest.java b/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientHttpJsonTest.java index 349b1e0781b0..54169a7aa3a9 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientHttpJsonTest.java +++ b/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientHttpJsonTest.java @@ -20,6 +20,7 @@ import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapsPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificatesPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListDnsAuthorizationsPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.httpjson.GaxHttpJsonProperties; @@ -31,6 +32,10 @@ import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.testing.FakeStatusCode; import com.google.cloud.certificatemanager.v1.stub.HttpJsonCertificateManagerStub; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.Any; @@ -2112,4 +2117,120 @@ public void deleteDnsAuthorizationExceptionTest2() throws Exception { } catch (ExecutionException e) { } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientTest.java b/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientTest.java index b5adb0688547..1b3f418c49c8 100644 --- a/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientTest.java +++ b/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/CertificateManagerClientTest.java @@ -20,6 +20,7 @@ import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificateMapsPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListCertificatesPagedResponse; import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListDnsAuthorizationsPagedResponse; +import static com.google.cloud.certificatemanager.v1.CertificateManagerClient.ListLocationsPagedResponse; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; @@ -29,6 +30,10 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; @@ -55,6 +60,7 @@ @Generated("by gapic-generator-java") public class CertificateManagerClientTest { private static MockCertificateManager mockCertificateManager; + private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; private LocalChannelProvider channelProvider; private CertificateManagerClient client; @@ -62,9 +68,11 @@ public class CertificateManagerClientTest { @BeforeClass public static void startStaticServer() { mockCertificateManager = new MockCertificateManager(); + mockLocations = new MockLocations(); mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockCertificateManager)); + UUID.randomUUID().toString(), + Arrays.asList(mockCertificateManager, mockLocations)); mockServiceHelper.start(); } @@ -1903,4 +1911,105 @@ public void deleteDnsAuthorizationExceptionTest2() throws Exception { Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/MockLocations.java b/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/MockLocations.java new file mode 100644 index 000000000000..ad38b864779d --- /dev/null +++ b/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/MockLocations.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockLocations implements MockGrpcService { + private final MockLocationsImpl serviceImpl; + + public MockLocations() { + serviceImpl = new MockLocationsImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/MockLocationsImpl.java b/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/MockLocationsImpl.java new file mode 100644 index 000000000000..f77bebe95d93 --- /dev/null +++ b/java-certificate-manager/google-cloud-certificate-manager/src/test/java/com/google/cloud/certificatemanager/v1/MockLocationsImpl.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.cloud.location.LocationsGrpc.LocationsImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockLocationsImpl extends LocationsImplBase { + private List requests; + private Queue responses; + + public MockLocationsImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void listLocations( + ListLocationsRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListLocationsResponse) { + requests.add(request); + responseObserver.onNext(((ListLocationsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListLocations, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListLocationsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getLocation(GetLocationRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Location) { + requests.add(request); + responseObserver.onNext(((Location) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetLocation, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Location.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerProto.java b/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerProto.java index 6282899ca3cf..4828dead84fb 100644 --- a/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerProto.java +++ b/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerProto.java @@ -355,7 +355,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "CACHE\020\001:v\352As\n-certificatemanager.googlea" + "pis.com/Certificate\022Bprojects/{project}/" + "locations/{location}/certificates/{certi" - + "ficate}B\006\n\004type\"\275\006\n\016CertificateMap\022\014\n\004na" + + "ficate}B\006\n\004type\"\337\005\n\016CertificateMap\022\014\n\004na" + "me\030\001 \001(\t\022\023\n\013description\030\005 \001(\t\0224\n\013create_" + "time\030\002 \001(\0132\032.google.protobuf.TimestampB\003" + "\340A\003\0224\n\013update_time\030\006 \001(\0132\032.google.protob" @@ -363,201 +363,192 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "le.cloud.certificatemanager.v1.Certifica" + "teMap.LabelsEntry\022X\n\014gclb_targets\030\004 \003(\0132" + "=.google.cloud.certificatemanager.v1.Cer" - + "tificateMap.GclbTargetB\003\340A\003\032\277\002\n\nGclbTarg" - + "et\022L\n\022target_https_proxy\030\001 \001(\tB.\372A+\n)com" - + "pute.googleapis.com/TargetHttpsProxiesH\000" - + "\022H\n\020target_ssl_proxy\030\003 \001(\tB,\372A)\n\'compute" - + ".googleapis.com/TargetSslProxiesH\000\022Z\n\nip" - + "_configs\030\002 \003(\0132F.google.cloud.certificat" - + "emanager.v1.CertificateMap.GclbTarget.Ip" - + "Config\032-\n\010IpConfig\022\022\n\nip_address\030\001 \001(\t\022\r" - + "\n\005ports\030\003 \003(\rB\016\n\014target_proxy\032-\n\013LabelsE" - + "ntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:\200\001\352" - + "A}\n0certificatemanager.googleapis.com/Ce" - + "rtificateMap\022Iprojects/{project}/locatio" - + "ns/{location}/certificateMaps/{certifica" - + "te_map}\"\221\006\n\023CertificateMapEntry\022\014\n\004name\030" - + "\001 \001(\t\022\023\n\013description\030\t \001(\t\0224\n\013create_tim" - + "e\030\002 \001(\0132\032.google.protobuf.TimestampB\003\340A\003" - + "\0224\n\013update_time\030\003 \001(\0132\032.google.protobuf." - + "TimestampB\003\340A\003\022S\n\006labels\030\004 \003(\0132C.google." - + "cloud.certificatemanager.v1.CertificateM" - + "apEntry.LabelsEntry\022\022\n\010hostname\030\005 \001(\tH\000\022" - + "R\n\007matcher\030\n \001(\0162?.google.cloud.certific" - + "atemanager.v1.CertificateMapEntry.Matche" - + "rH\000\022H\n\014certificates\030\007 \003(\tB2\372A/\n-certific" - + "atemanager.googleapis.com/Certificate\022D\n" - + "\005state\030\010 \001(\01620.google.cloud.certificatem" - + "anager.v1.ServingStateB\003\340A\003\032-\n\013LabelsEnt" - + "ry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"/\n\007Ma" - + "tcher\022\027\n\023MATCHER_UNSPECIFIED\020\000\022\013\n\007PRIMAR" - + "Y\020\001:\264\001\352A\260\001\n5certificatemanager.googleapi" - + "s.com/CertificateMapEntry\022wprojects/{pro" - + "ject}/locations/{location}/certificateMa" - + "ps/{certificate_map}/certificateMapEntri" - + "es/{certificate_map_entry}B\007\n\005match\"\374\004\n\020" - + "DnsAuthorization\022\014\n\004name\030\001 \001(\t\0224\n\013create" - + "_time\030\002 \001(\0132\032.google.protobuf.TimestampB" - + "\003\340A\003\0224\n\013update_time\030\003 \001(\0132\032.google.proto" - + "buf.TimestampB\003\340A\003\022P\n\006labels\030\004 \003(\0132@.goo" - + "gle.cloud.certificatemanager.v1.DnsAutho" - + "rization.LabelsEntry\022\023\n\013description\030\005 \001(" - + "\t\022\026\n\006domain\030\006 \001(\tB\006\340A\002\340A\005\022h\n\023dns_resourc" - + "e_record\030\n \001(\0132F.google.cloud.certificat" - + "emanager.v1.DnsAuthorization.DnsResource" - + "RecordB\003\340A\003\032L\n\021DnsResourceRecord\022\021\n\004name" - + "\030\001 \001(\tB\003\340A\003\022\021\n\004type\030\002 \001(\tB\003\340A\003\022\021\n\004data\030\003" - + " \001(\tB\003\340A\003\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n" - + "\005value\030\002 \001(\t:\0028\001:\207\001\352A\203\001\n2certificatemana" - + "ger.googleapis.com/DnsAuthorization\022Mpro" - + "jects/{project}/locations/{location}/dns" - + "Authorizations/{dns_authorization}*F\n\014Se" - + "rvingState\022\035\n\031SERVING_STATE_UNSPECIFIED\020" - + "\000\022\n\n\006ACTIVE\020\001\022\013\n\007PENDING\020\0022\336(\n\022Certifica" - + "teManager\022\320\001\n\020ListCertificates\022;.google." - + "cloud.certificatemanager.v1.ListCertific" - + "atesRequest\032<.google.cloud.certificatema" - + "nager.v1.ListCertificatesResponse\"A\202\323\344\223\002" - + "2\0220/v1/{parent=projects/*/locations/*}/c" - + "ertificates\332A\006parent\022\275\001\n\016GetCertificate\022" - + "9.google.cloud.certificatemanager.v1.Get" - + "CertificateRequest\032/.google.cloud.certif" - + "icatemanager.v1.Certificate\"?\202\323\344\223\0022\0220/v1" - + "/{name=projects/*/locations/*/certificat" - + "es/*}\332A\004name\022\377\001\n\021CreateCertificate\022<.goo" - + "gle.cloud.certificatemanager.v1.CreateCe" - + "rtificateRequest\032\035.google.longrunning.Op" - + "eration\"\214\001\202\323\344\223\002?\"0/v1/{parent=projects/*" - + "/locations/*}/certificates:\013certificate\332" - + "A!parent,certificate,certificate_id\312A \n\013" - + "Certificate\022\021OperationMetadata\022\201\002\n\021Updat" - + "eCertificate\022<.google.cloud.certificatem" - + "anager.v1.UpdateCertificateRequest\032\035.goo" - + "gle.longrunning.Operation\"\216\001\202\323\344\223\002K2.google.cloud.certi" - + "ficatemanager.v1.ListCertificateMapsRequ" - + "est\032?.google.cloud.certificatemanager.v1" - + ".ListCertificateMapsResponse\"D\202\323\344\223\0025\0223/v" - + "1/{parent=projects/*/locations/*}/certif" - + "icateMaps\332A\006parent\022\311\001\n\021GetCertificateMap" - + "\022<.google.cloud.certificatemanager.v1.Ge" - + "tCertificateMapRequest\0322.google.cloud.ce" - + "rtificatemanager.v1.CertificateMap\"B\202\323\344\223" - + "\0025\0223/v1/{name=projects/*/locations/*/cer" - + "tificateMaps/*}\332A\004name\022\227\002\n\024CreateCertifi" - + "cateMap\022?.google.cloud.certificatemanage" - + "r.v1.CreateCertificateMapRequest\032\035.googl" - + "e.longrunning.Operation\"\236\001\202\323\344\223\002F\"3/v1/{p" - + "arent=projects/*/locations/*}/certificat" - + "eMaps:\017certificate_map\332A)parent,certific" - + "ate_map,certificate_map_id\312A#\n\016Certifica" - + "teMap\022\021OperationMetadata\022\231\002\n\024UpdateCerti" - + "ficateMap\022?.google.cloud.certificatemana" - + "ger.v1.UpdateCertificateMapRequest\032\035.goo" - + "gle.longrunning.Operation\"\240\001\202\323\344\223\002V2C/v1/" - + "{certificate_map.name=projects/*/locatio" - + "ns/*/certificateMaps/*}:\017certificate_map" - + "\332A\033certificate_map,update_mask\312A#\n\016Certi" - + "ficateMap\022\021OperationMetadata\022\347\001\n\024DeleteC" - + "ertificateMap\022?.google.cloud.certificate" - + "manager.v1.DeleteCertificateMapRequest\032\035" - + ".google.longrunning.Operation\"o\202\323\344\223\0025*3/" - + "v1/{name=projects/*/locations/*/certific" - + "ateMaps/*}\332A\004name\312A*\n\025google.protobuf.Em" - + "pty\022\021OperationMetadata\022\206\002\n\031ListCertifica" - + "teMapEntries\022D.google.cloud.certificatem" - + "anager.v1.ListCertificateMapEntriesReque" - + "st\032E.google.cloud.certificatemanager.v1." - + "ListCertificateMapEntriesResponse\"\\\202\323\344\223\002" - + "M\022K/v1/{parent=projects/*/locations/*/ce" - + "rtificateMaps/*}/certificateMapEntries\332A" - + "\006parent\022\360\001\n\026GetCertificateMapEntry\022A.goo" - + "gle.cloud.certificatemanager.v1.GetCerti" - + "ficateMapEntryRequest\0327.google.cloud.cer" - + "tificatemanager.v1.CertificateMapEntry\"Z" - + "\202\323\344\223\002M\022K/v1/{name=projects/*/locations/*" - + "/certificateMaps/*/certificateMapEntries" - + "/*}\332A\004name\022\320\002\n\031CreateCertificateMapEntry" - + "\022D.google.cloud.certificatemanager.v1.Cr" - + "eateCertificateMapEntryRequest\032\035.google." - + "longrunning.Operation\"\315\001\202\323\344\223\002d\"K/v1/{par" - + "ent=projects/*/locations/*/certificateMa" - + "ps/*}/certificateMapEntries:\025certificate" - + "_map_entry\332A5parent,certificate_map_entr" - + "y,certificate_map_entry_id\312A(\n\023Certifica" - + "teMapEntry\022\021OperationMetadata\022\322\002\n\031Update" - + "CertificateMapEntry\022D.google.cloud.certi" - + "ficatemanager.v1.UpdateCertificateMapEnt" - + "ryRequest\032\035.google.longrunning.Operation" - + "\"\317\001\202\323\344\223\002z2a/v1/{certificate_map_entry.na" - + "me=projects/*/locations/*/certificateMap" - + "s/*/certificateMapEntries/*}:\025certificat" - + "e_map_entry\332A!certificate_map_entry,upda" - + "te_mask\312A(\n\023CertificateMapEntry\022\021Operati" - + "onMetadata\022\212\002\n\031DeleteCertificateMapEntry" - + "\022D.google.cloud.certificatemanager.v1.De" - + "leteCertificateMapEntryRequest\032\035.google." - + "longrunning.Operation\"\207\001\202\323\344\223\002M*K/v1/{nam" - + "e=projects/*/locations/*/certificateMaps" - + "/*/certificateMapEntries/*}\332A\004name\312A*\n\025g" - + "oogle.protobuf.Empty\022\021OperationMetadata\022" - + "\344\001\n\025ListDnsAuthorizations\022@.google.cloud" - + ".certificatemanager.v1.ListDnsAuthorizat" - + "ionsRequest\032A.google.cloud.certificatema" - + "nager.v1.ListDnsAuthorizationsResponse\"F" - + "\202\323\344\223\0027\0225/v1/{parent=projects/*/locations" - + "/*}/dnsAuthorizations\332A\006parent\022\321\001\n\023GetDn" - + "sAuthorization\022>.google.cloud.certificat" - + "emanager.v1.GetDnsAuthorizationRequest\0324" - + ".google.cloud.certificatemanager.v1.DnsA" - + "uthorization\"D\202\323\344\223\0027\0225/v1/{name=projects" - + "/*/locations/*/dnsAuthorizations/*}\332A\004na" - + "me\022\245\002\n\026CreateDnsAuthorization\022A.google.c" - + "loud.certificatemanager.v1.CreateDnsAuth" - + "orizationRequest\032\035.google.longrunning.Op" - + "eration\"\250\001\202\323\344\223\002J\"5/v1/{parent=projects/*" - + "/locations/*}/dnsAuthorizations:\021dns_aut" - + "horization\332A-parent,dns_authorization,dn" - + "s_authorization_id\312A%\n\020DnsAuthorization\022" - + "\021OperationMetadata\022\247\002\n\026UpdateDnsAuthoriz" - + "ation\022A.google.cloud.certificatemanager." - + "v1.UpdateDnsAuthorizationRequest\032\035.googl" - + "e.longrunning.Operation\"\252\001\202\323\344\223\002\\2G/v1/{d" - + "ns_authorization.name=projects/*/locatio" - + "ns/*/dnsAuthorizations/*}:\021dns_authoriza" - + "tion\332A\035dns_authorization,update_mask\312A%\n" - + "\020DnsAuthorization\022\021OperationMetadata\022\355\001\n" - + "\026DeleteDnsAuthorization\022A.google.cloud.c" - + "ertificatemanager.v1.DeleteDnsAuthorizat" - + "ionRequest\032\035.google.longrunning.Operatio" - + "n\"q\202\323\344\223\0027*5/v1/{name=projects/*/location" - + "s/*/dnsAuthorizations/*}\332A\004name\312A*\n\025goog" - + "le.protobuf.Empty\022\021OperationMetadata\032U\312A" - + "!certificatemanager.googleapis.com\322A.htt" - + "ps://www.googleapis.com/auth/cloud-platf" - + "ormB\203\004\n&com.google.cloud.certificatemana" - + "ger.v1B\027CertificateManagerProtoP\001ZTgoogl" - + "e.golang.org/genproto/googleapis/cloud/c" - + "ertificatemanager/v1;certificatemanager\252" - + "\002\"Google.Cloud.CertificateManager.V1\312\002\"G" - + "oogle\\Cloud\\CertificateManager\\V1\352\002%Goog" - + "le::Cloud::CertificateManager::V1\352A|\n)co" - + "mpute.googleapis.com/TargetHttpsProxies\022" - + "Oprojects/{project}/locations/{location}" - + "/targetHttpsProxies/{target_https_proxy}" - + "\352Av\n\'compute.googleapis.com/TargetSslPro" - + "xies\022Kprojects/{project}/locations/{loca" - + "tion}/targetSslProxies/{target_ssl_proxy" - + "}b\006proto3" + + "tificateMap.GclbTargetB\003\340A\003\032\341\001\n\nGclbTarg" + + "et\022\034\n\022target_https_proxy\030\001 \001(\tH\000\022\032\n\020targ" + + "et_ssl_proxy\030\003 \001(\tH\000\022Z\n\nip_configs\030\002 \003(\013" + + "2F.google.cloud.certificatemanager.v1.Ce" + + "rtificateMap.GclbTarget.IpConfig\032-\n\010IpCo" + + "nfig\022\022\n\nip_address\030\001 \001(\t\022\r\n\005ports\030\003 \003(\rB" + + "\016\n\014target_proxy\032-\n\013LabelsEntry\022\013\n\003key\030\001 " + + "\001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:\200\001\352A}\n0certificat" + + "emanager.googleapis.com/CertificateMap\022I" + + "projects/{project}/locations/{location}/" + + "certificateMaps/{certificate_map}\"\221\006\n\023Ce" + + "rtificateMapEntry\022\014\n\004name\030\001 \001(\t\022\023\n\013descr" + + "iption\030\t \001(\t\0224\n\013create_time\030\002 \001(\0132\032.goog" + + "le.protobuf.TimestampB\003\340A\003\0224\n\013update_tim" + + "e\030\003 \001(\0132\032.google.protobuf.TimestampB\003\340A\003" + + "\022S\n\006labels\030\004 \003(\0132C.google.cloud.certific" + + "atemanager.v1.CertificateMapEntry.Labels" + + "Entry\022\022\n\010hostname\030\005 \001(\tH\000\022R\n\007matcher\030\n \001" + + "(\0162?.google.cloud.certificatemanager.v1." + + "CertificateMapEntry.MatcherH\000\022H\n\014certifi" + + "cates\030\007 \003(\tB2\372A/\n-certificatemanager.goo" + + "gleapis.com/Certificate\022D\n\005state\030\010 \001(\01620" + + ".google.cloud.certificatemanager.v1.Serv" + + "ingStateB\003\340A\003\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(" + + "\t\022\r\n\005value\030\002 \001(\t:\0028\001\"/\n\007Matcher\022\027\n\023MATCH" + + "ER_UNSPECIFIED\020\000\022\013\n\007PRIMARY\020\001:\264\001\352A\260\001\n5ce" + + "rtificatemanager.googleapis.com/Certific" + + "ateMapEntry\022wprojects/{project}/location" + + "s/{location}/certificateMaps/{certificat" + + "e_map}/certificateMapEntries/{certificat" + + "e_map_entry}B\007\n\005match\"\374\004\n\020DnsAuthorizati" + + "on\022\014\n\004name\030\001 \001(\t\0224\n\013create_time\030\002 \001(\0132\032." + + "google.protobuf.TimestampB\003\340A\003\0224\n\013update" + + "_time\030\003 \001(\0132\032.google.protobuf.TimestampB" + + "\003\340A\003\022P\n\006labels\030\004 \003(\0132@.google.cloud.cert" + + "ificatemanager.v1.DnsAuthorization.Label" + + "sEntry\022\023\n\013description\030\005 \001(\t\022\026\n\006domain\030\006 " + + "\001(\tB\006\340A\002\340A\005\022h\n\023dns_resource_record\030\n \001(\013" + + "2F.google.cloud.certificatemanager.v1.Dn" + + "sAuthorization.DnsResourceRecordB\003\340A\003\032L\n" + + "\021DnsResourceRecord\022\021\n\004name\030\001 \001(\tB\003\340A\003\022\021\n" + + "\004type\030\002 \001(\tB\003\340A\003\022\021\n\004data\030\003 \001(\tB\003\340A\003\032-\n\013L" + + "abelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\002" + + "8\001:\207\001\352A\203\001\n2certificatemanager.googleapis" + + ".com/DnsAuthorization\022Mprojects/{project" + + "}/locations/{location}/dnsAuthorizations" + + "/{dns_authorization}*F\n\014ServingState\022\035\n\031" + + "SERVING_STATE_UNSPECIFIED\020\000\022\n\n\006ACTIVE\020\001\022" + + "\013\n\007PENDING\020\0022\336(\n\022CertificateManager\022\320\001\n\020" + + "ListCertificates\022;.google.cloud.certific" + + "atemanager.v1.ListCertificatesRequest\032<." + + "google.cloud.certificatemanager.v1.ListC" + + "ertificatesResponse\"A\202\323\344\223\0022\0220/v1/{parent" + + "=projects/*/locations/*}/certificates\332A\006" + + "parent\022\275\001\n\016GetCertificate\0229.google.cloud" + + ".certificatemanager.v1.GetCertificateReq" + + "uest\032/.google.cloud.certificatemanager.v" + + "1.Certificate\"?\202\323\344\223\0022\0220/v1/{name=project" + + "s/*/locations/*/certificates/*}\332A\004name\022\377" + + "\001\n\021CreateCertificate\022<.google.cloud.cert" + + "ificatemanager.v1.CreateCertificateReque" + + "st\032\035.google.longrunning.Operation\"\214\001\202\323\344\223" + + "\002?\"0/v1/{parent=projects/*/locations/*}/" + + "certificates:\013certificate\332A!parent,certi" + + "ficate,certificate_id\312A \n\013Certificate\022\021O" + + "perationMetadata\022\201\002\n\021UpdateCertificate\022<" + + ".google.cloud.certificatemanager.v1.Upda" + + "teCertificateRequest\032\035.google.longrunnin" + + "g.Operation\"\216\001\202\323\344\223\002K2.google.cloud.certificatemanager." + + "v1.ListCertificateMapsRequest\032?.google.c" + + "loud.certificatemanager.v1.ListCertifica" + + "teMapsResponse\"D\202\323\344\223\0025\0223/v1/{parent=proj" + + "ects/*/locations/*}/certificateMaps\332A\006pa" + + "rent\022\311\001\n\021GetCertificateMap\022<.google.clou" + + "d.certificatemanager.v1.GetCertificateMa" + + "pRequest\0322.google.cloud.certificatemanag" + + "er.v1.CertificateMap\"B\202\323\344\223\0025\0223/v1/{name=" + + "projects/*/locations/*/certificateMaps/*" + + "}\332A\004name\022\227\002\n\024CreateCertificateMap\022?.goog" + + "le.cloud.certificatemanager.v1.CreateCer" + + "tificateMapRequest\032\035.google.longrunning." + + "Operation\"\236\001\202\323\344\223\002F\"3/v1/{parent=projects" + + "/*/locations/*}/certificateMaps:\017certifi" + + "cate_map\332A)parent,certificate_map,certif" + + "icate_map_id\312A#\n\016CertificateMap\022\021Operati" + + "onMetadata\022\231\002\n\024UpdateCertificateMap\022?.go" + + "ogle.cloud.certificatemanager.v1.UpdateC" + + "ertificateMapRequest\032\035.google.longrunnin" + + "g.Operation\"\240\001\202\323\344\223\002V2C/v1/{certificate_m" + + "ap.name=projects/*/locations/*/certifica" + + "teMaps/*}:\017certificate_map\332A\033certificate" + + "_map,update_mask\312A#\n\016CertificateMap\022\021Ope" + + "rationMetadata\022\347\001\n\024DeleteCertificateMap\022" + + "?.google.cloud.certificatemanager.v1.Del" + + "eteCertificateMapRequest\032\035.google.longru" + + "nning.Operation\"o\202\323\344\223\0025*3/v1/{name=proje" + + "cts/*/locations/*/certificateMaps/*}\332A\004n" + + "ame\312A*\n\025google.protobuf.Empty\022\021Operation" + + "Metadata\022\206\002\n\031ListCertificateMapEntries\022D" + + ".google.cloud.certificatemanager.v1.List" + + "CertificateMapEntriesRequest\032E.google.cl" + + "oud.certificatemanager.v1.ListCertificat" + + "eMapEntriesResponse\"\\\202\323\344\223\002M\022K/v1/{parent" + + "=projects/*/locations/*/certificateMaps/" + + "*}/certificateMapEntries\332A\006parent\022\360\001\n\026Ge" + + "tCertificateMapEntry\022A.google.cloud.cert" + + "ificatemanager.v1.GetCertificateMapEntry" + + "Request\0327.google.cloud.certificatemanage" + + "r.v1.CertificateMapEntry\"Z\202\323\344\223\002M\022K/v1/{n" + + "ame=projects/*/locations/*/certificateMa" + + "ps/*/certificateMapEntries/*}\332A\004name\022\320\002\n" + + "\031CreateCertificateMapEntry\022D.google.clou" + + "d.certificatemanager.v1.CreateCertificat" + + "eMapEntryRequest\032\035.google.longrunning.Op" + + "eration\"\315\001\202\323\344\223\002d\"K/v1/{parent=projects/*" + + "/locations/*/certificateMaps/*}/certific" + + "ateMapEntries:\025certificate_map_entry\332A5p" + + "arent,certificate_map_entry,certificate_" + + "map_entry_id\312A(\n\023CertificateMapEntry\022\021Op" + + "erationMetadata\022\322\002\n\031UpdateCertificateMap" + + "Entry\022D.google.cloud.certificatemanager." + + "v1.UpdateCertificateMapEntryRequest\032\035.go" + + "ogle.longrunning.Operation\"\317\001\202\323\344\223\002z2a/v1" + + "/{certificate_map_entry.name=projects/*/" + + "locations/*/certificateMaps/*/certificat" + + "eMapEntries/*}:\025certificate_map_entry\332A!" + + "certificate_map_entry,update_mask\312A(\n\023Ce" + + "rtificateMapEntry\022\021OperationMetadata\022\212\002\n" + + "\031DeleteCertificateMapEntry\022D.google.clou" + + "d.certificatemanager.v1.DeleteCertificat" + + "eMapEntryRequest\032\035.google.longrunning.Op" + + "eration\"\207\001\202\323\344\223\002M*K/v1/{name=projects/*/l" + + "ocations/*/certificateMaps/*/certificate" + + "MapEntries/*}\332A\004name\312A*\n\025google.protobuf" + + ".Empty\022\021OperationMetadata\022\344\001\n\025ListDnsAut" + + "horizations\022@.google.cloud.certificatema" + + "nager.v1.ListDnsAuthorizationsRequest\032A." + + "google.cloud.certificatemanager.v1.ListD" + + "nsAuthorizationsResponse\"F\202\323\344\223\0027\0225/v1/{p" + + "arent=projects/*/locations/*}/dnsAuthori" + + "zations\332A\006parent\022\321\001\n\023GetDnsAuthorization" + + "\022>.google.cloud.certificatemanager.v1.Ge" + + "tDnsAuthorizationRequest\0324.google.cloud." + + "certificatemanager.v1.DnsAuthorization\"D" + + "\202\323\344\223\0027\0225/v1/{name=projects/*/locations/*" + + "/dnsAuthorizations/*}\332A\004name\022\245\002\n\026CreateD" + + "nsAuthorization\022A.google.cloud.certifica" + + "temanager.v1.CreateDnsAuthorizationReque" + + "st\032\035.google.longrunning.Operation\"\250\001\202\323\344\223" + + "\002J\"5/v1/{parent=projects/*/locations/*}/" + + "dnsAuthorizations:\021dns_authorization\332A-p" + + "arent,dns_authorization,dns_authorizatio" + + "n_id\312A%\n\020DnsAuthorization\022\021OperationMeta" + + "data\022\247\002\n\026UpdateDnsAuthorization\022A.google" + + ".cloud.certificatemanager.v1.UpdateDnsAu" + + "thorizationRequest\032\035.google.longrunning." + + "Operation\"\252\001\202\323\344\223\002\\2G/v1/{dns_authorizati" + + "on.name=projects/*/locations/*/dnsAuthor" + + "izations/*}:\021dns_authorization\332A\035dns_aut" + + "horization,update_mask\312A%\n\020DnsAuthorizat" + + "ion\022\021OperationMetadata\022\355\001\n\026DeleteDnsAuth" + + "orization\022A.google.cloud.certificatemana" + + "ger.v1.DeleteDnsAuthorizationRequest\032\035.g" + + "oogle.longrunning.Operation\"q\202\323\344\223\0027*5/v1" + + "/{name=projects/*/locations/*/dnsAuthori" + + "zations/*}\332A\004name\312A*\n\025google.protobuf.Em" + + "pty\022\021OperationMetadata\032U\312A!certificatema" + + "nager.googleapis.com\322A.https://www.googl" + + "eapis.com/auth/cloud-platformB\213\002\n&com.go" + + "ogle.cloud.certificatemanager.v1B\027Certif" + + "icateManagerProtoP\001ZTgoogle.golang.org/g" + + "enproto/googleapis/cloud/certificatemana" + + "ger/v1;certificatemanager\252\002\"Google.Cloud" + + ".CertificateManager.V1\312\002\"Google\\Cloud\\Ce" + + "rtificateManager\\V1\352\002%Google::Cloud::Cer" + + "tificateManager::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -957,7 +948,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { registry.add(com.google.api.ClientProto.methodSignature); registry.add(com.google.api.ClientProto.oauthScopes); registry.add(com.google.api.ResourceProto.resource); - registry.add(com.google.api.ResourceProto.resourceDefinition); registry.add(com.google.api.ResourceProto.resourceReference); registry.add(com.google.longrunning.OperationsProto.operationInfo); com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( diff --git a/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/java/com/google/cloud/certificatemanager/v1/CertificateMap.java b/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/java/com/google/cloud/certificatemanager/v1/CertificateMap.java index ea01f7f9cf09..d73511098cbb 100644 --- a/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/java/com/google/cloud/certificatemanager/v1/CertificateMap.java +++ b/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/java/com/google/cloud/certificatemanager/v1/CertificateMap.java @@ -203,11 +203,11 @@ public interface GclbTargetOrBuilder * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetHttpsProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
      * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return Whether the targetHttpsProxy field is set. */ @@ -216,11 +216,11 @@ public interface GclbTargetOrBuilder * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetHttpsProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
      * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return The targetHttpsProxy. */ @@ -229,11 +229,11 @@ public interface GclbTargetOrBuilder * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetHttpsProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
      * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return The bytes for targetHttpsProxy. */ @@ -243,11 +243,11 @@ public interface GclbTargetOrBuilder * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetSslProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
      * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return Whether the targetSslProxy field is set. */ @@ -256,11 +256,11 @@ public interface GclbTargetOrBuilder * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetSslProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
      * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return The targetSslProxy. */ @@ -269,11 +269,11 @@ public interface GclbTargetOrBuilder * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetSslProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
      * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return The bytes for targetSslProxy. */ @@ -1498,11 +1498,11 @@ public TargetProxyCase getTargetProxyCase() { * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetHttpsProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
      * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return Whether the targetHttpsProxy field is set. */ @@ -1513,11 +1513,11 @@ public boolean hasTargetHttpsProxy() { * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetHttpsProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
      * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return The targetHttpsProxy. */ @@ -1541,11 +1541,11 @@ public java.lang.String getTargetHttpsProxy() { * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetHttpsProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
      * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return The bytes for targetHttpsProxy. */ @@ -1571,11 +1571,11 @@ public com.google.protobuf.ByteString getTargetHttpsProxyBytes() { * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetSslProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
      * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return Whether the targetSslProxy field is set. */ @@ -1586,11 +1586,11 @@ public boolean hasTargetSslProxy() { * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetSslProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
      * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return The targetSslProxy. */ @@ -1614,11 +1614,11 @@ public java.lang.String getTargetSslProxy() { * * *
-     * A name must be in the format
-     * `projects/*/locations/*/targetSslProxies/*`.
+     * This field returns the resource name in the following format:
+     * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
      * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return The bytes for targetSslProxy. */ @@ -2185,11 +2185,11 @@ public Builder clearTargetProxy() { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetHttpsProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
        * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return Whether the targetHttpsProxy field is set. */ @@ -2201,11 +2201,11 @@ public boolean hasTargetHttpsProxy() { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetHttpsProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
        * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return The targetHttpsProxy. */ @@ -2230,11 +2230,11 @@ public java.lang.String getTargetHttpsProxy() { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetHttpsProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
        * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return The bytes for targetHttpsProxy. */ @@ -2259,11 +2259,11 @@ public com.google.protobuf.ByteString getTargetHttpsProxyBytes() { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetHttpsProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
        * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @param value The targetHttpsProxy to set. * @return This builder for chaining. @@ -2281,11 +2281,11 @@ public Builder setTargetHttpsProxy(java.lang.String value) { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetHttpsProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
        * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @return This builder for chaining. */ @@ -2301,11 +2301,11 @@ public Builder clearTargetHttpsProxy() { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetHttpsProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`.
        * 
* - * string target_https_proxy = 1 [(.google.api.resource_reference) = { ... } + * string target_https_proxy = 1; * * @param value The bytes for targetHttpsProxy to set. * @return This builder for chaining. @@ -2325,11 +2325,11 @@ public Builder setTargetHttpsProxyBytes(com.google.protobuf.ByteString value) { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetSslProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
        * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return Whether the targetSslProxy field is set. */ @@ -2341,11 +2341,11 @@ public boolean hasTargetSslProxy() { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetSslProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
        * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return The targetSslProxy. */ @@ -2370,11 +2370,11 @@ public java.lang.String getTargetSslProxy() { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetSslProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
        * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return The bytes for targetSslProxy. */ @@ -2399,11 +2399,11 @@ public com.google.protobuf.ByteString getTargetSslProxyBytes() { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetSslProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
        * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @param value The targetSslProxy to set. * @return This builder for chaining. @@ -2421,11 +2421,11 @@ public Builder setTargetSslProxy(java.lang.String value) { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetSslProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
        * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @return This builder for chaining. */ @@ -2441,11 +2441,11 @@ public Builder clearTargetSslProxy() { * * *
-       * A name must be in the format
-       * `projects/*/locations/*/targetSslProxies/*`.
+       * This field returns the resource name in the following format:
+       * `//compute.googleapis.com/projects/*/global/targetSslProxies/*`.
        * 
* - * string target_ssl_proxy = 3 [(.google.api.resource_reference) = { ... } + * string target_ssl_proxy = 3; * * @param value The bytes for targetSslProxy to set. * @return This builder for chaining. diff --git a/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/proto/google/cloud/certificatemanager/v1/certificate_manager.proto b/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/proto/google/cloud/certificatemanager/v1/certificate_manager.proto index be7df241c17c..2b221da443fa 100644 --- a/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/proto/google/cloud/certificatemanager/v1/certificate_manager.proto +++ b/java-certificate-manager/proto-google-cloud-certificate-manager-v1/src/main/proto/google/cloud/certificatemanager/v1/certificate_manager.proto @@ -31,14 +31,6 @@ option java_outer_classname = "CertificateManagerProto"; option java_package = "com.google.cloud.certificatemanager.v1"; option php_namespace = "Google\\Cloud\\CertificateManager\\V1"; option ruby_package = "Google::Cloud::CertificateManager::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/TargetHttpsProxies" - pattern: "projects/{project}/locations/{location}/targetHttpsProxies/{target_https_proxy}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/TargetSslProxies" - pattern: "projects/{project}/locations/{location}/targetSslProxies/{target_ssl_proxy}" -}; // API Overview // @@ -912,17 +904,13 @@ message CertificateMap { // A Target Proxy to which this map is attached to. oneof target_proxy { - // A name must be in the format - // `projects/*/locations/*/targetHttpsProxies/*`. - string target_https_proxy = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/TargetHttpsProxies" - }]; - - // A name must be in the format - // `projects/*/locations/*/targetSslProxies/*`. - string target_ssl_proxy = 3 [(google.api.resource_reference) = { - type: "compute.googleapis.com/TargetSslProxies" - }]; + // This field returns the resource name in the following format: + // `//compute.googleapis.com/projects/*/global/targetHttpsProxies/*`. + string target_https_proxy = 1; + + // This field returns the resource name in the following format: + // `//compute.googleapis.com/projects/*/global/targetSslProxies/*`. + string target_ssl_proxy = 3; } // IP configurations for this Target Proxy where the diff --git a/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getlocation/AsyncGetLocation.java b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getlocation/AsyncGetLocation.java new file mode 100644 index 000000000000..feb583d5f8b8 --- /dev/null +++ b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getlocation/AsyncGetLocation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + certificateManagerClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getlocation_async] diff --git a/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getlocation/SyncGetLocation.java b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getlocation/SyncGetLocation.java new file mode 100644 index 000000000000..a62744ee6c23 --- /dev/null +++ b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/getlocation/SyncGetLocation.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_getlocation_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = certificateManagerClient.getLocation(request); + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_getlocation_sync] diff --git a/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/AsyncListLocations.java b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/AsyncListLocations.java new file mode 100644 index 000000000000..62924a53b8b9 --- /dev/null +++ b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/AsyncListLocations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + certificateManagerClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listlocations_async] diff --git a/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/AsyncListLocationsPaged.java b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 000000000000..20a545ea4e15 --- /dev/null +++ b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listlocations_paged_async] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + certificateManagerClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listlocations_paged_async] diff --git a/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/SyncListLocations.java b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/SyncListLocations.java new file mode 100644 index 000000000000..1b2551108e50 --- /dev/null +++ b/java-certificate-manager/samples/snippets/generated/com/google/cloud/certificatemanager/v1/certificatemanagerclient/listlocations/SyncListLocations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.certificatemanager.v1.samples; + +// [START certificatemanager_v1_generated_certificatemanagerclient_listlocations_sync] +import com.google.cloud.certificatemanager.v1.CertificateManagerClient; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : certificateManagerClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END certificatemanager_v1_generated_certificatemanagerclient_listlocations_sync]