diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchAutocompleteJobTitle.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchAutocompleteJobTitle.java deleted file mode 100644 index a318049cab0..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchAutocompleteJobTitle.java +++ /dev/null @@ -1,109 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.CompleteQueryRequest; -import com.google.cloud.talent.v4beta1.CompleteQueryResponse; -import com.google.cloud.talent.v4beta1.CompletionClient; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -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 JobSearchAutocompleteJobTitle { - // [START job_search_autocomplete_job_title] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.CompleteQueryRequest; - * import com.google.cloud.talent.v4beta1.CompleteQueryResponse; - * import com.google.cloud.talent.v4beta1.CompleteQueryResponse.CompletionResult; - * import com.google.cloud.talent.v4beta1.CompletionClient; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - * import java.util.Arrays; - * import java.util.List; - */ - - public static void sampleCompleteQuery() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String query = "[partially typed job title]"; - int numResults = 5; - String languageCode = "en-US"; - sampleCompleteQuery(projectId, tenantId, query, numResults, languageCode); - } - - /** - * Complete job title given partial text (autocomplete) - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenantd - */ - public static void sampleCompleteQuery( - String projectId, String tenantId, String query, int numResults, String languageCode) { - try (CompletionClient completionClient = CompletionClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - List languageCodes = Arrays.asList(languageCode); - CompleteQueryRequest request = - CompleteQueryRequest.newBuilder() - .setParent(parent.toString()) - .setQuery(query) - .setPageSize(numResults) - .addAllLanguageCodes(languageCodes) - .build(); - CompleteQueryResponse response = completionClient.completeQuery(request); - for (CompleteQueryResponse.CompletionResult result : response.getCompletionResultsList()) { - System.out.printf("Suggested title: %s\n", result.getSuggestion()); - // Suggestion type is JOB_TITLE or COMPANY_TITLE - System.out.printf("Suggestion type: %s\n", result.getType()); - } - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_autocomplete_job_title] - - 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("tenant_id").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("query").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("num_results").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("language_code").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String query = cl.getOptionValue("query", "[partially typed job title]"); - int numResults = - cl.getOptionValue("num_results") != null - ? Integer.parseInt(cl.getOptionValue("num_results")) - : 5; - String languageCode = cl.getOptionValue("language_code", "en-US"); - - sampleCompleteQuery(projectId, tenantId, query, numResults, languageCode); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchBatchCreateJobs.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchBatchCreateJobs.java deleted file mode 100644 index bfaa3fc1699..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchBatchCreateJobs.java +++ /dev/null @@ -1,236 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.api.gax.longrunning.OperationFuture; -import com.google.cloud.talent.v4beta1.BatchCreateJobsRequest; -import com.google.cloud.talent.v4beta1.BatchOperationMetadata; -import com.google.cloud.talent.v4beta1.Job; -import com.google.cloud.talent.v4beta1.JobOperationResult; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.TenantName; -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 JobSearchBatchCreateJobs { - // [START job_search_batch_create_jobs] - /* - * Please include the following imports to run this sample. - * - * import com.google.api.gax.longrunning.OperationFuture; - * import com.google.cloud.talent.v4beta1.BatchCreateJobsRequest; - * import com.google.cloud.talent.v4beta1.BatchOperationMetadata; - * import com.google.cloud.talent.v4beta1.Job; - * import com.google.cloud.talent.v4beta1.Job.ApplicationInfo; - * import com.google.cloud.talent.v4beta1.JobOperationResult; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.TenantName; - * import java.util.Arrays; - * import java.util.List; - */ - - public static void sampleBatchCreateJobs() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String companyNameOne = "Company name, e.g. projects/your-project/companies/company-id"; - String requisitionIdOne = "Job requisition ID, aka Posting ID. Unique per job."; - String titleOne = "Software Engineer"; - String descriptionOne = "This is a description of this wonderful job!"; - String jobApplicationUrlOne = "https://www.example.org/job-posting/123"; - String addressOne = "1600 Amphitheatre Parkway, Mountain View, CA 94043"; - String languageCodeOne = "en-US"; - String companyNameTwo = "Company name, e.g. projects/your-project/companies/company-id"; - String requisitionIdTwo = "Job requisition ID, aka Posting ID. Unique per job."; - String titleTwo = "Quality Assurance"; - String descriptionTwo = "This is a description of this wonderful job!"; - String jobApplicationUrlTwo = "https://www.example.org/job-posting/123"; - String addressTwo = "111 8th Avenue, New York, NY 10011"; - String languageCodeTwo = "en-US"; - sampleBatchCreateJobs( - projectId, - tenantId, - companyNameOne, - requisitionIdOne, - titleOne, - descriptionOne, - jobApplicationUrlOne, - addressOne, - languageCodeOne, - companyNameTwo, - requisitionIdTwo, - titleTwo, - descriptionTwo, - jobApplicationUrlTwo, - addressTwo, - languageCodeTwo); - } - - /** - * Batch Create Jobs - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenant - */ - public static void sampleBatchCreateJobs( - String projectId, - String tenantId, - String companyNameOne, - String requisitionIdOne, - String titleOne, - String descriptionOne, - String jobApplicationUrlOne, - String addressOne, - String languageCodeOne, - String companyNameTwo, - String requisitionIdTwo, - String titleTwo, - String descriptionTwo, - String jobApplicationUrlTwo, - String addressTwo, - String languageCodeTwo) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - String formattedParent = TenantName.format(projectId, tenantId); - List uris = Arrays.asList(jobApplicationUrlOne); - Job.ApplicationInfo applicationInfo = - Job.ApplicationInfo.newBuilder().addAllUris(uris).build(); - List addresses = Arrays.asList(addressOne); - Job jobsElement = - Job.newBuilder() - .setCompany(companyNameOne) - .setRequisitionId(requisitionIdOne) - .setTitle(titleOne) - .setDescription(descriptionOne) - .setApplicationInfo(applicationInfo) - .addAllAddresses(addresses) - .setLanguageCode(languageCodeOne) - .build(); - List uris2 = Arrays.asList(jobApplicationUrlTwo); - Job.ApplicationInfo applicationInfo2 = - Job.ApplicationInfo.newBuilder().addAllUris(uris2).build(); - List addresses2 = Arrays.asList(addressTwo); - Job jobsElement2 = - Job.newBuilder() - .setCompany(companyNameTwo) - .setRequisitionId(requisitionIdTwo) - .setTitle(titleTwo) - .setDescription(descriptionTwo) - .setApplicationInfo(applicationInfo2) - .addAllAddresses(addresses2) - .setLanguageCode(languageCodeTwo) - .build(); - List jobs = Arrays.asList(jobsElement, jobsElement2); - BatchCreateJobsRequest request = - BatchCreateJobsRequest.newBuilder().setParent(formattedParent).addAllJobs(jobs).build(); - OperationFuture future = - jobServiceClient.batchCreateJobsAsync(request); - - System.out.println("Waiting for operation to complete..."); - JobOperationResult response = future.get(); - System.out.printf("Batch response: %s\n", response); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_batch_create_jobs] - - 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("tenant_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("company_name_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("requisition_id_one").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("title_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("description_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("job_application_url_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("address_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("language_code_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("company_name_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("requisition_id_two").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("title_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("description_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("job_application_url_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("address_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("language_code_two").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String companyNameOne = - cl.getOptionValue( - "company_name_one", "Company name, e.g. projects/your-project/companies/company-id"); - String requisitionIdOne = - cl.getOptionValue( - "requisition_id_one", "Job requisition ID, aka Posting ID. Unique per job."); - String titleOne = cl.getOptionValue("title_one", "Software Engineer"); - String descriptionOne = - cl.getOptionValue("description_one", "This is a description of this wonderful job!"); - String jobApplicationUrlOne = - cl.getOptionValue("job_application_url_one", "https://www.example.org/job-posting/123"); - String addressOne = - cl.getOptionValue("address_one", "1600 Amphitheatre Parkway, Mountain View, CA 94043"); - String languageCodeOne = cl.getOptionValue("language_code_one", "en-US"); - String companyNameTwo = - cl.getOptionValue( - "company_name_two", "Company name, e.g. projects/your-project/companies/company-id"); - String requisitionIdTwo = - cl.getOptionValue( - "requisition_id_two", "Job requisition ID, aka Posting ID. Unique per job."); - String titleTwo = cl.getOptionValue("title_two", "Quality Assurance"); - String descriptionTwo = - cl.getOptionValue("description_two", "This is a description of this wonderful job!"); - String jobApplicationUrlTwo = - cl.getOptionValue("job_application_url_two", "https://www.example.org/job-posting/123"); - String addressTwo = cl.getOptionValue("address_two", "111 8th Avenue, New York, NY 10011"); - String languageCodeTwo = cl.getOptionValue("language_code_two", "en-US"); - - sampleBatchCreateJobs( - projectId, - tenantId, - companyNameOne, - requisitionIdOne, - titleOne, - descriptionOne, - jobApplicationUrlOne, - addressOne, - languageCodeOne, - companyNameTwo, - requisitionIdTwo, - titleTwo, - descriptionTwo, - jobApplicationUrlTwo, - addressTwo, - languageCodeTwo); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchBatchDeleteJob.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchBatchDeleteJob.java deleted file mode 100644 index 2d163d8fb26..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchBatchDeleteJob.java +++ /dev/null @@ -1,85 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -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 JobSearchBatchDeleteJob { - // [START job_search_batch_delete_job] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - */ - - public static void sampleBatchDeleteJobs() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String filter = "[Query]"; - sampleBatchDeleteJobs(projectId, tenantId, filter); - } - - /** - * Batch delete jobs using a filter - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenantd - * @param filter The filter string specifies the jobs to be deleted. For example: companyName = - * "projects/api-test-project/companies/123" AND equisitionId = "req-1" - */ - public static void sampleBatchDeleteJobs(String projectId, String tenantId, String filter) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - BatchDeleteJobsRequest request = - BatchDeleteJobsRequest.newBuilder() - .setParent(parent.toString()) - .setFilter(filter) - .build(); - jobServiceClient.batchDeleteJobs(request); - System.out.println("Batch deleted jobs from filter"); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_batch_delete_job] - - 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("tenant_id").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("filter").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String filter = cl.getOptionValue("filter", "[Query]"); - - sampleBatchDeleteJobs(projectId, tenantId, filter); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchBatchUpdateJobs.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchBatchUpdateJobs.java deleted file mode 100644 index 1cf7d0289df..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchBatchUpdateJobs.java +++ /dev/null @@ -1,256 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.api.gax.longrunning.OperationFuture; -import com.google.cloud.talent.v4beta1.BatchOperationMetadata; -import com.google.cloud.talent.v4beta1.BatchUpdateJobsRequest; -import com.google.cloud.talent.v4beta1.Job; -import com.google.cloud.talent.v4beta1.JobOperationResult; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.TenantName; -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 JobSearchBatchUpdateJobs { - // [START job_search_batch_update_jobs] - /* - * Please include the following imports to run this sample. - * - * import com.google.api.gax.longrunning.OperationFuture; - * import com.google.cloud.talent.v4beta1.BatchOperationMetadata; - * import com.google.cloud.talent.v4beta1.BatchUpdateJobsRequest; - * import com.google.cloud.talent.v4beta1.Job; - * import com.google.cloud.talent.v4beta1.Job.ApplicationInfo; - * import com.google.cloud.talent.v4beta1.JobOperationResult; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.TenantName; - * import java.util.Arrays; - * import java.util.List; - */ - - public static void sampleBatchUpdateJobs() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String jobNameOne = "job name, e.g. projects/your-project/tenants/tenant-id/jobs/job-id"; - String companyNameOne = "Company name, e.g. projects/your-project/companies/company-id"; - String requisitionIdOne = "Job requisition ID, aka Posting ID. Unique per job."; - String titleOne = "Software Engineer"; - String descriptionOne = "This is a description of this wonderful job!"; - String jobApplicationUrlOne = "https://www.example.org/job-posting/123"; - String addressOne = "1600 Amphitheatre Parkway, Mountain View, CA 94043"; - String languageCodeOne = "en-US"; - String jobNameTwo = "job name, e.g. projects/your-project/tenants/tenant-id/jobs/job-id"; - String companyNameTwo = "Company name, e.g. projects/your-project/companies/company-id"; - String requisitionIdTwo = "Job requisition ID, aka Posting ID. Unique per job."; - String titleTwo = "Quality Assurance"; - String descriptionTwo = "This is a description of this wonderful job!"; - String jobApplicationUrlTwo = "https://www.example.org/job-posting/123"; - String addressTwo = "111 8th Avenue, New York, NY 10011"; - String languageCodeTwo = "en-US"; - sampleBatchUpdateJobs( - projectId, - tenantId, - jobNameOne, - companyNameOne, - requisitionIdOne, - titleOne, - descriptionOne, - jobApplicationUrlOne, - addressOne, - languageCodeOne, - jobNameTwo, - companyNameTwo, - requisitionIdTwo, - titleTwo, - descriptionTwo, - jobApplicationUrlTwo, - addressTwo, - languageCodeTwo); - } - - /** - * Batch Update Jobs - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenant - */ - public static void sampleBatchUpdateJobs( - String projectId, - String tenantId, - String jobNameOne, - String companyNameOne, - String requisitionIdOne, - String titleOne, - String descriptionOne, - String jobApplicationUrlOne, - String addressOne, - String languageCodeOne, - String jobNameTwo, - String companyNameTwo, - String requisitionIdTwo, - String titleTwo, - String descriptionTwo, - String jobApplicationUrlTwo, - String addressTwo, - String languageCodeTwo) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - String formattedParent = TenantName.format(projectId, tenantId); - List uris = Arrays.asList(jobApplicationUrlOne); - Job.ApplicationInfo applicationInfo = - Job.ApplicationInfo.newBuilder().addAllUris(uris).build(); - List addresses = Arrays.asList(addressOne); - Job jobsElement = - Job.newBuilder() - .setName(jobNameOne) - .setCompany(companyNameOne) - .setRequisitionId(requisitionIdOne) - .setTitle(titleOne) - .setDescription(descriptionOne) - .setApplicationInfo(applicationInfo) - .addAllAddresses(addresses) - .setLanguageCode(languageCodeOne) - .build(); - List uris2 = Arrays.asList(jobApplicationUrlTwo); - Job.ApplicationInfo applicationInfo2 = - Job.ApplicationInfo.newBuilder().addAllUris(uris2).build(); - List addresses2 = Arrays.asList(addressTwo); - Job jobsElement2 = - Job.newBuilder() - .setName(jobNameTwo) - .setCompany(companyNameTwo) - .setRequisitionId(requisitionIdTwo) - .setTitle(titleTwo) - .setDescription(descriptionTwo) - .setApplicationInfo(applicationInfo2) - .addAllAddresses(addresses2) - .setLanguageCode(languageCodeTwo) - .build(); - List jobs = Arrays.asList(jobsElement, jobsElement2); - BatchUpdateJobsRequest request = - BatchUpdateJobsRequest.newBuilder().setParent(formattedParent).addAllJobs(jobs).build(); - OperationFuture future = - jobServiceClient.batchUpdateJobsAsync(request); - - System.out.println("Waiting for operation to complete..."); - JobOperationResult response = future.get(); - System.out.printf("Batch response: %s\n", response); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_batch_update_jobs] - - 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("tenant_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("job_name_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("company_name_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("requisition_id_one").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("title_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("description_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("job_application_url_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("address_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("language_code_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("job_name_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("company_name_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("requisition_id_two").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("title_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("description_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("job_application_url_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("address_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("language_code_two").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String jobNameOne = - cl.getOptionValue( - "job_name_one", "job name, e.g. projects/your-project/tenants/tenant-id/jobs/job-id"); - String companyNameOne = - cl.getOptionValue( - "company_name_one", "Company name, e.g. projects/your-project/companies/company-id"); - String requisitionIdOne = - cl.getOptionValue( - "requisition_id_one", "Job requisition ID, aka Posting ID. Unique per job."); - String titleOne = cl.getOptionValue("title_one", "Software Engineer"); - String descriptionOne = - cl.getOptionValue("description_one", "This is a description of this wonderful job!"); - String jobApplicationUrlOne = - cl.getOptionValue("job_application_url_one", "https://www.example.org/job-posting/123"); - String addressOne = - cl.getOptionValue("address_one", "1600 Amphitheatre Parkway, Mountain View, CA 94043"); - String languageCodeOne = cl.getOptionValue("language_code_one", "en-US"); - String jobNameTwo = - cl.getOptionValue( - "job_name_two", "job name, e.g. projects/your-project/tenants/tenant-id/jobs/job-id"); - String companyNameTwo = - cl.getOptionValue( - "company_name_two", "Company name, e.g. projects/your-project/companies/company-id"); - String requisitionIdTwo = - cl.getOptionValue( - "requisition_id_two", "Job requisition ID, aka Posting ID. Unique per job."); - String titleTwo = cl.getOptionValue("title_two", "Quality Assurance"); - String descriptionTwo = - cl.getOptionValue("description_two", "This is a description of this wonderful job!"); - String jobApplicationUrlTwo = - cl.getOptionValue("job_application_url_two", "https://www.example.org/job-posting/123"); - String addressTwo = cl.getOptionValue("address_two", "111 8th Avenue, New York, NY 10011"); - String languageCodeTwo = cl.getOptionValue("language_code_two", "en-US"); - - sampleBatchUpdateJobs( - projectId, - tenantId, - jobNameOne, - companyNameOne, - requisitionIdOne, - titleOne, - descriptionOne, - jobApplicationUrlOne, - addressOne, - languageCodeOne, - jobNameTwo, - companyNameTwo, - requisitionIdTwo, - titleTwo, - descriptionTwo, - jobApplicationUrlTwo, - addressTwo, - languageCodeTwo); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCommuteSearch.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCommuteSearch.java deleted file mode 100644 index 7f2c5fce366..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCommuteSearch.java +++ /dev/null @@ -1,119 +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. - */ -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.CommuteFilter; -import com.google.cloud.talent.v4beta1.CommuteMethod; -import com.google.cloud.talent.v4beta1.Job; -import com.google.cloud.talent.v4beta1.JobQuery; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.RequestMetadata; -import com.google.cloud.talent.v4beta1.SearchJobsRequest; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -import com.google.protobuf.Duration; -import com.google.type.LatLng; -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 JobSearchCommuteSearch { - // [START job_search_commute_search] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.CommuteFilter; - * import com.google.cloud.talent.v4beta1.CommuteMethod; - * import com.google.cloud.talent.v4beta1.Job; - * import com.google.cloud.talent.v4beta1.JobQuery; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.RequestMetadata; - * import com.google.cloud.talent.v4beta1.SearchJobsRequest; - * import com.google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - * import com.google.protobuf.Duration; - * import com.google.type.LatLng; - */ - - public static void sampleSearchJobs() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - sampleSearchJobs(projectId, tenantId); - } - - /** Search Jobs using commute distance */ - public static void sampleSearchJobs(String projectId, String tenantId) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - String domain = "www.example.com"; - String sessionId = "Hashed session identifier"; - String userId = "Hashed user identifier"; - RequestMetadata requestMetadata = - RequestMetadata.newBuilder() - .setDomain(domain) - .setSessionId(sessionId) - .setUserId(userId) - .build(); - CommuteMethod commuteMethod = CommuteMethod.TRANSIT; - long seconds = 1800L; - Duration travelDuration = Duration.newBuilder().setSeconds(seconds).build(); - double latitude = 37.422408; - double longitude = -122.084068; - LatLng startCoordinates = - LatLng.newBuilder().setLatitude(latitude).setLongitude(longitude).build(); - CommuteFilter commuteFilter = - CommuteFilter.newBuilder() - .setCommuteMethod(commuteMethod) - .setTravelDuration(travelDuration) - .setStartCoordinates(startCoordinates) - .build(); - JobQuery jobQuery = JobQuery.newBuilder().setCommuteFilter(commuteFilter).build(); - SearchJobsRequest request = - SearchJobsRequest.newBuilder() - .setParent(parent.toString()) - .setRequestMetadata(requestMetadata) - .setJobQuery(jobQuery) - .build(); - for (SearchJobsResponse.MatchingJob responseItem : - jobServiceClient.searchJobs(request).iterateAll()) { - System.out.printf("Job summary: %s\n", responseItem.getJobSummary()); - System.out.printf("Job title snippet: %s\n", responseItem.getJobTitleSnippet()); - Job job = responseItem.getJob(); - System.out.printf("Job name: %s\n", job.getName()); - System.out.printf("Job title: %s\n", job.getTitle()); - } - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_commute_search] - - 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("tenant_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - - sampleSearchJobs(projectId, tenantId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateClientEvent.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateClientEvent.java deleted file mode 100644 index 4d4faa4ef3f..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateClientEvent.java +++ /dev/null @@ -1,124 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.ClientEvent; -import com.google.cloud.talent.v4beta1.CreateClientEventRequest; -import com.google.cloud.talent.v4beta1.EventServiceClient; -import com.google.cloud.talent.v4beta1.JobEvent; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -import com.google.protobuf.Timestamp; -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 JobSearchCreateClientEvent { - // [START job_search_create_client_event] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.ClientEvent; - * import com.google.cloud.talent.v4beta1.CreateClientEventRequest; - * import com.google.cloud.talent.v4beta1.EventServiceClient; - * import com.google.cloud.talent.v4beta1.JobEvent; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - * import com.google.protobuf.Timestamp; - * import java.util.Arrays; - * import java.util.List; - */ - - public static void sampleCreateClientEvent() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String requestId = "[request_id from ResponseMetadata]"; - String eventId = "[Set this to a unique identifier]"; - sampleCreateClientEvent(projectId, tenantId, requestId, eventId); - } - - /** - * Creates a client event - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenant - * @param requestId A unique ID generated in the API responses. Value should be set to the - * request_id from an API response. - * @param eventId A unique identifier, generated by the client application - */ - public static void sampleCreateClientEvent( - String projectId, String tenantId, String requestId, String eventId) { - try (EventServiceClient eventServiceClient = EventServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - - // The timestamp of the event as seconds of UTC time since Unix epoch - // For more information on how to create google.protobuf.Timestamps - // See: - // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto - long seconds = 0L; - Timestamp createTime = Timestamp.newBuilder().setSeconds(seconds).build(); - - // The type of event attributed to the behavior of the end user - JobEvent.JobEventType type = JobEvent.JobEventType.VIEW; - - // List of job names associated with this event - String jobsElement = "projects/[Project ID]/tenants/[Tenant ID]/jobs/[Job ID]"; - String jobsElement2 = "projects/[Project ID]/tenants/[Tenant ID]/jobs/[Job ID]"; - List jobs = Arrays.asList(jobsElement, jobsElement2); - JobEvent jobEvent = JobEvent.newBuilder().setType(type).addAllJobs(jobs).build(); - ClientEvent clientEvent = - ClientEvent.newBuilder() - .setRequestId(requestId) - .setEventId(eventId) - .setCreateTime(createTime) - .setJobEvent(jobEvent) - .build(); - CreateClientEventRequest request = - CreateClientEventRequest.newBuilder() - .setParent(parent.toString()) - .setClientEvent(clientEvent) - .build(); - ClientEvent response = eventServiceClient.createClientEvent(request); - System.out.println("Created client event"); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_create_client_event] - - 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("tenant_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("request_id").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("event_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String requestId = cl.getOptionValue("request_id", "[request_id from ResponseMetadata]"); - String eventId = cl.getOptionValue("event_id", "[Set this to a unique identifier]"); - - sampleCreateClientEvent(projectId, tenantId, requestId, eventId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateCompany.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateCompany.java deleted file mode 100644 index 86009221c38..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateCompany.java +++ /dev/null @@ -1,96 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.Company; -import com.google.cloud.talent.v4beta1.CompanyServiceClient; -import com.google.cloud.talent.v4beta1.CreateCompanyRequest; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -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 JobSearchCreateCompany { - // [START job_search_create_company] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.Company; - * import com.google.cloud.talent.v4beta1.CompanyServiceClient; - * import com.google.cloud.talent.v4beta1.CreateCompanyRequest; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - */ - - public static void sampleCreateCompany() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String displayName = "My Company Name"; - String externalId = "Identifier of this company in my system"; - sampleCreateCompany(projectId, tenantId, displayName, externalId); - } - - /** - * Create Company - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenant - */ - public static void sampleCreateCompany( - String projectId, String tenantId, String displayName, String externalId) { - try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - Company company = - Company.newBuilder().setDisplayName(displayName).setExternalId(externalId).build(); - CreateCompanyRequest request = - CreateCompanyRequest.newBuilder() - .setParent(parent.toString()) - .setCompany(company) - .build(); - Company response = companyServiceClient.createCompany(request); - System.out.println("Created Company"); - System.out.printf("Name: %s\n", response.getName()); - System.out.printf("Display Name: %s\n", response.getDisplayName()); - System.out.printf("External ID: %s\n", response.getExternalId()); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_create_company] - - 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("tenant_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("display_name").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("external_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String displayName = cl.getOptionValue("display_name", "My Company Name"); - String externalId = cl.getOptionValue("external_id", "Identifier of this company in my system"); - - sampleCreateCompany(projectId, tenantId, displayName, externalId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateJob.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateJob.java deleted file mode 100644 index 88322015318..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateJob.java +++ /dev/null @@ -1,165 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.CreateJobRequest; -import com.google.cloud.talent.v4beta1.Job; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -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 JobSearchCreateJob { - // [START job_search_create_job] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.CreateJobRequest; - * import com.google.cloud.talent.v4beta1.Job; - * import com.google.cloud.talent.v4beta1.Job.ApplicationInfo; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - * import java.util.Arrays; - * import java.util.List; - */ - - public static void sampleCreateJob() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String companyName = "Company name, e.g. projects/your-project/companies/company-id"; - String requisitionId = "Job requisition ID, aka Posting ID. Unique per job."; - String title = "Software Engineer"; - String description = "This is a description of this wonderful job!"; - String jobApplicationUrl = "https://www.example.org/job-posting/123"; - String addressOne = "1600 Amphitheatre Parkway, Mountain View, CA 94043"; - String addressTwo = "111 8th Avenue, New York, NY 10011"; - String languageCode = "en-US"; - sampleCreateJob( - projectId, - tenantId, - companyName, - requisitionId, - title, - description, - jobApplicationUrl, - addressOne, - addressTwo, - languageCode); - } - - /** - * Create Job - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenant - */ - public static void sampleCreateJob( - String projectId, - String tenantId, - String companyName, - String requisitionId, - String title, - String description, - String jobApplicationUrl, - String addressOne, - String addressTwo, - String languageCode) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - List uris = Arrays.asList(jobApplicationUrl); - Job.ApplicationInfo applicationInfo = - Job.ApplicationInfo.newBuilder().addAllUris(uris).build(); - List addresses = Arrays.asList(addressOne, addressTwo); - Job job = - Job.newBuilder() - .setCompany(companyName) - .setRequisitionId(requisitionId) - .setTitle(title) - .setDescription(description) - .setApplicationInfo(applicationInfo) - .addAllAddresses(addresses) - .setLanguageCode(languageCode) - .build(); - CreateJobRequest request = - CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build(); - Job response = jobServiceClient.createJob(request); - System.out.printf("Created job: %s\n", response.getName()); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_create_job] - - 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("tenant_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("company_name").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("requisition_id").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("title").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("description").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("job_application_url").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("address_one").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("address_two").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("language_code").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String companyName = - cl.getOptionValue( - "company_name", "Company name, e.g. projects/your-project/companies/company-id"); - String requisitionId = - cl.getOptionValue("requisition_id", "Job requisition ID, aka Posting ID. Unique per job."); - String title = cl.getOptionValue("title", "Software Engineer"); - String description = - cl.getOptionValue("description", "This is a description of this wonderful job!"); - String jobApplicationUrl = - cl.getOptionValue("job_application_url", "https://www.example.org/job-posting/123"); - String addressOne = - cl.getOptionValue("address_one", "1600 Amphitheatre Parkway, Mountain View, CA 94043"); - String addressTwo = cl.getOptionValue("address_two", "111 8th Avenue, New York, NY 10011"); - String languageCode = cl.getOptionValue("language_code", "en-US"); - - sampleCreateJob( - projectId, - tenantId, - companyName, - requisitionId, - title, - description, - jobApplicationUrl, - addressOne, - addressTwo, - languageCode); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateJobCustomAttributes.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateJobCustomAttributes.java deleted file mode 100644 index cbd7c1d5ca5..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateJobCustomAttributes.java +++ /dev/null @@ -1,105 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.CreateJobRequest; -import com.google.cloud.talent.v4beta1.Job; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -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 JobSearchCreateJobCustomAttributes { - // [START job_search_create_job_custom_attributes] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.CreateJobRequest; - * import com.google.cloud.talent.v4beta1.Job; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - */ - - public static void sampleCreateJob() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String companyName = "Company name, e.g. projects/your-project/companies/company-id"; - String requisitionId = "Job requisition ID, aka Posting ID. Unique per job."; - String languageCode = "en-US"; - sampleCreateJob(projectId, tenantId, companyName, requisitionId, languageCode); - } - - /** - * Create Job with Custom Attributes - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenantd - */ - public static void sampleCreateJob( - String projectId, - String tenantId, - String companyName, - String requisitionId, - String languageCode) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - Job job = - Job.newBuilder() - .setCompany(companyName) - .setRequisitionId(requisitionId) - .setLanguageCode(languageCode) - .build(); - CreateJobRequest request = - CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build(); - Job response = jobServiceClient.createJob(request); - System.out.printf("Created job: %s\n", response.getName()); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_create_job_custom_attributes] - - 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("tenant_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("company_name").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("requisition_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("language_code").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String companyName = - cl.getOptionValue( - "company_name", "Company name, e.g. projects/your-project/companies/company-id"); - String requisitionId = - cl.getOptionValue("requisition_id", "Job requisition ID, aka Posting ID. Unique per job."); - String languageCode = cl.getOptionValue("language_code", "en-US"); - - sampleCreateJob(projectId, tenantId, companyName, requisitionId, languageCode); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateTenant.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateTenant.java deleted file mode 100644 index a0d1775b9b2..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCreateTenant.java +++ /dev/null @@ -1,76 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.CreateTenantRequest; -import com.google.cloud.talent.v4beta1.ProjectName; -import com.google.cloud.talent.v4beta1.Tenant; -import com.google.cloud.talent.v4beta1.TenantServiceClient; -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 JobSearchCreateTenant { - // [START job_search_create_tenant] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.CreateTenantRequest; - * import com.google.cloud.talent.v4beta1.ProjectName; - * import com.google.cloud.talent.v4beta1.Tenant; - * import com.google.cloud.talent.v4beta1.TenantServiceClient; - */ - - public static void sampleCreateTenant() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String externalId = "Your Unique Identifier for Tenant"; - sampleCreateTenant(projectId, externalId); - } - - /** Create Tenant for scoping resources, e.g. companies and jobs */ - public static void sampleCreateTenant(String projectId, String externalId) { - try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { - ProjectName parent = ProjectName.of(projectId); - Tenant tenant = Tenant.newBuilder().setExternalId(externalId).build(); - CreateTenantRequest request = - CreateTenantRequest.newBuilder().setParent(parent.toString()).setTenant(tenant).build(); - Tenant response = tenantServiceClient.createTenant(request); - System.out.println("Created Tenant"); - System.out.printf("Name: %s\n", response.getName()); - System.out.printf("External ID: %s\n", response.getExternalId()); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_create_tenant] - - 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("external_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String externalId = cl.getOptionValue("external_id", "Your Unique Identifier for Tenant"); - - sampleCreateTenant(projectId, externalId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCustomRankingSearch.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCustomRankingSearch.java deleted file mode 100644 index cf916999260..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchCustomRankingSearch.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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.Job; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.RequestMetadata; -import com.google.cloud.talent.v4beta1.SearchJobsRequest; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -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 JobSearchCustomRankingSearch { - // [START job_search_custom_ranking_search] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.Job; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.RequestMetadata; - * import com.google.cloud.talent.v4beta1.SearchJobsRequest; - * import com.google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo; - * import com.google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - */ - - public static void sampleSearchJobs() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - sampleSearchJobs(projectId, tenantId); - } - - /** - * Search Jobs using custom rankings - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenantd - */ - public static void sampleSearchJobs(String projectId, String tenantId) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - String domain = "www.example.com"; - String sessionId = "Hashed session identifier"; - String userId = "Hashed user identifier"; - RequestMetadata requestMetadata = - RequestMetadata.newBuilder() - .setDomain(domain) - .setSessionId(sessionId) - .setUserId(userId) - .build(); - SearchJobsRequest.CustomRankingInfo.ImportanceLevel importanceLevel = - SearchJobsRequest.CustomRankingInfo.ImportanceLevel.EXTREME; - String rankingExpression = "(someFieldLong + 25) * 0.25"; - SearchJobsRequest.CustomRankingInfo customRankingInfo = - SearchJobsRequest.CustomRankingInfo.newBuilder() - .setImportanceLevel(importanceLevel) - .setRankingExpression(rankingExpression) - .build(); - String orderBy = "custom_ranking desc"; - SearchJobsRequest request = - SearchJobsRequest.newBuilder() - .setParent(parent.toString()) - .setRequestMetadata(requestMetadata) - .setCustomRankingInfo(customRankingInfo) - .setOrderBy(orderBy) - .build(); - for (SearchJobsResponse.MatchingJob responseItem : - jobServiceClient.searchJobs(request).iterateAll()) { - System.out.printf("Job summary: %s\n", responseItem.getJobSummary()); - System.out.printf("Job title snippet: %s\n", responseItem.getJobTitleSnippet()); - Job job = responseItem.getJob(); - System.out.printf("Job name: %s\n", job.getName()); - System.out.printf("Job title: %s\n", job.getTitle()); - } - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_custom_ranking_search] - - 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("tenant_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - - sampleSearchJobs(projectId, tenantId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchDeleteCompany.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchDeleteCompany.java deleted file mode 100644 index c4ef8acb657..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchDeleteCompany.java +++ /dev/null @@ -1,76 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.CompanyName; -import com.google.cloud.talent.v4beta1.CompanyServiceClient; -import com.google.cloud.talent.v4beta1.CompanyWithTenantName; -import com.google.cloud.talent.v4beta1.DeleteCompanyRequest; -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 JobSearchDeleteCompany { - // [START job_search_delete_company] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.CompanyName; - * import com.google.cloud.talent.v4beta1.CompanyServiceClient; - * import com.google.cloud.talent.v4beta1.CompanyWithTenantName; - * import com.google.cloud.talent.v4beta1.DeleteCompanyRequest; - */ - - public static void sampleDeleteCompany() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String companyId = "ID of the company to delete"; - sampleDeleteCompany(projectId, tenantId, companyId); - } - - /** Delete Company */ - public static void sampleDeleteCompany(String projectId, String tenantId, String companyId) { - try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { - CompanyName name = CompanyWithTenantName.of(projectId, tenantId, companyId); - DeleteCompanyRequest request = - DeleteCompanyRequest.newBuilder().setName(name.toString()).build(); - companyServiceClient.deleteCompany(request); - System.out.println("Deleted company"); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_delete_company] - - 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("tenant_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("company_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String companyId = cl.getOptionValue("company_id", "ID of the company to delete"); - - sampleDeleteCompany(projectId, tenantId, companyId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchDeleteJob.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchDeleteJob.java deleted file mode 100644 index ded170c624c..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchDeleteJob.java +++ /dev/null @@ -1,74 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.DeleteJobRequest; -import com.google.cloud.talent.v4beta1.JobName; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.JobWithTenantName; -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 JobSearchDeleteJob { - // [START job_search_delete_job] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.DeleteJobRequest; - * import com.google.cloud.talent.v4beta1.JobName; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.JobWithTenantName; - */ - - public static void sampleDeleteJob() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String jobId = "Company ID"; - sampleDeleteJob(projectId, tenantId, jobId); - } - - /** Delete Job */ - public static void sampleDeleteJob(String projectId, String tenantId, String jobId) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - JobName name = JobWithTenantName.of(projectId, tenantId, jobId); - DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build(); - jobServiceClient.deleteJob(request); - System.out.println("Deleted job."); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_delete_job] - - 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("tenant_id").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("job_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String jobId = cl.getOptionValue("job_id", "Company ID"); - - sampleDeleteJob(projectId, tenantId, jobId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchDeleteTenant.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchDeleteTenant.java deleted file mode 100644 index 95dac1df344..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchDeleteTenant.java +++ /dev/null @@ -1,70 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.DeleteTenantRequest; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantServiceClient; -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 JobSearchDeleteTenant { - // [START job_search_delete_tenant] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.DeleteTenantRequest; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantServiceClient; - */ - - public static void sampleDeleteTenant() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID)"; - sampleDeleteTenant(projectId, tenantId); - } - - /** Delete Tenant */ - public static void sampleDeleteTenant(String projectId, String tenantId) { - try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { - TenantName name = TenantName.of(projectId, tenantId); - DeleteTenantRequest request = - DeleteTenantRequest.newBuilder().setName(name.toString()).build(); - tenantServiceClient.deleteTenant(request); - System.out.println("Deleted Tenant."); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_delete_tenant] - - 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("tenant_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID)"); - - sampleDeleteTenant(projectId, tenantId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchGetCompany.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchGetCompany.java deleted file mode 100644 index 2fcf1721cf8..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchGetCompany.java +++ /dev/null @@ -1,78 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.Company; -import com.google.cloud.talent.v4beta1.CompanyName; -import com.google.cloud.talent.v4beta1.CompanyServiceClient; -import com.google.cloud.talent.v4beta1.CompanyWithTenantName; -import com.google.cloud.talent.v4beta1.GetCompanyRequest; -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 JobSearchGetCompany { - // [START job_search_get_company] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.Company; - * import com.google.cloud.talent.v4beta1.CompanyName; - * import com.google.cloud.talent.v4beta1.CompanyServiceClient; - * import com.google.cloud.talent.v4beta1.CompanyWithTenantName; - * import com.google.cloud.talent.v4beta1.GetCompanyRequest; - */ - - public static void sampleGetCompany() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String companyId = "Company ID"; - sampleGetCompany(projectId, tenantId, companyId); - } - - /** Get Company */ - public static void sampleGetCompany(String projectId, String tenantId, String companyId) { - try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { - CompanyName name = CompanyWithTenantName.of(projectId, tenantId, companyId); - GetCompanyRequest request = GetCompanyRequest.newBuilder().setName(name.toString()).build(); - Company response = companyServiceClient.getCompany(request); - System.out.printf("Company name: %s\n", response.getName()); - System.out.printf("Display name: %s\n", response.getDisplayName()); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_get_company] - - 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("tenant_id").build()); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("company_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String companyId = cl.getOptionValue("company_id", "Company ID"); - - sampleGetCompany(projectId, tenantId, companyId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchGetJob.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchGetJob.java deleted file mode 100644 index fbc92ccbe3a..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchGetJob.java +++ /dev/null @@ -1,89 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.GetJobRequest; -import com.google.cloud.talent.v4beta1.Job; -import com.google.cloud.talent.v4beta1.JobName; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.JobWithTenantName; -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 JobSearchGetJob { - // [START job_search_get_job] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.GetJobRequest; - * import com.google.cloud.talent.v4beta1.Job; - * import com.google.cloud.talent.v4beta1.JobName; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.JobWithTenantName; - */ - - public static void sampleGetJob() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String jobId = "Job ID"; - sampleGetJob(projectId, tenantId, jobId); - } - - /** Get Job */ - public static void sampleGetJob(String projectId, String tenantId, String jobId) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - JobName name = JobWithTenantName.of(projectId, tenantId, jobId); - GetJobRequest request = GetJobRequest.newBuilder().setName(name.toString()).build(); - Job response = jobServiceClient.getJob(request); - System.out.printf("Job name: %s\n", response.getName()); - System.out.printf("Requisition ID: %s\n", response.getRequisitionId()); - System.out.printf("Title: %s\n", response.getTitle()); - System.out.printf("Description: %s\n", response.getDescription()); - System.out.printf("Posting language: %s\n", response.getLanguageCode()); - for (String address : response.getAddressesList()) { - System.out.printf("Address: %s\n", address); - } - for (String email : response.getApplicationInfo().getEmailsList()) { - System.out.printf("Email: %s\n", email); - } - for (String websiteUri : response.getApplicationInfo().getUrisList()) { - System.out.printf("Website: %s\n", websiteUri); - } - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_get_job] - - 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("tenant_id").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("job_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String jobId = cl.getOptionValue("job_id", "Job ID"); - - sampleGetJob(projectId, tenantId, jobId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchGetTenant.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchGetTenant.java deleted file mode 100644 index 86830cf9031..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchGetTenant.java +++ /dev/null @@ -1,72 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.GetTenantRequest; -import com.google.cloud.talent.v4beta1.Tenant; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantServiceClient; -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 JobSearchGetTenant { - // [START job_search_get_tenant] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.GetTenantRequest; - * import com.google.cloud.talent.v4beta1.Tenant; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantServiceClient; - */ - - public static void sampleGetTenant() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID"; - sampleGetTenant(projectId, tenantId); - } - - /** Get Tenant by name */ - public static void sampleGetTenant(String projectId, String tenantId) { - try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { - TenantName name = TenantName.of(projectId, tenantId); - GetTenantRequest request = GetTenantRequest.newBuilder().setName(name.toString()).build(); - Tenant response = tenantServiceClient.getTenant(request); - System.out.printf("Name: %s\n", response.getName()); - System.out.printf("External ID: %s\n", response.getExternalId()); - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_get_tenant] - - 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("tenant_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID"); - - sampleGetTenant(projectId, tenantId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchHistogramSearch.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchHistogramSearch.java deleted file mode 100644 index 877cb4306df..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchHistogramSearch.java +++ /dev/null @@ -1,113 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.HistogramQuery; -import com.google.cloud.talent.v4beta1.Job; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.RequestMetadata; -import com.google.cloud.talent.v4beta1.SearchJobsRequest; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -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 JobSearchHistogramSearch { - // [START job_search_histogram_search] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.HistogramQuery; - * import com.google.cloud.talent.v4beta1.Job; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.RequestMetadata; - * import com.google.cloud.talent.v4beta1.SearchJobsRequest; - * import com.google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - * import java.util.Arrays; - * import java.util.List; - */ - - public static void sampleSearchJobs() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String query = "count(base_compensation, [bucket(12, 20)])"; - sampleSearchJobs(projectId, tenantId, query); - } - - /** - * Search Jobs with histogram queries - * - * @param query Histogram query More info on histogram facets, constants, and built-in functions: - * https://godoc.org/google.golang.org/genproto/googleapis/cloud/talent/v4beta1#SearchJobsRequest - */ - public static void sampleSearchJobs(String projectId, String tenantId, String query) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - String domain = "www.example.com"; - String sessionId = "Hashed session identifier"; - String userId = "Hashed user identifier"; - RequestMetadata requestMetadata = - RequestMetadata.newBuilder() - .setDomain(domain) - .setSessionId(sessionId) - .setUserId(userId) - .build(); - HistogramQuery histogramQueriesElement = - HistogramQuery.newBuilder().setHistogramQuery(query).build(); - List histogramQueries = Arrays.asList(histogramQueriesElement); - SearchJobsRequest request = - SearchJobsRequest.newBuilder() - .setParent(parent.toString()) - .setRequestMetadata(requestMetadata) - .addAllHistogramQueries(histogramQueries) - .build(); - for (SearchJobsResponse.MatchingJob responseItem : - jobServiceClient.searchJobs(request).iterateAll()) { - System.out.printf("Job summary: %s\n", responseItem.getJobSummary()); - System.out.printf("Job title snippet: %s\n", responseItem.getJobTitleSnippet()); - Job job = responseItem.getJob(); - System.out.printf("Job name: %s\n", job.getName()); - System.out.printf("Job title: %s\n", job.getTitle()); - } - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_histogram_search] - - 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("tenant_id").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("query").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String query = cl.getOptionValue("query", "count(base_compensation, [bucket(12, 20)])"); - - sampleSearchJobs(projectId, tenantId, query); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchListCompanies.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchListCompanies.java deleted file mode 100644 index 3c5f9df1dbb..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchListCompanies.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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.Company; -import com.google.cloud.talent.v4beta1.CompanyServiceClient; -import com.google.cloud.talent.v4beta1.ListCompaniesRequest; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -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 JobSearchListCompanies { - // [START job_search_list_companies] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.Company; - * import com.google.cloud.talent.v4beta1.CompanyServiceClient; - * import com.google.cloud.talent.v4beta1.ListCompaniesRequest; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - */ - - public static void sampleListCompanies() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - sampleListCompanies(projectId, tenantId); - } - - /** - * List Companies - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenant - */ - public static void sampleListCompanies(String projectId, String tenantId) { - try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - ListCompaniesRequest request = - ListCompaniesRequest.newBuilder().setParent(parent.toString()).build(); - for (Company responseItem : companyServiceClient.listCompanies(request).iterateAll()) { - System.out.printf("Company Name: %s\n", responseItem.getName()); - System.out.printf("Display Name: %s\n", responseItem.getDisplayName()); - System.out.printf("External ID: %s\n", responseItem.getExternalId()); - } - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_list_companies] - - 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("tenant_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - - sampleListCompanies(projectId, tenantId); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchListJobs.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchListJobs.java deleted file mode 100644 index 04cd4e335cc..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchListJobs.java +++ /dev/null @@ -1,87 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.Job; -import com.google.cloud.talent.v4beta1.JobServiceClient; -import com.google.cloud.talent.v4beta1.ListJobsRequest; -import com.google.cloud.talent.v4beta1.TenantName; -import com.google.cloud.talent.v4beta1.TenantOrProjectName; -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 JobSearchListJobs { - // [START job_search_list_jobs] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.Job; - * import com.google.cloud.talent.v4beta1.JobServiceClient; - * import com.google.cloud.talent.v4beta1.ListJobsRequest; - * import com.google.cloud.talent.v4beta1.TenantName; - * import com.google.cloud.talent.v4beta1.TenantOrProjectName; - */ - - public static void sampleListJobs() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - String tenantId = "Your Tenant ID (using tenancy is optional)"; - String filter = "companyName=projects/my-project/companies/company-id"; - sampleListJobs(projectId, tenantId, filter); - } - - /** - * List Jobs - * - * @param projectId Your Google Cloud Project ID - * @param tenantId Identifier of the Tenant - */ - public static void sampleListJobs(String projectId, String tenantId, String filter) { - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantOrProjectName parent = TenantName.of(projectId, tenantId); - ListJobsRequest request = - ListJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build(); - for (Job responseItem : jobServiceClient.listJobs(request).iterateAll()) { - System.out.printf("Job name: %s\n", responseItem.getName()); - System.out.printf("Job requisition ID: %s\n", responseItem.getRequisitionId()); - System.out.printf("Job title: %s\n", responseItem.getTitle()); - System.out.printf("Job description: %s\n", responseItem.getDescription()); - } - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_list_jobs] - - 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("tenant_id").build()); - options.addOption(Option.builder("").required(false).hasArg(true).longOpt("filter").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - String tenantId = cl.getOptionValue("tenant_id", "Your Tenant ID (using tenancy is optional)"); - String filter = - cl.getOptionValue("filter", "companyName=projects/my-project/companies/company-id"); - - sampleListJobs(projectId, tenantId, filter); - } -} diff --git a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchListTenants.java b/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchListTenants.java deleted file mode 100644 index 681552d6463..00000000000 --- a/talent/generated/src/main/java/com/google/cloud/examples/talent/v4beta1/JobSearchListTenants.java +++ /dev/null @@ -1,71 +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. - */ - -package com.google.cloud.examples.talent.v4beta1; - -import com.google.cloud.talent.v4beta1.ListTenantsRequest; -import com.google.cloud.talent.v4beta1.ProjectName; -import com.google.cloud.talent.v4beta1.Tenant; -import com.google.cloud.talent.v4beta1.TenantServiceClient; -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 JobSearchListTenants { - // [START job_search_list_tenants] - /* - * Please include the following imports to run this sample. - * - * import com.google.cloud.talent.v4beta1.ListTenantsRequest; - * import com.google.cloud.talent.v4beta1.ProjectName; - * import com.google.cloud.talent.v4beta1.Tenant; - * import com.google.cloud.talent.v4beta1.TenantServiceClient; - */ - - public static void sampleListTenants() { - // TODO(developer): Replace these variables before running the sample. - String projectId = "Your Google Cloud Project ID"; - sampleListTenants(projectId); - } - - /** List Tenants */ - public static void sampleListTenants(String projectId) { - try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { - ProjectName parent = ProjectName.of(projectId); - ListTenantsRequest request = - ListTenantsRequest.newBuilder().setParent(parent.toString()).build(); - for (Tenant responseItem : tenantServiceClient.listTenants(request).iterateAll()) { - System.out.printf("Tenant Name: %s\n", responseItem.getName()); - System.out.printf("External ID: %s\n", responseItem.getExternalId()); - } - } catch (Exception exception) { - System.err.println("Failed to create the client due to: " + exception); - } - } - // [END job_search_list_tenants] - - public static void main(String[] args) throws Exception { - Options options = new Options(); - options.addOption( - Option.builder("").required(false).hasArg(true).longOpt("project_id").build()); - - CommandLine cl = (new DefaultParser()).parse(options, args); - String projectId = cl.getOptionValue("project_id", "Your Google Cloud Project ID"); - - sampleListTenants(projectId); - } -}