From 2050444130585d43787c0dfb1786f0b8f5d8324c Mon Sep 17 00:00:00 2001 From: Neenu Shaji Date: Sun, 5 Sep 2021 14:04:29 -0400 Subject: [PATCH] chore: migrate to owlbot (#557) --- .../v1beta1/DatacatalogGetEntry.java | 95 --------------- .../v1beta1/DatacatalogLookupEntry.java | 82 ------------- .../DatacatalogLookupEntrySqlResource.java | 79 ------------ .../v1beta1/DatacatalogSearch.java | 112 ------------------ 4 files changed, 368 deletions(-) delete mode 100644 datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogGetEntry.java delete mode 100644 datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogLookupEntry.java delete mode 100644 datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogLookupEntrySqlResource.java delete mode 100644 datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogSearch.java diff --git a/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogGetEntry.java b/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogGetEntry.java deleted file mode 100644 index c7384ef344f..00000000000 --- a/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogGetEntry.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2020 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. - */ -// DO NOT EDIT! This is a generated sample ("Request", "datacatalog_get_entry") -// sample-metadata: -// title: -// description: Get Entry -// usage: gradle run -PmainClass=com.google.cloud.examples.datacatalog.v1beta1.DatacatalogGetEntry [--args='[--project_id "[Google Cloud Project ID]"] [--location_id "[Google Cloud Location ID]"] [--entry_group_id "[Entry Group ID]"] [--entry_id "[Entry ID]"]'] - -package com.google.cloud.examples.datacatalog.v1beta1; - -import com.google.cloud.datacatalog.v1beta1.DataCatalogClient; -import com.google.cloud.datacatalog.v1beta1.Entry; -import com.google.cloud.datacatalog.v1beta1.GetEntryRequest; -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; - -public class DatacatalogGetEntry { - // [START datacatalog_get_entry] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.datacatalog.v1beta1.DataCatalogClient; - * import com.google.cloud.datacatalog.v1beta1.Entry; - * import com.google.cloud.datacatalog.v1beta1.GetEntryRequest; - */ - - public static void sampleGetEntry() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "[Google Cloud Project ID]"; - String locationId = "[Google Cloud Location ID]"; - String entryGroupId = "[Entry Group ID]"; - String entryId = "[Entry ID]"; - sampleGetEntry(projectId, locationId, entryGroupId, entryId); - } - - /** - * Get Entry - * - * @param projectId Your Google Cloud project ID - * @param locationId Google Cloud region, e.g. us-central1 - * @param entryGroupId ID of the Entry Group, e.g. {@literal @}bigquery, {@literal @}pubsub, - * my_entry_group - * @param entryId ID of the Entry - */ - public static void sampleGetEntry( - String projectId, String locationId, String entryGroupId, String entryId) { - try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) { - String formattedName = - DataCatalogClient.formatEntryName(projectId, locationId, entryGroupId, entryId); - GetEntryRequest request = GetEntryRequest.newBuilder().setName(formattedName).build(); - Entry response = dataCatalogClient.getEntry(request); - Entry entry = response; - System.out.printf("Entry name: %s\n", entry.getName()); - System.out.printf("Entry type: %s\n", entry.getType()); - System.out.printf("Linked resource: %s\n", entry.getLinkedResource()); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END datacatalog_get_entry] - - public static void main(String[] args) throws Exception { - Options options = new Options(); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("project_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("location_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("entry_group_id").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("entry_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "[Google Cloud Project ID]"); - String locationId = cl.getOptionValue("location_id", "[Google Cloud Location ID]"); - String entryGroupId = cl.getOptionValue("entry_group_id", "[Entry Group ID]"); - String entryId = cl.getOptionValue("entry_id", "[Entry ID]"); - - sampleGetEntry(projectId, locationId, entryGroupId, entryId); - } -} diff --git a/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogLookupEntry.java b/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogLookupEntry.java deleted file mode 100644 index ba336eafdb3..00000000000 --- a/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogLookupEntry.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2020 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. - */ -// DO NOT EDIT! This is a generated sample ("Request", "datacatalog_lookup_entry") -// sample-metadata: -// title: -// description: Lookup Entry -// usage: gradle run -PmainClass=com.google.cloud.examples.datacatalog.v1beta1.DatacatalogLookupEntry [--args='[--resource_name "[Full Resource Name]"]'] - -package com.google.cloud.examples.datacatalog.v1beta1; - -import com.google.cloud.datacatalog.v1beta1.DataCatalogClient; -import com.google.cloud.datacatalog.v1beta1.Entry; -import com.google.cloud.datacatalog.v1beta1.LookupEntryRequest; -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; - -public class DatacatalogLookupEntry { - // [START datacatalog_lookup_entry] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.datacatalog.v1beta1.DataCatalogClient; - * import com.google.cloud.datacatalog.v1beta1.Entry; - * import com.google.cloud.datacatalog.v1beta1.LookupEntryRequest; - */ - - public static void sampleLookupEntry() { - // TODO(developer): Replace these variables before running the sample. - String resourceName = "[Full Resource Name]"; - sampleLookupEntry(resourceName); - } - - /** - * Lookup Entry - * - * @param resourceName The full name of the Google Cloud Platform resource the Data Catalog entry - * represents. See: https://cloud.google.com/apis/design/resource_names#full_resource_name - * Examples: - * //bigquery.googleapis.com/projects/bigquery-public-data/datasets/new_york_taxi_trips/tables/taxi_zone_geom - * //pubsub.googleapis.com/projects/pubsub-public-data/topics/taxirides-realtime - */ - public static void sampleLookupEntry(String resourceName) { - try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) { - LookupEntryRequest request = - LookupEntryRequest.newBuilder().setLinkedResource(resourceName).build(); - Entry response = dataCatalogClient.lookupEntry(request); - Entry entry = response; - System.out.printf("Entry name: %s\n", entry.getName()); - System.out.printf("Entry type: %s\n", entry.getType()); - System.out.printf("Linked resource: %s\n", entry.getLinkedResource()); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END datacatalog_lookup_entry] - - public static void main(String[] args) throws Exception { - Options options = new Options(); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("resource_name").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String resourceName = cl.getOptionValue("resource_name", "[Full Resource Name]"); - - sampleLookupEntry(resourceName); - } -} diff --git a/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogLookupEntrySqlResource.java b/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogLookupEntrySqlResource.java deleted file mode 100644 index 9826fc4c7fd..00000000000 --- a/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogLookupEntrySqlResource.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2020 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. - */ -// DO NOT EDIT! This is a generated sample ("Request", "datacatalog_lookup_entry_sql_resource") -// sample-metadata: -// title: -// description: Lookup Entry using SQL resource -// usage: gradle run -PmainClass=com.google.cloud.examples.datacatalog.v1beta1.DatacatalogLookupEntrySqlResource [--args='[--sql_name "[SQL Resource Name]"]'] - -package com.google.cloud.examples.datacatalog.v1beta1; - -import com.google.cloud.datacatalog.v1beta1.DataCatalogClient; -import com.google.cloud.datacatalog.v1beta1.Entry; -import com.google.cloud.datacatalog.v1beta1.LookupEntryRequest; -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; - -public class DatacatalogLookupEntrySqlResource { - // [START datacatalog_lookup_entry_sql_resource] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.datacatalog.v1beta1.DataCatalogClient; - * import com.google.cloud.datacatalog.v1beta1.Entry; - * import com.google.cloud.datacatalog.v1beta1.LookupEntryRequest; - */ - - public static void sampleLookupEntry() { - // TODO(developer): Replace these variables before running the sample. - String sqlName = "[SQL Resource Name]"; - sampleLookupEntry(sqlName); - } - - /** - * Lookup Entry using SQL resource - * - * @param sqlName The SQL name of the Google Cloud Platform resource the Data Catalog entry - * represents. Examples: - * bigquery.table.`bigquery-public-data`.new_york_taxi_trips.taxi_zone_geom - * pubsub.topic.`pubsub-public-data`.`taxirides-realtime` - */ - public static void sampleLookupEntry(String sqlName) { - try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) { - LookupEntryRequest request = LookupEntryRequest.newBuilder().setSqlResource(sqlName).build(); - Entry response = dataCatalogClient.lookupEntry(request); - Entry entry = response; - System.out.printf("Entry name: %s\n", entry.getName()); - System.out.printf("Entry type: %s\n", entry.getType()); - System.out.printf("Linked resource: %s\n", entry.getLinkedResource()); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END datacatalog_lookup_entry_sql_resource] - - public static void main(String[] args) throws Exception { - Options options = new Options(); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("sql_name").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String sqlName = cl.getOptionValue("sql_name", "[SQL Resource Name]"); - - sampleLookupEntry(sqlName); - } -} diff --git a/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogSearch.java b/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogSearch.java deleted file mode 100644 index 1bd5aa5c297..00000000000 --- a/datacatalog/generated/src/main/java/com/google/cloud/examples/datacatalog/v1beta1/DatacatalogSearch.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2020 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. - */ -// DO NOT EDIT! This is a generated sample ("RequestPaged", "datacatalog_search") -// sample-metadata: -// title: -// description: Search Catalog -// usage: gradle run -PmainClass=com.google.cloud.examples.datacatalog.v1beta1.DatacatalogSearch [--args='[--include_project_id "[Google Cloud Project ID]"] [--include_gcp_public_datasets false] [--query "[String in search query syntax]"]'] - -package com.google.cloud.examples.datacatalog.v1beta1; - -import com.google.cloud.datacatalog.v1beta1.DataCatalogClient; -import com.google.cloud.datacatalog.v1beta1.SearchCatalogRequest; -import com.google.cloud.datacatalog.v1beta1.SearchCatalogRequest.Scope; -import com.google.cloud.datacatalog.v1beta1.SearchCatalogResult; -import java.util.Arrays; -import java.util.List; -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; - -public class DatacatalogSearch { - // [START datacatalog_search] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.datacatalog.v1beta1.DataCatalogClient; - * import com.google.cloud.datacatalog.v1beta1.SearchCatalogRequest; - * import com.google.cloud.datacatalog.v1beta1.SearchCatalogRequest.Scope; - * import com.google.cloud.datacatalog.v1beta1.SearchCatalogResult; - * import java.util.Arrays; - * import java.util.List; - */ - - public static void sampleSearchCatalog() { - // TODO(developer): Replace these variables before running the sample. - String includeProjectId = "[Google Cloud Project ID]"; - boolean includeGcpPublicDatasets = false; - String query = "[String in search query syntax]"; - sampleSearchCatalog(includeProjectId, includeGcpPublicDatasets, query); - } - - /** - * Search Catalog - * - * @param includeProjectId Your Google Cloud project ID. - * @param includeGcpPublicDatasets If true, include Google Cloud Platform (GCP) public datasets in - * the search results. - * @param query Your query string. See: - * https://cloud.google.com/data-catalog/docs/how-to/search-reference Example: system=bigquery - * type=dataset - */ - public static void sampleSearchCatalog( - String includeProjectId, boolean includeGcpPublicDatasets, String query) { - try (DataCatalogClient dataCatalogClient = DataCatalogClient.create()) { - List includeProjectIds = Arrays.asList(includeProjectId); - SearchCatalogRequest.Scope scope = - SearchCatalogRequest.Scope.newBuilder() - .addAllIncludeProjectIds(includeProjectIds) - .setIncludeGcpPublicDatasets(includeGcpPublicDatasets) - .build(); - SearchCatalogRequest request = - SearchCatalogRequest.newBuilder().setScope(scope).setQuery(query).build(); - for (SearchCatalogResult responseItem : - dataCatalogClient.searchCatalog(request).iterateAll()) { - System.out.printf("Result type: %s\n", responseItem.getSearchResultType()); - System.out.printf("Result subtype: %s\n", responseItem.getSearchResultSubtype()); - System.out.printf("Relative resource name: %s\n", responseItem.getRelativeResourceName()); - System.out.printf("Linked resource: %s\n\n", responseItem.getLinkedResource()); - } - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END datacatalog_search] - - public static void main(String[] args) throws Exception { - Options options = new Options(); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("include_project_id").build()); - options.addOption( - Option.builder("") - .required(false) - .hasArg(true) - .longOpt("include_gcp_public_datasets") - .build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("query").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String includeProjectId = cl.getOptionValue("include_project_id", "[Google Cloud Project ID]"); - boolean includeGcpPublicDatasets = - cl.getOptionValue("include_gcp_public_datasets") != null - ? Boolean.parseBoolean(cl.getOptionValue("include_gcp_public_datasets")) - : false; - String query = cl.getOptionValue("query", "[String in search query syntax]"); - - sampleSearchCatalog(includeProjectId, includeGcpPublicDatasets, query); - } -}