diff --git a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClient.java b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClient.java index 66e6dbd9..1fa1d573 100644 --- a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClient.java +++ b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClient.java @@ -1318,6 +1318,248 @@ public final UnaryCallable lookupEntryCallable() { return stub.lookupEntryCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists entry groups. + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   String formattedParent = DataCatalogClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   ListEntryGroupsResponse response = dataCatalogClient.listEntryGroups(formattedParent);
+   * }
+   * 
+ * + * @param parent Required. The name of the location that contains the entry groups, which can be + * provided in URL format. Example: + *

* projects/{project_id}/locations/{location} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListEntryGroupsResponse listEntryGroups(String parent) { + LOCATION_PATH_TEMPLATE.validate(parent, "listEntryGroups"); + ListEntryGroupsRequest request = ListEntryGroupsRequest.newBuilder().setParent(parent).build(); + return listEntryGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists entry groups. + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   String formattedParent = DataCatalogClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   ListEntryGroupsRequest request = ListEntryGroupsRequest.newBuilder()
+   *     .setParent(formattedParent)
+   *     .build();
+   *   ListEntryGroupsResponse response = dataCatalogClient.listEntryGroups(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 ListEntryGroupsResponse listEntryGroups(ListEntryGroupsRequest request) { + return listEntryGroupsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists entry groups. + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   String formattedParent = DataCatalogClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   ListEntryGroupsRequest request = ListEntryGroupsRequest.newBuilder()
+   *     .setParent(formattedParent)
+   *     .build();
+   *   ApiFuture<ListEntryGroupsResponse> future = dataCatalogClient.listEntryGroupsCallable().futureCall(request);
+   *   // Do something
+   *   ListEntryGroupsResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + listEntryGroupsCallable() { + return stub.listEntryGroupsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists entries. + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   String formattedParent = DataCatalogClient.formatEntryGroupName("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]");
+   *   ListEntriesResponse response = dataCatalogClient.listEntries(formattedParent);
+   * }
+   * 
+ * + * @param parent Required. The name of the entry group that contains the entries, which can be + * provided in URL format. Example: + *

* projects/{project_id}/locations/{location}/entryGroups/{entry_group_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListEntriesResponse listEntries(String parent) { + ENTRY_GROUP_PATH_TEMPLATE.validate(parent, "listEntries"); + ListEntriesRequest request = ListEntriesRequest.newBuilder().setParent(parent).build(); + return listEntries(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists entries. + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   String formattedParent = DataCatalogClient.formatEntryGroupName("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]");
+   *   ListEntriesRequest request = ListEntriesRequest.newBuilder()
+   *     .setParent(formattedParent)
+   *     .build();
+   *   ListEntriesResponse response = dataCatalogClient.listEntries(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 ListEntriesResponse listEntries(ListEntriesRequest request) { + return listEntriesCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists entries. + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   String formattedParent = DataCatalogClient.formatEntryGroupName("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]");
+   *   ListEntriesRequest request = ListEntriesRequest.newBuilder()
+   *     .setParent(formattedParent)
+   *     .build();
+   *   ApiFuture<ListEntriesResponse> future = dataCatalogClient.listEntriesCallable().futureCall(request);
+   *   // Do something
+   *   ListEntriesResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable listEntriesCallable() { + return stub.listEntriesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an EntryGroup. The user should enable the Data Catalog API in the project identified by + * the `entry_group.name` parameter (see [Data Catalog Resource Project] + * (/data-catalog/docs/concepts/resource-project) for more information). + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   EntryGroup entryGroup = EntryGroup.newBuilder().build();
+   *   EntryGroup response = dataCatalogClient.updateEntryGroup(entryGroup);
+   * }
+   * 
+ * + * @param entryGroup Required. The updated entry group. "name" field must be set. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final EntryGroup updateEntryGroup(EntryGroup entryGroup) { + UpdateEntryGroupRequest request = + UpdateEntryGroupRequest.newBuilder().setEntryGroup(entryGroup).build(); + return updateEntryGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an EntryGroup. The user should enable the Data Catalog API in the project identified by + * the `entry_group.name` parameter (see [Data Catalog Resource Project] + * (/data-catalog/docs/concepts/resource-project) for more information). + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   EntryGroup entryGroup = EntryGroup.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   EntryGroup response = dataCatalogClient.updateEntryGroup(entryGroup, updateMask);
+   * }
+   * 
+ * + * @param entryGroup Required. The updated entry group. "name" field must be set. + * @param updateMask The fields to update on the entry group. If absent or empty, all modifiable + * fields are updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final EntryGroup updateEntryGroup(EntryGroup entryGroup, FieldMask updateMask) { + UpdateEntryGroupRequest request = + UpdateEntryGroupRequest.newBuilder() + .setEntryGroup(entryGroup) + .setUpdateMask(updateMask) + .build(); + return updateEntryGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an EntryGroup. The user should enable the Data Catalog API in the project identified by + * the `entry_group.name` parameter (see [Data Catalog Resource Project] + * (/data-catalog/docs/concepts/resource-project) for more information). + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   EntryGroup entryGroup = EntryGroup.newBuilder().build();
+   *   UpdateEntryGroupRequest request = UpdateEntryGroupRequest.newBuilder()
+   *     .setEntryGroup(entryGroup)
+   *     .build();
+   *   EntryGroup response = dataCatalogClient.updateEntryGroup(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 EntryGroup updateEntryGroup(UpdateEntryGroupRequest request) { + return updateEntryGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an EntryGroup. The user should enable the Data Catalog API in the project identified by + * the `entry_group.name` parameter (see [Data Catalog Resource Project] + * (/data-catalog/docs/concepts/resource-project) for more information). + * + *

Sample code: + * + *


+   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
+   *   EntryGroup entryGroup = EntryGroup.newBuilder().build();
+   *   UpdateEntryGroupRequest request = UpdateEntryGroupRequest.newBuilder()
+   *     .setEntryGroup(entryGroup)
+   *     .build();
+   *   ApiFuture<EntryGroup> future = dataCatalogClient.updateEntryGroupCallable().futureCall(request);
+   *   // Do something
+   *   EntryGroup response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable updateEntryGroupCallable() { + return stub.updateEntryGroupCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD /** * Creates a tag template. The user should enable the Data Catalog API in the project identified @@ -2658,128 +2900,6 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq return stub.testIamPermissionsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Updates an EntryGroup. The user should enable the Data Catalog API in the project identified by - * the `entry_group.name` parameter (see [Data Catalog Resource Project] - * (/data-catalog/docs/concepts/resource-project) for more information). - * - *

Sample code: - * - *


-   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
-   *   UpdateEntryGroupRequest request = UpdateEntryGroupRequest.newBuilder().build();
-   *   EntryGroup response = dataCatalogClient.updateEntryGroup(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 EntryGroup updateEntryGroup(UpdateEntryGroupRequest request) { - return updateEntryGroupCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Updates an EntryGroup. The user should enable the Data Catalog API in the project identified by - * the `entry_group.name` parameter (see [Data Catalog Resource Project] - * (/data-catalog/docs/concepts/resource-project) for more information). - * - *

Sample code: - * - *


-   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
-   *   UpdateEntryGroupRequest request = UpdateEntryGroupRequest.newBuilder().build();
-   *   ApiFuture<EntryGroup> future = dataCatalogClient.updateEntryGroupCallable().futureCall(request);
-   *   // Do something
-   *   EntryGroup response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable updateEntryGroupCallable() { - return stub.updateEntryGroupCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Lists entry groups. - * - *

Sample code: - * - *


-   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
-   *   ListEntryGroupsRequest request = ListEntryGroupsRequest.newBuilder().build();
-   *   ListEntryGroupsResponse response = dataCatalogClient.listEntryGroups(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 ListEntryGroupsResponse listEntryGroups(ListEntryGroupsRequest request) { - return listEntryGroupsCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Lists entry groups. - * - *

Sample code: - * - *


-   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
-   *   ListEntryGroupsRequest request = ListEntryGroupsRequest.newBuilder().build();
-   *   ApiFuture<ListEntryGroupsResponse> future = dataCatalogClient.listEntryGroupsCallable().futureCall(request);
-   *   // Do something
-   *   ListEntryGroupsResponse response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable - listEntryGroupsCallable() { - return stub.listEntryGroupsCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Lists entries. - * - *

Sample code: - * - *


-   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
-   *   ListEntriesRequest request = ListEntriesRequest.newBuilder().build();
-   *   ListEntriesResponse response = dataCatalogClient.listEntries(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 ListEntriesResponse listEntries(ListEntriesRequest request) { - return listEntriesCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Lists entries. - * - *

Sample code: - * - *


-   * try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) {
-   *   ListEntriesRequest request = ListEntriesRequest.newBuilder().build();
-   *   ApiFuture<ListEntriesResponse> future = dataCatalogClient.listEntriesCallable().futureCall(request);
-   *   // Do something
-   *   ListEntriesResponse response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable listEntriesCallable() { - return stub.listEntriesCallable(); - } - @Override public final void close() { stub.close(); diff --git a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogSettings.java b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogSettings.java index cee5ad4b..11d774bb 100644 --- a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogSettings.java +++ b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogSettings.java @@ -116,6 +116,22 @@ public UnaryCallSettings lookupEntrySettings() { return ((DataCatalogStubSettings) getStubSettings()).lookupEntrySettings(); } + /** Returns the object with the settings used for calls to listEntryGroups. */ + public UnaryCallSettings + listEntryGroupsSettings() { + return ((DataCatalogStubSettings) getStubSettings()).listEntryGroupsSettings(); + } + + /** Returns the object with the settings used for calls to listEntries. */ + public UnaryCallSettings listEntriesSettings() { + return ((DataCatalogStubSettings) getStubSettings()).listEntriesSettings(); + } + + /** Returns the object with the settings used for calls to updateEntryGroup. */ + public UnaryCallSettings updateEntryGroupSettings() { + return ((DataCatalogStubSettings) getStubSettings()).updateEntryGroupSettings(); + } + /** Returns the object with the settings used for calls to createTagTemplate. */ public UnaryCallSettings createTagTemplateSettings() { return ((DataCatalogStubSettings) getStubSettings()).createTagTemplateSettings(); @@ -196,22 +212,6 @@ public UnaryCallSettings getIamPolicySettings() { return ((DataCatalogStubSettings) getStubSettings()).testIamPermissionsSettings(); } - /** Returns the object with the settings used for calls to updateEntryGroup. */ - public UnaryCallSettings updateEntryGroupSettings() { - return ((DataCatalogStubSettings) getStubSettings()).updateEntryGroupSettings(); - } - - /** Returns the object with the settings used for calls to listEntryGroups. */ - public UnaryCallSettings - listEntryGroupsSettings() { - return ((DataCatalogStubSettings) getStubSettings()).listEntryGroupsSettings(); - } - - /** Returns the object with the settings used for calls to listEntries. */ - public UnaryCallSettings listEntriesSettings() { - return ((DataCatalogStubSettings) getStubSettings()).listEntriesSettings(); - } - public static final DataCatalogSettings create(DataCatalogStubSettings stub) throws IOException { return new DataCatalogSettings.Builder(stub.toBuilder()).build(); } @@ -356,6 +356,24 @@ public UnaryCallSettings.Builder lookupEntrySettings( return getStubSettingsBuilder().lookupEntrySettings(); } + /** Returns the builder for the settings used for calls to listEntryGroups. */ + public UnaryCallSettings.Builder + listEntryGroupsSettings() { + return getStubSettingsBuilder().listEntryGroupsSettings(); + } + + /** Returns the builder for the settings used for calls to listEntries. */ + public UnaryCallSettings.Builder + listEntriesSettings() { + return getStubSettingsBuilder().listEntriesSettings(); + } + + /** Returns the builder for the settings used for calls to updateEntryGroup. */ + public UnaryCallSettings.Builder + updateEntryGroupSettings() { + return getStubSettingsBuilder().updateEntryGroupSettings(); + } + /** Returns the builder for the settings used for calls to createTagTemplate. */ public UnaryCallSettings.Builder createTagTemplateSettings() { @@ -439,24 +457,6 @@ public UnaryCallSettings.Builder getIamPolicySettin return getStubSettingsBuilder().testIamPermissionsSettings(); } - /** Returns the builder for the settings used for calls to updateEntryGroup. */ - public UnaryCallSettings.Builder - updateEntryGroupSettings() { - return getStubSettingsBuilder().updateEntryGroupSettings(); - } - - /** Returns the builder for the settings used for calls to listEntryGroups. */ - public UnaryCallSettings.Builder - listEntryGroupsSettings() { - return getStubSettingsBuilder().listEntryGroupsSettings(); - } - - /** Returns the builder for the settings used for calls to listEntries. */ - public UnaryCallSettings.Builder - listEntriesSettings() { - return getStubSettingsBuilder().listEntriesSettings(); - } - @Override public DataCatalogSettings build() throws IOException { return new DataCatalogSettings(this); diff --git a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/DataCatalogStub.java b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/DataCatalogStub.java index 15cb9661..6fd1242d 100644 --- a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/DataCatalogStub.java +++ b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/DataCatalogStub.java @@ -113,6 +113,18 @@ public UnaryCallable lookupEntryCallable() { throw new UnsupportedOperationException("Not implemented: lookupEntryCallable()"); } + public UnaryCallable listEntryGroupsCallable() { + throw new UnsupportedOperationException("Not implemented: listEntryGroupsCallable()"); + } + + public UnaryCallable listEntriesCallable() { + throw new UnsupportedOperationException("Not implemented: listEntriesCallable()"); + } + + public UnaryCallable updateEntryGroupCallable() { + throw new UnsupportedOperationException("Not implemented: updateEntryGroupCallable()"); + } + public UnaryCallable createTagTemplateCallable() { throw new UnsupportedOperationException("Not implemented: createTagTemplateCallable()"); } @@ -181,18 +193,6 @@ public UnaryCallable getIamPolicyCallable() { throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); } - public UnaryCallable updateEntryGroupCallable() { - throw new UnsupportedOperationException("Not implemented: updateEntryGroupCallable()"); - } - - public UnaryCallable listEntryGroupsCallable() { - throw new UnsupportedOperationException("Not implemented: listEntryGroupsCallable()"); - } - - public UnaryCallable listEntriesCallable() { - throw new UnsupportedOperationException("Not implemented: listEntriesCallable()"); - } - @Override public abstract void close(); } diff --git a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/DataCatalogStubSettings.java b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/DataCatalogStubSettings.java index e17fb3d7..59781c04 100644 --- a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/DataCatalogStubSettings.java +++ b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/DataCatalogStubSettings.java @@ -134,6 +134,10 @@ public class DataCatalogStubSettings extends StubSettings deleteEntrySettings; private final UnaryCallSettings getEntrySettings; private final UnaryCallSettings lookupEntrySettings; + private final UnaryCallSettings + listEntryGroupsSettings; + private final UnaryCallSettings listEntriesSettings; + private final UnaryCallSettings updateEntryGroupSettings; private final UnaryCallSettings createTagTemplateSettings; private final UnaryCallSettings getTagTemplateSettings; private final UnaryCallSettings updateTagTemplateSettings; @@ -155,10 +159,6 @@ public class DataCatalogStubSettings extends StubSettings getIamPolicySettings; private final UnaryCallSettings testIamPermissionsSettings; - private final UnaryCallSettings updateEntryGroupSettings; - private final UnaryCallSettings - listEntryGroupsSettings; - private final UnaryCallSettings listEntriesSettings; /** Returns the object with the settings used for calls to searchCatalog. */ public PagedCallSettings @@ -206,6 +206,22 @@ public UnaryCallSettings lookupEntrySettings() { return lookupEntrySettings; } + /** Returns the object with the settings used for calls to listEntryGroups. */ + public UnaryCallSettings + listEntryGroupsSettings() { + return listEntryGroupsSettings; + } + + /** Returns the object with the settings used for calls to listEntries. */ + public UnaryCallSettings listEntriesSettings() { + return listEntriesSettings; + } + + /** Returns the object with the settings used for calls to updateEntryGroup. */ + public UnaryCallSettings updateEntryGroupSettings() { + return updateEntryGroupSettings; + } + /** Returns the object with the settings used for calls to createTagTemplate. */ public UnaryCallSettings createTagTemplateSettings() { return createTagTemplateSettings; @@ -286,22 +302,6 @@ public UnaryCallSettings getIamPolicySettings() { return testIamPermissionsSettings; } - /** Returns the object with the settings used for calls to updateEntryGroup. */ - public UnaryCallSettings updateEntryGroupSettings() { - return updateEntryGroupSettings; - } - - /** Returns the object with the settings used for calls to listEntryGroups. */ - public UnaryCallSettings - listEntryGroupsSettings() { - return listEntryGroupsSettings; - } - - /** Returns the object with the settings used for calls to listEntries. */ - public UnaryCallSettings listEntriesSettings() { - return listEntriesSettings; - } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public DataCatalogStub createStub() throws IOException { if (getTransportChannelProvider() @@ -380,6 +380,9 @@ protected DataCatalogStubSettings(Builder settingsBuilder) throws IOException { deleteEntrySettings = settingsBuilder.deleteEntrySettings().build(); getEntrySettings = settingsBuilder.getEntrySettings().build(); lookupEntrySettings = settingsBuilder.lookupEntrySettings().build(); + listEntryGroupsSettings = settingsBuilder.listEntryGroupsSettings().build(); + listEntriesSettings = settingsBuilder.listEntriesSettings().build(); + updateEntryGroupSettings = settingsBuilder.updateEntryGroupSettings().build(); createTagTemplateSettings = settingsBuilder.createTagTemplateSettings().build(); getTagTemplateSettings = settingsBuilder.getTagTemplateSettings().build(); updateTagTemplateSettings = settingsBuilder.updateTagTemplateSettings().build(); @@ -395,9 +398,6 @@ protected DataCatalogStubSettings(Builder settingsBuilder) throws IOException { setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); - updateEntryGroupSettings = settingsBuilder.updateEntryGroupSettings().build(); - listEntryGroupsSettings = settingsBuilder.listEntryGroupsSettings().build(); - listEntriesSettings = settingsBuilder.listEntriesSettings().build(); } private static final PagedListDescriptor< @@ -525,6 +525,12 @@ public static class Builder extends StubSettings.Builder deleteEntrySettings; private final UnaryCallSettings.Builder getEntrySettings; private final UnaryCallSettings.Builder lookupEntrySettings; + private final UnaryCallSettings.Builder + listEntryGroupsSettings; + private final UnaryCallSettings.Builder + listEntriesSettings; + private final UnaryCallSettings.Builder + updateEntryGroupSettings; private final UnaryCallSettings.Builder createTagTemplateSettings; private final UnaryCallSettings.Builder @@ -551,12 +557,6 @@ public static class Builder extends StubSettings.Builder getIamPolicySettings; private final UnaryCallSettings.Builder testIamPermissionsSettings; - private final UnaryCallSettings.Builder - updateEntryGroupSettings; - private final UnaryCallSettings.Builder - listEntryGroupsSettings; - private final UnaryCallSettings.Builder - listEntriesSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -617,6 +617,12 @@ protected Builder(ClientContext clientContext) { lookupEntrySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listEntryGroupsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listEntriesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateEntryGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createTagTemplateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); getTagTemplateSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -647,12 +653,6 @@ protected Builder(ClientContext clientContext) { testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateEntryGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - listEntryGroupsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - listEntriesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - unaryMethodSettingsBuilders = ImmutableList.>of( searchCatalogSettings, @@ -664,6 +664,9 @@ protected Builder(ClientContext clientContext) { deleteEntrySettings, getEntrySettings, lookupEntrySettings, + listEntryGroupsSettings, + listEntriesSettings, + updateEntryGroupSettings, createTagTemplateSettings, getTagTemplateSettings, updateTagTemplateSettings, @@ -678,10 +681,7 @@ protected Builder(ClientContext clientContext) { listTagsSettings, setIamPolicySettings, getIamPolicySettings, - testIamPermissionsSettings, - updateEntryGroupSettings, - listEntryGroupsSettings, - listEntriesSettings); + testIamPermissionsSettings); initDefaults(this); } @@ -742,6 +742,21 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder + .listEntryGroupsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listEntriesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateEntryGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder .createTagTemplateSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) @@ -817,21 +832,6 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - builder - .updateEntryGroupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .listEntryGroupsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .listEntriesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - return builder; } @@ -847,6 +847,9 @@ protected Builder(DataCatalogStubSettings settings) { deleteEntrySettings = settings.deleteEntrySettings.toBuilder(); getEntrySettings = settings.getEntrySettings.toBuilder(); lookupEntrySettings = settings.lookupEntrySettings.toBuilder(); + listEntryGroupsSettings = settings.listEntryGroupsSettings.toBuilder(); + listEntriesSettings = settings.listEntriesSettings.toBuilder(); + updateEntryGroupSettings = settings.updateEntryGroupSettings.toBuilder(); createTagTemplateSettings = settings.createTagTemplateSettings.toBuilder(); getTagTemplateSettings = settings.getTagTemplateSettings.toBuilder(); updateTagTemplateSettings = settings.updateTagTemplateSettings.toBuilder(); @@ -862,9 +865,6 @@ protected Builder(DataCatalogStubSettings settings) { setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); - updateEntryGroupSettings = settings.updateEntryGroupSettings.toBuilder(); - listEntryGroupsSettings = settings.listEntryGroupsSettings.toBuilder(); - listEntriesSettings = settings.listEntriesSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -877,6 +877,9 @@ protected Builder(DataCatalogStubSettings settings) { deleteEntrySettings, getEntrySettings, lookupEntrySettings, + listEntryGroupsSettings, + listEntriesSettings, + updateEntryGroupSettings, createTagTemplateSettings, getTagTemplateSettings, updateTagTemplateSettings, @@ -891,10 +894,7 @@ protected Builder(DataCatalogStubSettings settings) { listTagsSettings, setIamPolicySettings, getIamPolicySettings, - testIamPermissionsSettings, - updateEntryGroupSettings, - listEntryGroupsSettings, - listEntriesSettings); + testIamPermissionsSettings); } // NEXT_MAJOR_VER: remove 'throws Exception' @@ -961,6 +961,24 @@ public UnaryCallSettings.Builder lookupEntrySettings( return lookupEntrySettings; } + /** Returns the builder for the settings used for calls to listEntryGroups. */ + public UnaryCallSettings.Builder + listEntryGroupsSettings() { + return listEntryGroupsSettings; + } + + /** Returns the builder for the settings used for calls to listEntries. */ + public UnaryCallSettings.Builder + listEntriesSettings() { + return listEntriesSettings; + } + + /** Returns the builder for the settings used for calls to updateEntryGroup. */ + public UnaryCallSettings.Builder + updateEntryGroupSettings() { + return updateEntryGroupSettings; + } + /** Returns the builder for the settings used for calls to createTagTemplate. */ public UnaryCallSettings.Builder createTagTemplateSettings() { @@ -1044,24 +1062,6 @@ public UnaryCallSettings.Builder getIamPolicySettin return testIamPermissionsSettings; } - /** Returns the builder for the settings used for calls to updateEntryGroup. */ - public UnaryCallSettings.Builder - updateEntryGroupSettings() { - return updateEntryGroupSettings; - } - - /** Returns the builder for the settings used for calls to listEntryGroups. */ - public UnaryCallSettings.Builder - listEntryGroupsSettings() { - return listEntryGroupsSettings; - } - - /** Returns the builder for the settings used for calls to listEntries. */ - public UnaryCallSettings.Builder - listEntriesSettings() { - return listEntriesSettings; - } - @Override public DataCatalogStubSettings build() throws IOException { return new DataCatalogStubSettings(this); diff --git a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/GrpcDataCatalogStub.java b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/GrpcDataCatalogStub.java index 84c82c7b..1375316a 100644 --- a/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/GrpcDataCatalogStub.java +++ b/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/stub/GrpcDataCatalogStub.java @@ -155,6 +155,34 @@ public class GrpcDataCatalogStub extends DataCatalogStub { .setRequestMarshaller(ProtoUtils.marshaller(LookupEntryRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Entry.getDefaultInstance())) .build(); + private static final MethodDescriptor + listEntryGroupsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.datacatalog.v1beta1.DataCatalog/ListEntryGroups") + .setRequestMarshaller( + ProtoUtils.marshaller(ListEntryGroupsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListEntryGroupsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listEntriesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.datacatalog.v1beta1.DataCatalog/ListEntries") + .setRequestMarshaller(ProtoUtils.marshaller(ListEntriesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListEntriesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateEntryGroupMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.datacatalog.v1beta1.DataCatalog/UpdateEntryGroup") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateEntryGroupRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(EntryGroup.getDefaultInstance())) + .build(); private static final MethodDescriptor createTagTemplateMethodDescriptor = MethodDescriptor.newBuilder() @@ -284,34 +312,6 @@ public class GrpcDataCatalogStub extends DataCatalogStub { .setResponseMarshaller( ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) .build(); - private static final MethodDescriptor - updateEntryGroupMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.datacatalog.v1beta1.DataCatalog/UpdateEntryGroup") - .setRequestMarshaller( - ProtoUtils.marshaller(UpdateEntryGroupRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(EntryGroup.getDefaultInstance())) - .build(); - private static final MethodDescriptor - listEntryGroupsMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.datacatalog.v1beta1.DataCatalog/ListEntryGroups") - .setRequestMarshaller( - ProtoUtils.marshaller(ListEntryGroupsRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListEntryGroupsResponse.getDefaultInstance())) - .build(); - private static final MethodDescriptor - listEntriesMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.datacatalog.v1beta1.DataCatalog/ListEntries") - .setRequestMarshaller(ProtoUtils.marshaller(ListEntriesRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListEntriesResponse.getDefaultInstance())) - .build(); private final BackgroundResource backgroundResources; @@ -326,6 +326,10 @@ public class GrpcDataCatalogStub extends DataCatalogStub { private final UnaryCallable deleteEntryCallable; private final UnaryCallable getEntryCallable; private final UnaryCallable lookupEntryCallable; + private final UnaryCallable + listEntryGroupsCallable; + private final UnaryCallable listEntriesCallable; + private final UnaryCallable updateEntryGroupCallable; private final UnaryCallable createTagTemplateCallable; private final UnaryCallable getTagTemplateCallable; private final UnaryCallable updateTagTemplateCallable; @@ -346,10 +350,6 @@ public class GrpcDataCatalogStub extends DataCatalogStub { private final UnaryCallable getIamPolicyCallable; private final UnaryCallable testIamPermissionsCallable; - private final UnaryCallable updateEntryGroupCallable; - private final UnaryCallable - listEntryGroupsCallable; - private final UnaryCallable listEntriesCallable; private final GrpcStubCallableFactory callableFactory; @@ -489,6 +489,47 @@ public Map extract(GetEntryRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(lookupEntryMethodDescriptor) .build(); + GrpcCallSettings + listEntryGroupsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listEntryGroupsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListEntryGroupsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings listEntriesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listEntriesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListEntriesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateEntryGroupTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateEntryGroupMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateEntryGroupRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "entry_group.name", String.valueOf(request.getEntryGroup().getName())); + return params.build(); + } + }) + .build(); GrpcCallSettings createTagTemplateTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createTagTemplateMethodDescriptor) @@ -689,47 +730,6 @@ public Map extract(TestIamPermissionsRequest request) { } }) .build(); - GrpcCallSettings updateEntryGroupTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(updateEntryGroupMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateEntryGroupRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "entry_group.name", String.valueOf(request.getEntryGroup().getName())); - return params.build(); - } - }) - .build(); - GrpcCallSettings - listEntryGroupsTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listEntryGroupsMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListEntryGroupsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } - }) - .build(); - GrpcCallSettings listEntriesTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listEntriesMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListEntriesRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } - }) - .build(); this.searchCatalogCallable = callableFactory.createUnaryCallable( @@ -761,6 +761,15 @@ public Map extract(ListEntriesRequest request) { this.lookupEntryCallable = callableFactory.createUnaryCallable( lookupEntryTransportSettings, settings.lookupEntrySettings(), clientContext); + this.listEntryGroupsCallable = + callableFactory.createUnaryCallable( + listEntryGroupsTransportSettings, settings.listEntryGroupsSettings(), clientContext); + this.listEntriesCallable = + callableFactory.createUnaryCallable( + listEntriesTransportSettings, settings.listEntriesSettings(), clientContext); + this.updateEntryGroupCallable = + callableFactory.createUnaryCallable( + updateEntryGroupTransportSettings, settings.updateEntryGroupSettings(), clientContext); this.createTagTemplateCallable = callableFactory.createUnaryCallable( createTagTemplateTransportSettings, @@ -825,15 +834,6 @@ public Map extract(ListEntriesRequest request) { testIamPermissionsTransportSettings, settings.testIamPermissionsSettings(), clientContext); - this.updateEntryGroupCallable = - callableFactory.createUnaryCallable( - updateEntryGroupTransportSettings, settings.updateEntryGroupSettings(), clientContext); - this.listEntryGroupsCallable = - callableFactory.createUnaryCallable( - listEntryGroupsTransportSettings, settings.listEntryGroupsSettings(), clientContext); - this.listEntriesCallable = - callableFactory.createUnaryCallable( - listEntriesTransportSettings, settings.listEntriesSettings(), clientContext); backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @@ -879,6 +879,18 @@ public UnaryCallable lookupEntryCallable() { return lookupEntryCallable; } + public UnaryCallable listEntryGroupsCallable() { + return listEntryGroupsCallable; + } + + public UnaryCallable listEntriesCallable() { + return listEntriesCallable; + } + + public UnaryCallable updateEntryGroupCallable() { + return updateEntryGroupCallable; + } + public UnaryCallable createTagTemplateCallable() { return createTagTemplateCallable; } @@ -947,18 +959,6 @@ public UnaryCallable getIamPolicyCallable() { return testIamPermissionsCallable; } - public UnaryCallable updateEntryGroupCallable() { - return updateEntryGroupCallable; - } - - public UnaryCallable listEntryGroupsCallable() { - return listEntryGroupsCallable; - } - - public UnaryCallable listEntriesCallable() { - return listEntriesCallable; - } - @Override public final void close() { shutdown(); diff --git a/google-cloud-datacatalog/src/test/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClientTest.java b/google-cloud-datacatalog/src/test/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClientTest.java index 49d5f50f..072247d6 100644 --- a/google-cloud-datacatalog/src/test/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClientTest.java +++ b/google-cloud-datacatalog/src/test/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClientTest.java @@ -497,6 +497,183 @@ public void getEntryExceptionTest() throws Exception { } } + @Test + @SuppressWarnings("all") + public void listEntryGroupsTest() { + String nextPageToken = "nextPageToken-1530815211"; + ListEntryGroupsResponse expectedResponse = + ListEntryGroupsResponse.newBuilder().setNextPageToken(nextPageToken).build(); + mockDataCatalog.addResponse(expectedResponse); + + String formattedParent = DataCatalogClient.formatLocationName("[PROJECT]", "[LOCATION]"); + + ListEntryGroupsResponse actualResponse = client.listEntryGroups(formattedParent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataCatalog.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListEntryGroupsRequest actualRequest = (ListEntryGroupsRequest) actualRequests.get(0); + + Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listEntryGroupsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockDataCatalog.addException(exception); + + try { + String formattedParent = DataCatalogClient.formatLocationName("[PROJECT]", "[LOCATION]"); + + client.listEntryGroups(formattedParent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listEntriesTest() { + String nextPageToken = "nextPageToken-1530815211"; + ListEntriesResponse expectedResponse = + ListEntriesResponse.newBuilder().setNextPageToken(nextPageToken).build(); + mockDataCatalog.addResponse(expectedResponse); + + String formattedParent = + DataCatalogClient.formatEntryGroupName("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]"); + + ListEntriesResponse actualResponse = client.listEntries(formattedParent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataCatalog.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListEntriesRequest actualRequest = (ListEntriesRequest) actualRequests.get(0); + + Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listEntriesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockDataCatalog.addException(exception); + + try { + String formattedParent = + DataCatalogClient.formatEntryGroupName("[PROJECT]", "[LOCATION]", "[ENTRY_GROUP]"); + + client.listEntries(formattedParent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateEntryGroupTest() { + String name = "name3373707"; + String displayName = "displayName1615086568"; + String description = "description-1724546052"; + EntryGroup expectedResponse = + EntryGroup.newBuilder() + .setName(name) + .setDisplayName(displayName) + .setDescription(description) + .build(); + mockDataCatalog.addResponse(expectedResponse); + + EntryGroup entryGroup = EntryGroup.newBuilder().build(); + + EntryGroup actualResponse = client.updateEntryGroup(entryGroup); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataCatalog.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateEntryGroupRequest actualRequest = (UpdateEntryGroupRequest) actualRequests.get(0); + + Assert.assertEquals(entryGroup, actualRequest.getEntryGroup()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateEntryGroupExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockDataCatalog.addException(exception); + + try { + EntryGroup entryGroup = EntryGroup.newBuilder().build(); + + client.updateEntryGroup(entryGroup); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateEntryGroupTest2() { + String name = "name3373707"; + String displayName = "displayName1615086568"; + String description = "description-1724546052"; + EntryGroup expectedResponse = + EntryGroup.newBuilder() + .setName(name) + .setDisplayName(displayName) + .setDescription(description) + .build(); + mockDataCatalog.addResponse(expectedResponse); + + EntryGroup entryGroup = EntryGroup.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + EntryGroup actualResponse = client.updateEntryGroup(entryGroup, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDataCatalog.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateEntryGroupRequest actualRequest = (UpdateEntryGroupRequest) actualRequests.get(0); + + Assert.assertEquals(entryGroup, actualRequest.getEntryGroup()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateEntryGroupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockDataCatalog.addException(exception); + + try { + EntryGroup entryGroup = EntryGroup.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + client.updateEntryGroup(entryGroup, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + @Test @SuppressWarnings("all") public void createTagTemplateTest() { diff --git a/synth.metadata b/synth.metadata index aaec50e5..9b54a0f6 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2020-02-06T22:45:57.666110Z", + "updateTime": "2020-02-07T09:46:34.577310Z", "sources": [ { "generator": { @@ -12,9 +12,9 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2e23b8fbc45f5d9e200572ca662fe1271bcd6760", - "internalRef": "293666452", - "log": "2e23b8fbc45f5d9e200572ca662fe1271bcd6760\nAdd ListEntryGroups method, add http bindings to support entry group tagging, and update some comments.\n\nPiperOrigin-RevId: 293666452\n\n0275e38a4ca03a13d3f47a9613aac8c8b0d3f1f2\nAdd proto_package field to managedidentities API. It is needed for APIs that still depend on artman generation.\n\nPiperOrigin-RevId: 293643323\n\n4cdfe8278cb6f308106580d70648001c9146e759\nRegenerating public protos for Data Catalog to add new Custom Type Entry feature.\n\nPiperOrigin-RevId: 293614782\n\n45d2a569ab526a1fad3720f95eefb1c7330eaada\nEnable client generation for v1 ManagedIdentities API.\n\nPiperOrigin-RevId: 293515675\n\n2c17086b77e6f3bcf04a1f65758dfb0c3da1568f\nAdd the Actions on Google common types (//google/actions/type/*).\n\nPiperOrigin-RevId: 293478245\n\n781aadb932e64a12fb6ead7cd842698d99588433\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293443396\n\ne2602608c9138c2fca24162720e67f9307c30b95\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293442964\n\nc8aef82028d06b7992278fa9294c18570dc86c3d\nAdd cc_proto_library and cc_grpc_library targets for Bigtable protos.\n\nAlso fix indentation of cc_grpc_library targets in Spanner and IAM protos.\n\nPiperOrigin-RevId: 293440538\n\ne2faab04f4cb7f9755072330866689b1943a16e9\ncloudtasks: v2 replace non-standard retry params in gapic config v2\n\nPiperOrigin-RevId: 293424055\n\ndfb4097ea628a8470292c6590a4313aee0c675bd\nerrorreporting: v1beta1 add legacy artman config for php\n\nPiperOrigin-RevId: 293423790\n\nb18aed55b45bfe5b62476292c72759e6c3e573c6\nasset: v1p1beta1 updated comment for `page_size` limit.\n\nPiperOrigin-RevId: 293421386\n\nc9ef36b7956d9859a2fc86ad35fcaa16958ab44f\nbazel: Refactor CI build scripts\n\nPiperOrigin-RevId: 293387911\n\n" + "sha": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585", + "internalRef": "293710856", + "log": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585\nGenerate the Bazel build file for recommendengine public api\n\nPiperOrigin-RevId: 293710856\n\n68477017c4173c98addac0373950c6aa9d7b375f\nMake `language_code` optional for UpdateIntentRequest and BatchUpdateIntentsRequest.\n\nThe comments and proto annotations describe this parameter as optional.\n\nPiperOrigin-RevId: 293703548\n\n16f823f578bca4e845a19b88bb9bc5870ea71ab2\nAdd BUILD.bazel files for managedidentities API\n\nPiperOrigin-RevId: 293698246\n\n2f53fd8178c9a9de4ad10fae8dd17a7ba36133f2\nAdd v1p1beta1 config file\n\nPiperOrigin-RevId: 293696729\n\n052b274138fce2be80f97b6dcb83ab343c7c8812\nAdd source field for user event and add field behavior annotations\n\nPiperOrigin-RevId: 293693115\n\n1e89732b2d69151b1b3418fff3d4cc0434f0dded\ndatacatalog: v1beta1 add three new RPCs to gapic v1beta1 config\n\nPiperOrigin-RevId: 293692823\n\n9c8bd09bbdc7c4160a44f1fbab279b73cd7a2337\nchange the name of AccessApproval service to AccessApprovalAdmin\n\nPiperOrigin-RevId: 293690934\n\n" } }, {