diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..a4fd1c81a54 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.CompanyServiceSettings; +import com.google.cloud.talent.v4.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceSettings companyServiceSettings = + CompanyServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CompanyServiceClient companyServiceClient = CompanyServiceClient.create(companyServiceSettings); + } +} +// [END talent_v4_generated_companyserviceclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..bf7d633d2de --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.CompanyServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceSettings companyServiceSettings = + CompanyServiceSettings.newBuilder() + .setTransportChannelProvider( + CompanyServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + CompanyServiceClient companyServiceClient = CompanyServiceClient.create(companyServiceSettings); + } +} +// [END talent_v4_generated_companyserviceclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..92667206583 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_create_setendpoint_sync] +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.CompanyServiceSettings; +import com.google.cloud.talent.v4.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceSettings companyServiceSettings = + CompanyServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + CompanyServiceClient companyServiceClient = CompanyServiceClient.create(companyServiceSettings); + } +} +// [END talent_v4_generated_companyserviceclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/AsyncCreateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/AsyncCreateCompany.java new file mode 100644 index 00000000000..5449a967379 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/AsyncCreateCompany.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_createcompany_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.CreateCompanyRequest; +import com.google.cloud.talent.v4.TenantName; + +public class AsyncCreateCompany { + + public static void main(String[] args) throws Exception { + asyncCreateCompany(); + } + + public static void asyncCreateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CreateCompanyRequest request = + CreateCompanyRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setCompany(Company.newBuilder().build()) + .build(); + ApiFuture future = companyServiceClient.createCompanyCallable().futureCall(request); + // Do something. + Company response = future.get(); + } + } +} +// [END talent_v4_generated_companyserviceclient_createcompany_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/SyncCreateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/SyncCreateCompany.java new file mode 100644 index 00000000000..7b82118bf23 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/SyncCreateCompany.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_createcompany_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.CreateCompanyRequest; +import com.google.cloud.talent.v4.TenantName; + +public class SyncCreateCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompany(); + } + + public static void syncCreateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CreateCompanyRequest request = + CreateCompanyRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setCompany(Company.newBuilder().build()) + .build(); + Company response = companyServiceClient.createCompany(request); + } + } +} +// [END talent_v4_generated_companyserviceclient_createcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/SyncCreateCompanyStringCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/SyncCreateCompanyStringCompany.java new file mode 100644 index 00000000000..81772999256 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/SyncCreateCompanyStringCompany.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_createcompany_stringcompany_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncCreateCompanyStringCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompanyStringCompany(); + } + + public static void syncCreateCompanyStringCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + Company company = Company.newBuilder().build(); + Company response = companyServiceClient.createCompany(parent, company); + } + } +} +// [END talent_v4_generated_companyserviceclient_createcompany_stringcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/SyncCreateCompanyTenantnameCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/SyncCreateCompanyTenantnameCompany.java new file mode 100644 index 00000000000..5e936a4c7e3 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/createcompany/SyncCreateCompanyTenantnameCompany.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_createcompany_tenantnamecompany_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncCreateCompanyTenantnameCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompanyTenantnameCompany(); + } + + public static void syncCreateCompanyTenantnameCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + Company company = Company.newBuilder().build(); + Company response = companyServiceClient.createCompany(parent, company); + } + } +} +// [END talent_v4_generated_companyserviceclient_createcompany_tenantnamecompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/AsyncDeleteCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/AsyncDeleteCompany.java new file mode 100644 index 00000000000..ff8ebed3e94 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/AsyncDeleteCompany.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_deletecompany_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.DeleteCompanyRequest; +import com.google.protobuf.Empty; + +public class AsyncDeleteCompany { + + public static void main(String[] args) throws Exception { + asyncDeleteCompany(); + } + + public static void asyncDeleteCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + DeleteCompanyRequest request = + DeleteCompanyRequest.newBuilder() + .setName(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString()) + .build(); + ApiFuture future = companyServiceClient.deleteCompanyCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END talent_v4_generated_companyserviceclient_deletecompany_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/SyncDeleteCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/SyncDeleteCompany.java new file mode 100644 index 00000000000..8f4a0b643b3 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/SyncDeleteCompany.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_deletecompany_sync] +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.DeleteCompanyRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteCompany { + + public static void main(String[] args) throws Exception { + syncDeleteCompany(); + } + + public static void syncDeleteCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + DeleteCompanyRequest request = + DeleteCompanyRequest.newBuilder() + .setName(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString()) + .build(); + companyServiceClient.deleteCompany(request); + } + } +} +// [END talent_v4_generated_companyserviceclient_deletecompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/SyncDeleteCompanyCompanyname.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/SyncDeleteCompanyCompanyname.java new file mode 100644 index 00000000000..60e85f04158 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/SyncDeleteCompanyCompanyname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_deletecompany_companyname_sync] +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCompanyCompanyname { + + public static void main(String[] args) throws Exception { + syncDeleteCompanyCompanyname(); + } + + public static void syncDeleteCompanyCompanyname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CompanyName name = CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]"); + companyServiceClient.deleteCompany(name); + } + } +} +// [END talent_v4_generated_companyserviceclient_deletecompany_companyname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/SyncDeleteCompanyString.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/SyncDeleteCompanyString.java new file mode 100644 index 00000000000..8050197e220 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/deletecompany/SyncDeleteCompanyString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_deletecompany_string_sync] +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCompanyString { + + public static void main(String[] args) throws Exception { + syncDeleteCompanyString(); + } + + public static void syncDeleteCompanyString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + String name = CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString(); + companyServiceClient.deleteCompany(name); + } + } +} +// [END talent_v4_generated_companyserviceclient_deletecompany_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/AsyncGetCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/AsyncGetCompany.java new file mode 100644 index 00000000000..c54fda6e46b --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/AsyncGetCompany.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_getcompany_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.GetCompanyRequest; + +public class AsyncGetCompany { + + public static void main(String[] args) throws Exception { + asyncGetCompany(); + } + + public static void asyncGetCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + GetCompanyRequest request = + GetCompanyRequest.newBuilder() + .setName(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString()) + .build(); + ApiFuture future = companyServiceClient.getCompanyCallable().futureCall(request); + // Do something. + Company response = future.get(); + } + } +} +// [END talent_v4_generated_companyserviceclient_getcompany_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/SyncGetCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/SyncGetCompany.java new file mode 100644 index 00000000000..86a4ba56d6c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/SyncGetCompany.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_getcompany_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.GetCompanyRequest; + +public class SyncGetCompany { + + public static void main(String[] args) throws Exception { + syncGetCompany(); + } + + public static void syncGetCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + GetCompanyRequest request = + GetCompanyRequest.newBuilder() + .setName(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString()) + .build(); + Company response = companyServiceClient.getCompany(request); + } + } +} +// [END talent_v4_generated_companyserviceclient_getcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/SyncGetCompanyCompanyname.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/SyncGetCompanyCompanyname.java new file mode 100644 index 00000000000..662b80d8472 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/SyncGetCompanyCompanyname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_getcompany_companyname_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; + +public class SyncGetCompanyCompanyname { + + public static void main(String[] args) throws Exception { + syncGetCompanyCompanyname(); + } + + public static void syncGetCompanyCompanyname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CompanyName name = CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]"); + Company response = companyServiceClient.getCompany(name); + } + } +} +// [END talent_v4_generated_companyserviceclient_getcompany_companyname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/SyncGetCompanyString.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/SyncGetCompanyString.java new file mode 100644 index 00000000000..11875c699da --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/getcompany/SyncGetCompanyString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_getcompany_string_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; + +public class SyncGetCompanyString { + + public static void main(String[] args) throws Exception { + syncGetCompanyString(); + } + + public static void syncGetCompanyString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + String name = CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString(); + Company response = companyServiceClient.getCompany(name); + } + } +} +// [END talent_v4_generated_companyserviceclient_getcompany_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/AsyncListCompanies.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/AsyncListCompanies.java new file mode 100644 index 00000000000..10f1e9a9ef9 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/AsyncListCompanies.java @@ -0,0 +1,55 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_listcompanies_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.ListCompaniesRequest; +import com.google.cloud.talent.v4.TenantName; + +public class AsyncListCompanies { + + public static void main(String[] args) throws Exception { + asyncListCompanies(); + } + + public static void asyncListCompanies() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + ListCompaniesRequest request = + ListCompaniesRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setRequireOpenJobs(true) + .build(); + ApiFuture future = + companyServiceClient.listCompaniesPagedCallable().futureCall(request); + // Do something. + for (Company element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_companyserviceclient_listcompanies_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/AsyncListCompaniesPaged.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/AsyncListCompaniesPaged.java new file mode 100644 index 00000000000..4176981aaef --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/AsyncListCompaniesPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_listcompanies_paged_async] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.ListCompaniesRequest; +import com.google.cloud.talent.v4.ListCompaniesResponse; +import com.google.cloud.talent.v4.TenantName; +import com.google.common.base.Strings; + +public class AsyncListCompaniesPaged { + + public static void main(String[] args) throws Exception { + asyncListCompaniesPaged(); + } + + public static void asyncListCompaniesPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + ListCompaniesRequest request = + ListCompaniesRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setRequireOpenJobs(true) + .build(); + while (true) { + ListCompaniesResponse response = companyServiceClient.listCompaniesCallable().call(request); + for (Company element : response.getCompaniesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END talent_v4_generated_companyserviceclient_listcompanies_paged_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/SyncListCompanies.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/SyncListCompanies.java new file mode 100644 index 00000000000..f6b2aa3f73e --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/SyncListCompanies.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_listcompanies_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.ListCompaniesRequest; +import com.google.cloud.talent.v4.TenantName; + +public class SyncListCompanies { + + public static void main(String[] args) throws Exception { + syncListCompanies(); + } + + public static void syncListCompanies() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + ListCompaniesRequest request = + ListCompaniesRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setRequireOpenJobs(true) + .build(); + for (Company element : companyServiceClient.listCompanies(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_companyserviceclient_listcompanies_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/SyncListCompaniesString.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/SyncListCompaniesString.java new file mode 100644 index 00000000000..70665a7a2b9 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/SyncListCompaniesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_listcompanies_string_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncListCompaniesString { + + public static void main(String[] args) throws Exception { + syncListCompaniesString(); + } + + public static void syncListCompaniesString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + for (Company element : companyServiceClient.listCompanies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_companyserviceclient_listcompanies_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/SyncListCompaniesTenantname.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/SyncListCompaniesTenantname.java new file mode 100644 index 00000000000..4f446d1c506 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/listcompanies/SyncListCompaniesTenantname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_listcompanies_tenantname_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncListCompaniesTenantname { + + public static void main(String[] args) throws Exception { + syncListCompaniesTenantname(); + } + + public static void syncListCompaniesTenantname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + for (Company element : companyServiceClient.listCompanies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_companyserviceclient_listcompanies_tenantname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/updatecompany/AsyncUpdateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/updatecompany/AsyncUpdateCompany.java new file mode 100644 index 00000000000..767af8c977d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/updatecompany/AsyncUpdateCompany.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_updatecompany_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.UpdateCompanyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCompany { + + public static void main(String[] args) throws Exception { + asyncUpdateCompany(); + } + + public static void asyncUpdateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + UpdateCompanyRequest request = + UpdateCompanyRequest.newBuilder() + .setCompany(Company.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = companyServiceClient.updateCompanyCallable().futureCall(request); + // Do something. + Company response = future.get(); + } + } +} +// [END talent_v4_generated_companyserviceclient_updatecompany_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/updatecompany/SyncUpdateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/updatecompany/SyncUpdateCompany.java new file mode 100644 index 00000000000..c5f842b7a1d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/updatecompany/SyncUpdateCompany.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_updatecompany_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.UpdateCompanyRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCompany { + + public static void main(String[] args) throws Exception { + syncUpdateCompany(); + } + + public static void syncUpdateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + UpdateCompanyRequest request = + UpdateCompanyRequest.newBuilder() + .setCompany(Company.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Company response = companyServiceClient.updateCompany(request); + } + } +} +// [END talent_v4_generated_companyserviceclient_updatecompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/updatecompany/SyncUpdateCompanyCompanyFieldmask.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/updatecompany/SyncUpdateCompanyCompanyFieldmask.java new file mode 100644 index 00000000000..78233cf38c2 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyserviceclient/updatecompany/SyncUpdateCompanyCompanyFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyserviceclient_updatecompany_companyfieldmask_sync] +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCompanyCompanyFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCompanyCompanyFieldmask(); + } + + public static void syncUpdateCompanyCompanyFieldmask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + Company company = Company.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Company response = companyServiceClient.updateCompany(company, updateMask); + } + } +} +// [END talent_v4_generated_companyserviceclient_updatecompany_companyfieldmask_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/companyservicesettings/createcompany/SyncCreateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/companyservicesettings/createcompany/SyncCreateCompany.java new file mode 100644 index 00000000000..1d2f174d470 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/companyservicesettings/createcompany/SyncCreateCompany.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_companyservicesettings_createcompany_sync] +import com.google.cloud.talent.v4.CompanyServiceSettings; +import java.time.Duration; + +public class SyncCreateCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompany(); + } + + public static void syncCreateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceSettings.Builder companyServiceSettingsBuilder = + CompanyServiceSettings.newBuilder(); + companyServiceSettingsBuilder + .createCompanySettings() + .setRetrySettings( + companyServiceSettingsBuilder.createCompanySettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CompanyServiceSettings companyServiceSettings = companyServiceSettingsBuilder.build(); + } +} +// [END talent_v4_generated_companyservicesettings_createcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/completequery/AsyncCompleteQuery.java b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/completequery/AsyncCompleteQuery.java new file mode 100644 index 00000000000..41053a5c904 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/completequery/AsyncCompleteQuery.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_completionclient_completequery_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompleteQueryRequest; +import com.google.cloud.talent.v4.CompleteQueryResponse; +import com.google.cloud.talent.v4.CompletionClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class AsyncCompleteQuery { + + public static void main(String[] args) throws Exception { + asyncCompleteQuery(); + } + + public static void asyncCompleteQuery() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompletionClient completionClient = CompletionClient.create()) { + CompleteQueryRequest request = + CompleteQueryRequest.newBuilder() + .setTenant(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setQuery("query107944136") + .addAllLanguageCodes(new ArrayList()) + .setPageSize(883849137) + .setCompany(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString()) + .build(); + ApiFuture future = + completionClient.completeQueryCallable().futureCall(request); + // Do something. + CompleteQueryResponse response = future.get(); + } + } +} +// [END talent_v4_generated_completionclient_completequery_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/completequery/SyncCompleteQuery.java b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/completequery/SyncCompleteQuery.java new file mode 100644 index 00000000000..28c66a6a97b --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/completequery/SyncCompleteQuery.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_completionclient_completequery_sync] +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompleteQueryRequest; +import com.google.cloud.talent.v4.CompleteQueryResponse; +import com.google.cloud.talent.v4.CompletionClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class SyncCompleteQuery { + + public static void main(String[] args) throws Exception { + syncCompleteQuery(); + } + + public static void syncCompleteQuery() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompletionClient completionClient = CompletionClient.create()) { + CompleteQueryRequest request = + CompleteQueryRequest.newBuilder() + .setTenant(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setQuery("query107944136") + .addAllLanguageCodes(new ArrayList()) + .setPageSize(883849137) + .setCompany(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString()) + .build(); + CompleteQueryResponse response = completionClient.completeQuery(request); + } + } +} +// [END talent_v4_generated_completionclient_completequery_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..0448e45a05c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_completionclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4.CompletionClient; +import com.google.cloud.talent.v4.CompletionSettings; +import com.google.cloud.talent.v4.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionSettings completionSettings = + CompletionSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CompletionClient completionClient = CompletionClient.create(completionSettings); + } +} +// [END talent_v4_generated_completionclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..de630cbd0d7 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_completionclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4.CompletionClient; +import com.google.cloud.talent.v4.CompletionSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionSettings completionSettings = + CompletionSettings.newBuilder() + .setTransportChannelProvider( + CompletionSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + CompletionClient completionClient = CompletionClient.create(completionSettings); + } +} +// [END talent_v4_generated_completionclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..660b234d9f6 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/completionclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_completionclient_create_setendpoint_sync] +import com.google.cloud.talent.v4.CompletionClient; +import com.google.cloud.talent.v4.CompletionSettings; +import com.google.cloud.talent.v4.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionSettings completionSettings = + CompletionSettings.newBuilder().setEndpoint(myEndpoint).build(); + CompletionClient completionClient = CompletionClient.create(completionSettings); + } +} +// [END talent_v4_generated_completionclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/completionsettings/completequery/SyncCompleteQuery.java b/talent/snippets/generated/com/google/cloud/talent/v4/completionsettings/completequery/SyncCompleteQuery.java new file mode 100644 index 00000000000..56011c35cbd --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/completionsettings/completequery/SyncCompleteQuery.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_completionsettings_completequery_sync] +import com.google.cloud.talent.v4.CompletionSettings; +import java.time.Duration; + +public class SyncCompleteQuery { + + public static void main(String[] args) throws Exception { + syncCompleteQuery(); + } + + public static void syncCompleteQuery() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionSettings.Builder completionSettingsBuilder = CompletionSettings.newBuilder(); + completionSettingsBuilder + .completeQuerySettings() + .setRetrySettings( + completionSettingsBuilder.completeQuerySettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CompletionSettings completionSettings = completionSettingsBuilder.build(); + } +} +// [END talent_v4_generated_completionsettings_completequery_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..ef0e191da21 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_eventserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4.EventServiceClient; +import com.google.cloud.talent.v4.EventServiceSettings; +import com.google.cloud.talent.v4.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceSettings eventServiceSettings = + EventServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + EventServiceClient eventServiceClient = EventServiceClient.create(eventServiceSettings); + } +} +// [END talent_v4_generated_eventserviceclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..3b28d803599 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_eventserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4.EventServiceClient; +import com.google.cloud.talent.v4.EventServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceSettings eventServiceSettings = + EventServiceSettings.newBuilder() + .setTransportChannelProvider( + EventServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + EventServiceClient eventServiceClient = EventServiceClient.create(eventServiceSettings); + } +} +// [END talent_v4_generated_eventserviceclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..c03cef53760 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_eventserviceclient_create_setendpoint_sync] +import com.google.cloud.talent.v4.EventServiceClient; +import com.google.cloud.talent.v4.EventServiceSettings; +import com.google.cloud.talent.v4.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceSettings eventServiceSettings = + EventServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + EventServiceClient eventServiceClient = EventServiceClient.create(eventServiceSettings); + } +} +// [END talent_v4_generated_eventserviceclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/AsyncCreateClientEvent.java b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/AsyncCreateClientEvent.java new file mode 100644 index 00000000000..9ba0df639e4 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/AsyncCreateClientEvent.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_eventserviceclient_createclientevent_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.ClientEvent; +import com.google.cloud.talent.v4.CreateClientEventRequest; +import com.google.cloud.talent.v4.EventServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class AsyncCreateClientEvent { + + public static void main(String[] args) throws Exception { + asyncCreateClientEvent(); + } + + public static void asyncCreateClientEvent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + CreateClientEventRequest request = + CreateClientEventRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setClientEvent(ClientEvent.newBuilder().build()) + .build(); + ApiFuture future = + eventServiceClient.createClientEventCallable().futureCall(request); + // Do something. + ClientEvent response = future.get(); + } + } +} +// [END talent_v4_generated_eventserviceclient_createclientevent_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/SyncCreateClientEvent.java b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/SyncCreateClientEvent.java new file mode 100644 index 00000000000..a15505eac2c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/SyncCreateClientEvent.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_eventserviceclient_createclientevent_sync] +import com.google.cloud.talent.v4.ClientEvent; +import com.google.cloud.talent.v4.CreateClientEventRequest; +import com.google.cloud.talent.v4.EventServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncCreateClientEvent { + + public static void main(String[] args) throws Exception { + syncCreateClientEvent(); + } + + public static void syncCreateClientEvent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + CreateClientEventRequest request = + CreateClientEventRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setClientEvent(ClientEvent.newBuilder().build()) + .build(); + ClientEvent response = eventServiceClient.createClientEvent(request); + } + } +} +// [END talent_v4_generated_eventserviceclient_createclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/SyncCreateClientEventStringClientevent.java b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/SyncCreateClientEventStringClientevent.java new file mode 100644 index 00000000000..cba1496c921 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/SyncCreateClientEventStringClientevent.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_eventserviceclient_createclientevent_stringclientevent_sync] +import com.google.cloud.talent.v4.ClientEvent; +import com.google.cloud.talent.v4.EventServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncCreateClientEventStringClientevent { + + public static void main(String[] args) throws Exception { + syncCreateClientEventStringClientevent(); + } + + public static void syncCreateClientEventStringClientevent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + ClientEvent clientEvent = ClientEvent.newBuilder().build(); + ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent); + } + } +} +// [END talent_v4_generated_eventserviceclient_createclientevent_stringclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/SyncCreateClientEventTenantnameClientevent.java b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/SyncCreateClientEventTenantnameClientevent.java new file mode 100644 index 00000000000..e59374fd37f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/eventserviceclient/createclientevent/SyncCreateClientEventTenantnameClientevent.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_eventserviceclient_createclientevent_tenantnameclientevent_sync] +import com.google.cloud.talent.v4.ClientEvent; +import com.google.cloud.talent.v4.EventServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncCreateClientEventTenantnameClientevent { + + public static void main(String[] args) throws Exception { + syncCreateClientEventTenantnameClientevent(); + } + + public static void syncCreateClientEventTenantnameClientevent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + ClientEvent clientEvent = ClientEvent.newBuilder().build(); + ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent); + } + } +} +// [END talent_v4_generated_eventserviceclient_createclientevent_tenantnameclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/eventservicesettings/createclientevent/SyncCreateClientEvent.java b/talent/snippets/generated/com/google/cloud/talent/v4/eventservicesettings/createclientevent/SyncCreateClientEvent.java new file mode 100644 index 00000000000..a2d349ee1d1 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/eventservicesettings/createclientevent/SyncCreateClientEvent.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_eventservicesettings_createclientevent_sync] +import com.google.cloud.talent.v4.EventServiceSettings; +import java.time.Duration; + +public class SyncCreateClientEvent { + + public static void main(String[] args) throws Exception { + syncCreateClientEvent(); + } + + public static void syncCreateClientEvent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceSettings.Builder eventServiceSettingsBuilder = EventServiceSettings.newBuilder(); + eventServiceSettingsBuilder + .createClientEventSettings() + .setRetrySettings( + eventServiceSettingsBuilder.createClientEventSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + EventServiceSettings eventServiceSettings = eventServiceSettingsBuilder.build(); + } +} +// [END talent_v4_generated_eventservicesettings_createclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobs.java new file mode 100644 index 00000000000..3d306f68fec --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobs.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchcreatejobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.BatchCreateJobsRequest; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncBatchCreateJobs { + + public static void main(String[] args) throws Exception { + asyncBatchCreateJobs(); + } + + public static void asyncBatchCreateJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchCreateJobsRequest request = + BatchCreateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .build(); + ApiFuture future = jobServiceClient.batchCreateJobsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchcreatejobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobsLRO.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobsLRO.java new file mode 100644 index 00000000000..a3fe3578a7f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchcreatejobs_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.talent.v4.BatchCreateJobsRequest; +import com.google.cloud.talent.v4.BatchCreateJobsResponse; +import com.google.cloud.talent.v4.BatchOperationMetadata; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class AsyncBatchCreateJobsLRO { + + public static void main(String[] args) throws Exception { + asyncBatchCreateJobsLRO(); + } + + public static void asyncBatchCreateJobsLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchCreateJobsRequest request = + BatchCreateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .build(); + OperationFuture future = + jobServiceClient.batchCreateJobsOperationCallable().futureCall(request); + // Do something. + BatchCreateJobsResponse response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchcreatejobs_lro_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/SyncBatchCreateJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/SyncBatchCreateJobs.java new file mode 100644 index 00000000000..3a014e34339 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/SyncBatchCreateJobs.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchcreatejobs_sync] +import com.google.cloud.talent.v4.BatchCreateJobsRequest; +import com.google.cloud.talent.v4.BatchCreateJobsResponse; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class SyncBatchCreateJobs { + + public static void main(String[] args) throws Exception { + syncBatchCreateJobs(); + } + + public static void syncBatchCreateJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchCreateJobsRequest request = + BatchCreateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .build(); + BatchCreateJobsResponse response = jobServiceClient.batchCreateJobsAsync(request).get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchcreatejobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsStringListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsStringListjob.java new file mode 100644 index 00000000000..523308de2f8 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsStringListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchcreatejobs_stringlistjob_sync] +import com.google.cloud.talent.v4.BatchCreateJobsResponse; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateJobsStringListjob { + + public static void main(String[] args) throws Exception { + syncBatchCreateJobsStringListjob(); + } + + public static void syncBatchCreateJobsStringListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + List jobs = new ArrayList<>(); + BatchCreateJobsResponse response = jobServiceClient.batchCreateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchcreatejobs_stringlistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsTenantnameListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsTenantnameListjob.java new file mode 100644 index 00000000000..b51b6fe2aaf --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsTenantnameListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchcreatejobs_tenantnamelistjob_sync] +import com.google.cloud.talent.v4.BatchCreateJobsResponse; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateJobsTenantnameListjob { + + public static void main(String[] args) throws Exception { + syncBatchCreateJobsTenantnameListjob(); + } + + public static void syncBatchCreateJobsTenantnameListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + List jobs = new ArrayList<>(); + BatchCreateJobsResponse response = jobServiceClient.batchCreateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchcreatejobs_tenantnamelistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/AsyncBatchDeleteJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/AsyncBatchDeleteJobs.java new file mode 100644 index 00000000000..74c9af7357a --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/AsyncBatchDeleteJobs.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchdeletejobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.BatchDeleteJobsRequest; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncBatchDeleteJobs { + + public static void main(String[] args) throws Exception { + asyncBatchDeleteJobs(); + } + + public static void asyncBatchDeleteJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchDeleteJobsRequest request = + BatchDeleteJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllNames(new ArrayList()) + .build(); + ApiFuture future = jobServiceClient.batchDeleteJobsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchdeletejobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/AsyncBatchDeleteJobsLRO.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/AsyncBatchDeleteJobsLRO.java new file mode 100644 index 00000000000..e7ff0afc70d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/AsyncBatchDeleteJobsLRO.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchdeletejobs_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.talent.v4.BatchDeleteJobsRequest; +import com.google.cloud.talent.v4.BatchDeleteJobsResponse; +import com.google.cloud.talent.v4.BatchOperationMetadata; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class AsyncBatchDeleteJobsLRO { + + public static void main(String[] args) throws Exception { + asyncBatchDeleteJobsLRO(); + } + + public static void asyncBatchDeleteJobsLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchDeleteJobsRequest request = + BatchDeleteJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllNames(new ArrayList()) + .build(); + OperationFuture future = + jobServiceClient.batchDeleteJobsOperationCallable().futureCall(request); + // Do something. + BatchDeleteJobsResponse response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchdeletejobs_lro_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobs.java new file mode 100644 index 00000000000..fdb762cef2d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobs.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchdeletejobs_sync] +import com.google.cloud.talent.v4.BatchDeleteJobsRequest; +import com.google.cloud.talent.v4.BatchDeleteJobsResponse; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class SyncBatchDeleteJobs { + + public static void main(String[] args) throws Exception { + syncBatchDeleteJobs(); + } + + public static void syncBatchDeleteJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchDeleteJobsRequest request = + BatchDeleteJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllNames(new ArrayList()) + .build(); + BatchDeleteJobsResponse response = jobServiceClient.batchDeleteJobsAsync(request).get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchdeletejobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsStringListstring.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsStringListstring.java new file mode 100644 index 00000000000..df1fb763fda --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsStringListstring.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchdeletejobs_stringliststring_sync] +import com.google.cloud.talent.v4.BatchDeleteJobsResponse; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchDeleteJobsStringListstring { + + public static void main(String[] args) throws Exception { + syncBatchDeleteJobsStringListstring(); + } + + public static void syncBatchDeleteJobsStringListstring() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + List names = new ArrayList<>(); + BatchDeleteJobsResponse response = jobServiceClient.batchDeleteJobsAsync(parent, names).get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchdeletejobs_stringliststring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsTenantnameListstring.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsTenantnameListstring.java new file mode 100644 index 00000000000..b861bc06955 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsTenantnameListstring.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchdeletejobs_tenantnameliststring_sync] +import com.google.cloud.talent.v4.BatchDeleteJobsResponse; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchDeleteJobsTenantnameListstring { + + public static void main(String[] args) throws Exception { + syncBatchDeleteJobsTenantnameListstring(); + } + + public static void syncBatchDeleteJobsTenantnameListstring() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + List names = new ArrayList<>(); + BatchDeleteJobsResponse response = jobServiceClient.batchDeleteJobsAsync(parent, names).get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchdeletejobs_tenantnameliststring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobs.java new file mode 100644 index 00000000000..af777abd401 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchupdatejobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.BatchUpdateJobsRequest; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncBatchUpdateJobs { + + public static void main(String[] args) throws Exception { + asyncBatchUpdateJobs(); + } + + public static void asyncBatchUpdateJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchUpdateJobsRequest request = + BatchUpdateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.batchUpdateJobsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchupdatejobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobsLRO.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobsLRO.java new file mode 100644 index 00000000000..987802a3ba6 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobsLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchupdatejobs_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.talent.v4.BatchOperationMetadata; +import com.google.cloud.talent.v4.BatchUpdateJobsRequest; +import com.google.cloud.talent.v4.BatchUpdateJobsResponse; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncBatchUpdateJobsLRO { + + public static void main(String[] args) throws Exception { + asyncBatchUpdateJobsLRO(); + } + + public static void asyncBatchUpdateJobsLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchUpdateJobsRequest request = + BatchUpdateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + jobServiceClient.batchUpdateJobsOperationCallable().futureCall(request); + // Do something. + BatchUpdateJobsResponse response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchupdatejobs_lro_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobs.java new file mode 100644 index 00000000000..0826c321a80 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobs.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchupdatejobs_sync] +import com.google.cloud.talent.v4.BatchUpdateJobsRequest; +import com.google.cloud.talent.v4.BatchUpdateJobsResponse; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncBatchUpdateJobs { + + public static void main(String[] args) throws Exception { + syncBatchUpdateJobs(); + } + + public static void syncBatchUpdateJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchUpdateJobsRequest request = + BatchUpdateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + BatchUpdateJobsResponse response = jobServiceClient.batchUpdateJobsAsync(request).get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchupdatejobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsStringListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsStringListjob.java new file mode 100644 index 00000000000..90a8abd365f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsStringListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchupdatejobs_stringlistjob_sync] +import com.google.cloud.talent.v4.BatchUpdateJobsResponse; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchUpdateJobsStringListjob { + + public static void main(String[] args) throws Exception { + syncBatchUpdateJobsStringListjob(); + } + + public static void syncBatchUpdateJobsStringListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + List jobs = new ArrayList<>(); + BatchUpdateJobsResponse response = jobServiceClient.batchUpdateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchupdatejobs_stringlistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsTenantnameListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsTenantnameListjob.java new file mode 100644 index 00000000000..9367b3562bc --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsTenantnameListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_batchupdatejobs_tenantnamelistjob_sync] +import com.google.cloud.talent.v4.BatchUpdateJobsResponse; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchUpdateJobsTenantnameListjob { + + public static void main(String[] args) throws Exception { + syncBatchUpdateJobsTenantnameListjob(); + } + + public static void syncBatchUpdateJobsTenantnameListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + List jobs = new ArrayList<>(); + BatchUpdateJobsResponse response = jobServiceClient.batchUpdateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_batchupdatejobs_tenantnamelistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..f83252b5542 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobServiceSettings; +import com.google.cloud.talent.v4.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END talent_v4_generated_jobserviceclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..2574c11fa0f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder() + .setTransportChannelProvider( + JobServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END talent_v4_generated_jobserviceclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..28c9f35eb86 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_create_setendpoint_sync] +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobServiceSettings; +import com.google.cloud.talent.v4.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END talent_v4_generated_jobserviceclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/AsyncCreateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/AsyncCreateJob.java new file mode 100644 index 00000000000..94eeb92f6bc --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/AsyncCreateJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_createjob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.CreateJobRequest; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class AsyncCreateJob { + + public static void main(String[] args) throws Exception { + asyncCreateJob(); + } + + public static void asyncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateJobRequest request = + CreateJobRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setJob(Job.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.createJobCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_createjob_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/SyncCreateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/SyncCreateJob.java new file mode 100644 index 00000000000..a5fa2e47ed8 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/SyncCreateJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_createjob_sync] +import com.google.cloud.talent.v4.CreateJobRequest; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncCreateJob { + + public static void main(String[] args) throws Exception { + syncCreateJob(); + } + + public static void syncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateJobRequest request = + CreateJobRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setJob(Job.newBuilder().build()) + .build(); + Job response = jobServiceClient.createJob(request); + } + } +} +// [END talent_v4_generated_jobserviceclient_createjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/SyncCreateJobStringJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/SyncCreateJobStringJob.java new file mode 100644 index 00000000000..0b5bafc6294 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/SyncCreateJobStringJob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_createjob_stringjob_sync] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncCreateJobStringJob { + + public static void main(String[] args) throws Exception { + syncCreateJobStringJob(); + } + + public static void syncCreateJobStringJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + Job job = Job.newBuilder().build(); + Job response = jobServiceClient.createJob(parent, job); + } + } +} +// [END talent_v4_generated_jobserviceclient_createjob_stringjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/SyncCreateJobTenantnameJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/SyncCreateJobTenantnameJob.java new file mode 100644 index 00000000000..105621fa02e --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/createjob/SyncCreateJobTenantnameJob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_createjob_tenantnamejob_sync] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncCreateJobTenantnameJob { + + public static void main(String[] args) throws Exception { + syncCreateJobTenantnameJob(); + } + + public static void syncCreateJobTenantnameJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + Job job = Job.newBuilder().build(); + Job response = jobServiceClient.createJob(parent, job); + } + } +} +// [END talent_v4_generated_jobserviceclient_createjob_tenantnamejob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/AsyncDeleteJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/AsyncDeleteJob.java new file mode 100644 index 00000000000..42af9da7a98 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/AsyncDeleteJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_deletejob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.DeleteJobRequest; +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteJob { + + public static void main(String[] args) throws Exception { + asyncDeleteJob(); + } + + public static void asyncDeleteJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteJobRequest request = + DeleteJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.deleteJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_deletejob_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/SyncDeleteJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/SyncDeleteJob.java new file mode 100644 index 00000000000..123ced49df1 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/SyncDeleteJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_deletejob_sync] +import com.google.cloud.talent.v4.DeleteJobRequest; +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteJob { + + public static void main(String[] args) throws Exception { + syncDeleteJob(); + } + + public static void syncDeleteJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteJobRequest request = + DeleteJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString()) + .build(); + jobServiceClient.deleteJob(request); + } + } +} +// [END talent_v4_generated_jobserviceclient_deletejob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/SyncDeleteJobJobname.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/SyncDeleteJobJobname.java new file mode 100644 index 00000000000..7ff66e62e78 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/SyncDeleteJobJobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_deletejob_jobname_sync] +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteJobJobname { + + public static void main(String[] args) throws Exception { + syncDeleteJobJobname(); + } + + public static void syncDeleteJobJobname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + JobName name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]"); + jobServiceClient.deleteJob(name); + } + } +} +// [END talent_v4_generated_jobserviceclient_deletejob_jobname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/SyncDeleteJobString.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/SyncDeleteJobString.java new file mode 100644 index 00000000000..98c5d8f267d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/deletejob/SyncDeleteJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_deletejob_string_sync] +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteJobString { + + public static void main(String[] args) throws Exception { + syncDeleteJobString(); + } + + public static void syncDeleteJobString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString(); + jobServiceClient.deleteJob(name); + } + } +} +// [END talent_v4_generated_jobserviceclient_deletejob_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/AsyncGetJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/AsyncGetJob.java new file mode 100644 index 00000000000..912316d7104 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/AsyncGetJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_getjob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.GetJobRequest; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; + +public class AsyncGetJob { + + public static void main(String[] args) throws Exception { + asyncGetJob(); + } + + public static void asyncGetJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetJobRequest request = + GetJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.getJobCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_getjob_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/SyncGetJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/SyncGetJob.java new file mode 100644 index 00000000000..fd6dfc2743d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/SyncGetJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_getjob_sync] +import com.google.cloud.talent.v4.GetJobRequest; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; + +public class SyncGetJob { + + public static void main(String[] args) throws Exception { + syncGetJob(); + } + + public static void syncGetJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetJobRequest request = + GetJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString()) + .build(); + Job response = jobServiceClient.getJob(request); + } + } +} +// [END talent_v4_generated_jobserviceclient_getjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/SyncGetJobJobname.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/SyncGetJobJobname.java new file mode 100644 index 00000000000..83d6c98b762 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/SyncGetJobJobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_getjob_jobname_sync] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; + +public class SyncGetJobJobname { + + public static void main(String[] args) throws Exception { + syncGetJobJobname(); + } + + public static void syncGetJobJobname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + JobName name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]"); + Job response = jobServiceClient.getJob(name); + } + } +} +// [END talent_v4_generated_jobserviceclient_getjob_jobname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/SyncGetJobString.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/SyncGetJobString.java new file mode 100644 index 00000000000..b60cd81aa0b --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/getjob/SyncGetJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_getjob_string_sync] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; + +public class SyncGetJobString { + + public static void main(String[] args) throws Exception { + syncGetJobString(); + } + + public static void syncGetJobString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString(); + Job response = jobServiceClient.getJob(name); + } + } +} +// [END talent_v4_generated_jobserviceclient_getjob_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/AsyncListJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/AsyncListJobs.java new file mode 100644 index 00000000000..c6cb30f5978 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/AsyncListJobs.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_listjobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobView; +import com.google.cloud.talent.v4.ListJobsRequest; +import com.google.cloud.talent.v4.TenantName; + +public class AsyncListJobs { + + public static void main(String[] args) throws Exception { + asyncListJobs(); + } + + public static void asyncListJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListJobsRequest request = + ListJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setJobView(JobView.forNumber(0)) + .build(); + ApiFuture future = jobServiceClient.listJobsPagedCallable().futureCall(request); + // Do something. + for (Job element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_jobserviceclient_listjobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/AsyncListJobsPaged.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/AsyncListJobsPaged.java new file mode 100644 index 00000000000..75a05b609a1 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/AsyncListJobsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_listjobs_paged_async] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobView; +import com.google.cloud.talent.v4.ListJobsRequest; +import com.google.cloud.talent.v4.ListJobsResponse; +import com.google.cloud.talent.v4.TenantName; +import com.google.common.base.Strings; + +public class AsyncListJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListJobsPaged(); + } + + public static void asyncListJobsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListJobsRequest request = + ListJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setJobView(JobView.forNumber(0)) + .build(); + while (true) { + ListJobsResponse response = jobServiceClient.listJobsCallable().call(request); + for (Job element : response.getJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END talent_v4_generated_jobserviceclient_listjobs_paged_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/SyncListJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/SyncListJobs.java new file mode 100644 index 00000000000..af5c07f53be --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/SyncListJobs.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_listjobs_sync] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobView; +import com.google.cloud.talent.v4.ListJobsRequest; +import com.google.cloud.talent.v4.TenantName; + +public class SyncListJobs { + + public static void main(String[] args) throws Exception { + syncListJobs(); + } + + public static void syncListJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListJobsRequest request = + ListJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setJobView(JobView.forNumber(0)) + .build(); + for (Job element : jobServiceClient.listJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_jobserviceclient_listjobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/SyncListJobsStringString.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/SyncListJobsStringString.java new file mode 100644 index 00000000000..36654031417 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/SyncListJobsStringString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_listjobs_stringstring_sync] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncListJobsStringString { + + public static void main(String[] args) throws Exception { + syncListJobsStringString(); + } + + public static void syncListJobsStringString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + String filter = "filter-1274492040"; + for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_jobserviceclient_listjobs_stringstring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/SyncListJobsTenantnameString.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/SyncListJobsTenantnameString.java new file mode 100644 index 00000000000..dc18014563f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/listjobs/SyncListJobsTenantnameString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_listjobs_tenantnamestring_sync] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; + +public class SyncListJobsTenantnameString { + + public static void main(String[] args) throws Exception { + syncListJobsTenantnameString(); + } + + public static void syncListJobsTenantnameString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + String filter = "filter-1274492040"; + for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_jobserviceclient_listjobs_tenantnamestring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobs/AsyncSearchJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobs/AsyncSearchJobs.java new file mode 100644 index 00000000000..a3460a89275 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobs/AsyncSearchJobs.java @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_searchjobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.HistogramQuery; +import com.google.cloud.talent.v4.JobQuery; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobView; +import com.google.cloud.talent.v4.RequestMetadata; +import com.google.cloud.talent.v4.SearchJobsRequest; +import com.google.cloud.talent.v4.SearchJobsResponse; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class AsyncSearchJobs { + + public static void main(String[] args) throws Exception { + asyncSearchJobs(); + } + + public static void asyncSearchJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setMaxPageSize(524069526) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + ApiFuture future = + jobServiceClient.searchJobsCallable().futureCall(request); + // Do something. + SearchJobsResponse response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_searchjobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobs/SyncSearchJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobs/SyncSearchJobs.java new file mode 100644 index 00000000000..ae60f8988b2 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobs/SyncSearchJobs.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_searchjobs_sync] +import com.google.cloud.talent.v4.HistogramQuery; +import com.google.cloud.talent.v4.JobQuery; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobView; +import com.google.cloud.talent.v4.RequestMetadata; +import com.google.cloud.talent.v4.SearchJobsRequest; +import com.google.cloud.talent.v4.SearchJobsResponse; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class SyncSearchJobs { + + public static void main(String[] args) throws Exception { + syncSearchJobs(); + } + + public static void syncSearchJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setMaxPageSize(524069526) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + SearchJobsResponse response = jobServiceClient.searchJobs(request); + } + } +} +// [END talent_v4_generated_jobserviceclient_searchjobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobsforalert/AsyncSearchJobsForAlert.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobsforalert/AsyncSearchJobsForAlert.java new file mode 100644 index 00000000000..7604de795ae --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobsforalert/AsyncSearchJobsForAlert.java @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_searchjobsforalert_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.HistogramQuery; +import com.google.cloud.talent.v4.JobQuery; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobView; +import com.google.cloud.talent.v4.RequestMetadata; +import com.google.cloud.talent.v4.SearchJobsRequest; +import com.google.cloud.talent.v4.SearchJobsResponse; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class AsyncSearchJobsForAlert { + + public static void main(String[] args) throws Exception { + asyncSearchJobsForAlert(); + } + + public static void asyncSearchJobsForAlert() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setMaxPageSize(524069526) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + ApiFuture future = + jobServiceClient.searchJobsForAlertCallable().futureCall(request); + // Do something. + SearchJobsResponse response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_searchjobsforalert_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobsforalert/SyncSearchJobsForAlert.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobsforalert/SyncSearchJobsForAlert.java new file mode 100644 index 00000000000..1e2a2bb9516 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/searchjobsforalert/SyncSearchJobsForAlert.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_searchjobsforalert_sync] +import com.google.cloud.talent.v4.HistogramQuery; +import com.google.cloud.talent.v4.JobQuery; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.JobView; +import com.google.cloud.talent.v4.RequestMetadata; +import com.google.cloud.talent.v4.SearchJobsRequest; +import com.google.cloud.talent.v4.SearchJobsResponse; +import com.google.cloud.talent.v4.TenantName; +import java.util.ArrayList; + +public class SyncSearchJobsForAlert { + + public static void main(String[] args) throws Exception { + syncSearchJobsForAlert(); + } + + public static void syncSearchJobsForAlert() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setMaxPageSize(524069526) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + SearchJobsResponse response = jobServiceClient.searchJobsForAlert(request); + } + } +} +// [END talent_v4_generated_jobserviceclient_searchjobsforalert_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/updatejob/AsyncUpdateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/updatejob/AsyncUpdateJob.java new file mode 100644 index 00000000000..09fdb8e8790 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/updatejob/AsyncUpdateJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_updatejob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.UpdateJobRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateJob { + + public static void main(String[] args) throws Exception { + asyncUpdateJob(); + } + + public static void asyncUpdateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateJobRequest request = + UpdateJobRequest.newBuilder() + .setJob(Job.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.updateJobCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END talent_v4_generated_jobserviceclient_updatejob_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/updatejob/SyncUpdateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/updatejob/SyncUpdateJob.java new file mode 100644 index 00000000000..9ab4f130090 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/updatejob/SyncUpdateJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_updatejob_sync] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.UpdateJobRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateJob { + + public static void main(String[] args) throws Exception { + syncUpdateJob(); + } + + public static void syncUpdateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateJobRequest request = + UpdateJobRequest.newBuilder() + .setJob(Job.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Job response = jobServiceClient.updateJob(request); + } + } +} +// [END talent_v4_generated_jobserviceclient_updatejob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/updatejob/SyncUpdateJobJobFieldmask.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/updatejob/SyncUpdateJobJobFieldmask.java new file mode 100644 index 00000000000..5cbcccba1a9 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobserviceclient/updatejob/SyncUpdateJobJobFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobserviceclient_updatejob_jobfieldmask_sync] +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateJobJobFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateJobJobFieldmask(); + } + + public static void syncUpdateJobJobFieldmask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + Job job = Job.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Job response = jobServiceClient.updateJob(job, updateMask); + } + } +} +// [END talent_v4_generated_jobserviceclient_updatejob_jobfieldmask_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/jobservicesettings/createjob/SyncCreateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/jobservicesettings/createjob/SyncCreateJob.java new file mode 100644 index 00000000000..88603b8af47 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/jobservicesettings/createjob/SyncCreateJob.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_jobservicesettings_createjob_sync] +import com.google.cloud.talent.v4.JobServiceSettings; +import java.time.Duration; + +public class SyncCreateJob { + + public static void main(String[] args) throws Exception { + syncCreateJob(); + } + + public static void syncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceSettings.Builder jobServiceSettingsBuilder = JobServiceSettings.newBuilder(); + jobServiceSettingsBuilder + .createJobSettings() + .setRetrySettings( + jobServiceSettingsBuilder.createJobSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobServiceSettings jobServiceSettings = jobServiceSettingsBuilder.build(); + } +} +// [END talent_v4_generated_jobservicesettings_createjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/stub/companyservicestubsettings/createcompany/SyncCreateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4/stub/companyservicestubsettings/createcompany/SyncCreateCompany.java new file mode 100644 index 00000000000..a04887e82fe --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/stub/companyservicestubsettings/createcompany/SyncCreateCompany.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.stub.samples; + +// [START talent_v4_generated_companyservicestubsettings_createcompany_sync] +import com.google.cloud.talent.v4.stub.CompanyServiceStubSettings; +import java.time.Duration; + +public class SyncCreateCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompany(); + } + + public static void syncCreateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceStubSettings.Builder companyServiceSettingsBuilder = + CompanyServiceStubSettings.newBuilder(); + companyServiceSettingsBuilder + .createCompanySettings() + .setRetrySettings( + companyServiceSettingsBuilder.createCompanySettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CompanyServiceStubSettings companyServiceSettings = companyServiceSettingsBuilder.build(); + } +} +// [END talent_v4_generated_companyservicestubsettings_createcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/stub/completionstubsettings/completequery/SyncCompleteQuery.java b/talent/snippets/generated/com/google/cloud/talent/v4/stub/completionstubsettings/completequery/SyncCompleteQuery.java new file mode 100644 index 00000000000..87b70543860 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/stub/completionstubsettings/completequery/SyncCompleteQuery.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.stub.samples; + +// [START talent_v4_generated_completionstubsettings_completequery_sync] +import com.google.cloud.talent.v4.stub.CompletionStubSettings; +import java.time.Duration; + +public class SyncCompleteQuery { + + public static void main(String[] args) throws Exception { + syncCompleteQuery(); + } + + public static void syncCompleteQuery() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionStubSettings.Builder completionSettingsBuilder = CompletionStubSettings.newBuilder(); + completionSettingsBuilder + .completeQuerySettings() + .setRetrySettings( + completionSettingsBuilder.completeQuerySettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CompletionStubSettings completionSettings = completionSettingsBuilder.build(); + } +} +// [END talent_v4_generated_completionstubsettings_completequery_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/stub/eventservicestubsettings/createclientevent/SyncCreateClientEvent.java b/talent/snippets/generated/com/google/cloud/talent/v4/stub/eventservicestubsettings/createclientevent/SyncCreateClientEvent.java new file mode 100644 index 00000000000..ee10d6b5a9d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/stub/eventservicestubsettings/createclientevent/SyncCreateClientEvent.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.stub.samples; + +// [START talent_v4_generated_eventservicestubsettings_createclientevent_sync] +import com.google.cloud.talent.v4.stub.EventServiceStubSettings; +import java.time.Duration; + +public class SyncCreateClientEvent { + + public static void main(String[] args) throws Exception { + syncCreateClientEvent(); + } + + public static void syncCreateClientEvent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceStubSettings.Builder eventServiceSettingsBuilder = + EventServiceStubSettings.newBuilder(); + eventServiceSettingsBuilder + .createClientEventSettings() + .setRetrySettings( + eventServiceSettingsBuilder.createClientEventSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + EventServiceStubSettings eventServiceSettings = eventServiceSettingsBuilder.build(); + } +} +// [END talent_v4_generated_eventservicestubsettings_createclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/stub/jobservicestubsettings/createjob/SyncCreateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4/stub/jobservicestubsettings/createjob/SyncCreateJob.java new file mode 100644 index 00000000000..28ca32e7d2a --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/stub/jobservicestubsettings/createjob/SyncCreateJob.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.stub.samples; + +// [START talent_v4_generated_jobservicestubsettings_createjob_sync] +import com.google.cloud.talent.v4.stub.JobServiceStubSettings; +import java.time.Duration; + +public class SyncCreateJob { + + public static void main(String[] args) throws Exception { + syncCreateJob(); + } + + public static void syncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceStubSettings.Builder jobServiceSettingsBuilder = JobServiceStubSettings.newBuilder(); + jobServiceSettingsBuilder + .createJobSettings() + .setRetrySettings( + jobServiceSettingsBuilder.createJobSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobServiceStubSettings jobServiceSettings = jobServiceSettingsBuilder.build(); + } +} +// [END talent_v4_generated_jobservicestubsettings_createjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/stub/tenantservicestubsettings/createtenant/SyncCreateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/stub/tenantservicestubsettings/createtenant/SyncCreateTenant.java new file mode 100644 index 00000000000..eef4efaaece --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/stub/tenantservicestubsettings/createtenant/SyncCreateTenant.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.stub.samples; + +// [START talent_v4_generated_tenantservicestubsettings_createtenant_sync] +import com.google.cloud.talent.v4.stub.TenantServiceStubSettings; +import java.time.Duration; + +public class SyncCreateTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenant(); + } + + public static void syncCreateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceStubSettings.Builder tenantServiceSettingsBuilder = + TenantServiceStubSettings.newBuilder(); + tenantServiceSettingsBuilder + .createTenantSettings() + .setRetrySettings( + tenantServiceSettingsBuilder.createTenantSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TenantServiceStubSettings tenantServiceSettings = tenantServiceSettingsBuilder.build(); + } +} +// [END talent_v4_generated_tenantservicestubsettings_createtenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..60046d597b8 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.cloud.talent.v4.TenantServiceSettings; +import com.google.cloud.talent.v4.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceSettings tenantServiceSettings = + TenantServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + TenantServiceClient tenantServiceClient = TenantServiceClient.create(tenantServiceSettings); + } +} +// [END talent_v4_generated_tenantserviceclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..ce55ec8ec5a --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.cloud.talent.v4.TenantServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceSettings tenantServiceSettings = + TenantServiceSettings.newBuilder() + .setTransportChannelProvider( + TenantServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + TenantServiceClient tenantServiceClient = TenantServiceClient.create(tenantServiceSettings); + } +} +// [END talent_v4_generated_tenantserviceclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..b87e0357b07 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_create_setendpoint_sync] +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.cloud.talent.v4.TenantServiceSettings; +import com.google.cloud.talent.v4.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceSettings tenantServiceSettings = + TenantServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + TenantServiceClient tenantServiceClient = TenantServiceClient.create(tenantServiceSettings); + } +} +// [END talent_v4_generated_tenantserviceclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/AsyncCreateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/AsyncCreateTenant.java new file mode 100644 index 00000000000..c1e5aa1ce12 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/AsyncCreateTenant.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_createtenant_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.CreateTenantRequest; +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class AsyncCreateTenant { + + public static void main(String[] args) throws Exception { + asyncCreateTenant(); + } + + public static void asyncCreateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + CreateTenantRequest request = + CreateTenantRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setTenant(Tenant.newBuilder().build()) + .build(); + ApiFuture future = tenantServiceClient.createTenantCallable().futureCall(request); + // Do something. + Tenant response = future.get(); + } + } +} +// [END talent_v4_generated_tenantserviceclient_createtenant_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/SyncCreateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/SyncCreateTenant.java new file mode 100644 index 00000000000..725b0a3b237 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/SyncCreateTenant.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_createtenant_sync] +import com.google.cloud.talent.v4.CreateTenantRequest; +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class SyncCreateTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenant(); + } + + public static void syncCreateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + CreateTenantRequest request = + CreateTenantRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setTenant(Tenant.newBuilder().build()) + .build(); + Tenant response = tenantServiceClient.createTenant(request); + } + } +} +// [END talent_v4_generated_tenantserviceclient_createtenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/SyncCreateTenantProjectnameTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/SyncCreateTenantProjectnameTenant.java new file mode 100644 index 00000000000..7096e950f9a --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/SyncCreateTenantProjectnameTenant.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_createtenant_projectnametenant_sync] +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class SyncCreateTenantProjectnameTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenantProjectnameTenant(); + } + + public static void syncCreateTenantProjectnameTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + Tenant tenant = Tenant.newBuilder().build(); + Tenant response = tenantServiceClient.createTenant(parent, tenant); + } + } +} +// [END talent_v4_generated_tenantserviceclient_createtenant_projectnametenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/SyncCreateTenantStringTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/SyncCreateTenantStringTenant.java new file mode 100644 index 00000000000..bf7f1832728 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/createtenant/SyncCreateTenantStringTenant.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_createtenant_stringtenant_sync] +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class SyncCreateTenantStringTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenantStringTenant(); + } + + public static void syncCreateTenantStringTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + Tenant tenant = Tenant.newBuilder().build(); + Tenant response = tenantServiceClient.createTenant(parent, tenant); + } + } +} +// [END talent_v4_generated_tenantserviceclient_createtenant_stringtenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/AsyncDeleteTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/AsyncDeleteTenant.java new file mode 100644 index 00000000000..27b195fa3c4 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/AsyncDeleteTenant.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_deletetenant_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.DeleteTenantRequest; +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTenant { + + public static void main(String[] args) throws Exception { + asyncDeleteTenant(); + } + + public static void asyncDeleteTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + DeleteTenantRequest request = + DeleteTenantRequest.newBuilder() + .setName(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .build(); + ApiFuture future = tenantServiceClient.deleteTenantCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END talent_v4_generated_tenantserviceclient_deletetenant_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/SyncDeleteTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/SyncDeleteTenant.java new file mode 100644 index 00000000000..374189daa55 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/SyncDeleteTenant.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_deletetenant_sync] +import com.google.cloud.talent.v4.DeleteTenantRequest; +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTenant { + + public static void main(String[] args) throws Exception { + syncDeleteTenant(); + } + + public static void syncDeleteTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + DeleteTenantRequest request = + DeleteTenantRequest.newBuilder() + .setName(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .build(); + tenantServiceClient.deleteTenant(request); + } + } +} +// [END talent_v4_generated_tenantserviceclient_deletetenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/SyncDeleteTenantString.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/SyncDeleteTenantString.java new file mode 100644 index 00000000000..87917c8c9f7 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/SyncDeleteTenantString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_deletetenant_string_sync] +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTenantString { + + public static void main(String[] args) throws Exception { + syncDeleteTenantString(); + } + + public static void syncDeleteTenantString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + String name = TenantName.of("[PROJECT]", "[TENANT]").toString(); + tenantServiceClient.deleteTenant(name); + } + } +} +// [END talent_v4_generated_tenantserviceclient_deletetenant_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/SyncDeleteTenantTenantname.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/SyncDeleteTenantTenantname.java new file mode 100644 index 00000000000..41d073e9f73 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/deletetenant/SyncDeleteTenantTenantname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_deletetenant_tenantname_sync] +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTenantTenantname { + + public static void main(String[] args) throws Exception { + syncDeleteTenantTenantname(); + } + + public static void syncDeleteTenantTenantname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + TenantName name = TenantName.of("[PROJECT]", "[TENANT]"); + tenantServiceClient.deleteTenant(name); + } + } +} +// [END talent_v4_generated_tenantserviceclient_deletetenant_tenantname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/AsyncGetTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/AsyncGetTenant.java new file mode 100644 index 00000000000..7b419ed46f8 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/AsyncGetTenant.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_gettenant_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.GetTenantRequest; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class AsyncGetTenant { + + public static void main(String[] args) throws Exception { + asyncGetTenant(); + } + + public static void asyncGetTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + GetTenantRequest request = + GetTenantRequest.newBuilder() + .setName(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .build(); + ApiFuture future = tenantServiceClient.getTenantCallable().futureCall(request); + // Do something. + Tenant response = future.get(); + } + } +} +// [END talent_v4_generated_tenantserviceclient_gettenant_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/SyncGetTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/SyncGetTenant.java new file mode 100644 index 00000000000..bd9e9bb0da9 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/SyncGetTenant.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_gettenant_sync] +import com.google.cloud.talent.v4.GetTenantRequest; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class SyncGetTenant { + + public static void main(String[] args) throws Exception { + syncGetTenant(); + } + + public static void syncGetTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + GetTenantRequest request = + GetTenantRequest.newBuilder() + .setName(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .build(); + Tenant response = tenantServiceClient.getTenant(request); + } + } +} +// [END talent_v4_generated_tenantserviceclient_gettenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/SyncGetTenantString.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/SyncGetTenantString.java new file mode 100644 index 00000000000..147a5f16766 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/SyncGetTenantString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_gettenant_string_sync] +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class SyncGetTenantString { + + public static void main(String[] args) throws Exception { + syncGetTenantString(); + } + + public static void syncGetTenantString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + String name = TenantName.of("[PROJECT]", "[TENANT]").toString(); + Tenant response = tenantServiceClient.getTenant(name); + } + } +} +// [END talent_v4_generated_tenantserviceclient_gettenant_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/SyncGetTenantTenantname.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/SyncGetTenantTenantname.java new file mode 100644 index 00000000000..96d486c3e9c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/gettenant/SyncGetTenantTenantname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_gettenant_tenantname_sync] +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class SyncGetTenantTenantname { + + public static void main(String[] args) throws Exception { + syncGetTenantTenantname(); + } + + public static void syncGetTenantTenantname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + TenantName name = TenantName.of("[PROJECT]", "[TENANT]"); + Tenant response = tenantServiceClient.getTenant(name); + } + } +} +// [END talent_v4_generated_tenantserviceclient_gettenant_tenantname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/AsyncListTenants.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/AsyncListTenants.java new file mode 100644 index 00000000000..ba57e6cc6d8 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/AsyncListTenants.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_listtenants_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.ListTenantsRequest; +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class AsyncListTenants { + + public static void main(String[] args) throws Exception { + asyncListTenants(); + } + + public static void asyncListTenants() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ListTenantsRequest request = + ListTenantsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + ApiFuture future = tenantServiceClient.listTenantsPagedCallable().futureCall(request); + // Do something. + for (Tenant element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_tenantserviceclient_listtenants_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/AsyncListTenantsPaged.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/AsyncListTenantsPaged.java new file mode 100644 index 00000000000..92f4cf68aa7 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/AsyncListTenantsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_listtenants_paged_async] +import com.google.cloud.talent.v4.ListTenantsRequest; +import com.google.cloud.talent.v4.ListTenantsResponse; +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.common.base.Strings; + +public class AsyncListTenantsPaged { + + public static void main(String[] args) throws Exception { + asyncListTenantsPaged(); + } + + public static void asyncListTenantsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ListTenantsRequest request = + ListTenantsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + while (true) { + ListTenantsResponse response = tenantServiceClient.listTenantsCallable().call(request); + for (Tenant element : response.getTenantsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END talent_v4_generated_tenantserviceclient_listtenants_paged_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/SyncListTenants.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/SyncListTenants.java new file mode 100644 index 00000000000..a1d342da4f8 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/SyncListTenants.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_listtenants_sync] +import com.google.cloud.talent.v4.ListTenantsRequest; +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class SyncListTenants { + + public static void main(String[] args) throws Exception { + syncListTenants(); + } + + public static void syncListTenants() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ListTenantsRequest request = + ListTenantsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + for (Tenant element : tenantServiceClient.listTenants(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_tenantserviceclient_listtenants_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/SyncListTenantsProjectname.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/SyncListTenantsProjectname.java new file mode 100644 index 00000000000..d616965f2d7 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/SyncListTenantsProjectname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_listtenants_projectname_sync] +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class SyncListTenantsProjectname { + + public static void main(String[] args) throws Exception { + syncListTenantsProjectname(); + } + + public static void syncListTenantsProjectname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (Tenant element : tenantServiceClient.listTenants(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_tenantserviceclient_listtenants_projectname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/SyncListTenantsString.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/SyncListTenantsString.java new file mode 100644 index 00000000000..f15646f8f84 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/listtenants/SyncListTenantsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_listtenants_string_sync] +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; + +public class SyncListTenantsString { + + public static void main(String[] args) throws Exception { + syncListTenantsString(); + } + + public static void syncListTenantsString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + for (Tenant element : tenantServiceClient.listTenants(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4_generated_tenantserviceclient_listtenants_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/updatetenant/AsyncUpdateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/updatetenant/AsyncUpdateTenant.java new file mode 100644 index 00000000000..400cdc11df5 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/updatetenant/AsyncUpdateTenant.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_updatetenant_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.cloud.talent.v4.UpdateTenantRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTenant { + + public static void main(String[] args) throws Exception { + asyncUpdateTenant(); + } + + public static void asyncUpdateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + UpdateTenantRequest request = + UpdateTenantRequest.newBuilder() + .setTenant(Tenant.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = tenantServiceClient.updateTenantCallable().futureCall(request); + // Do something. + Tenant response = future.get(); + } + } +} +// [END talent_v4_generated_tenantserviceclient_updatetenant_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/updatetenant/SyncUpdateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/updatetenant/SyncUpdateTenant.java new file mode 100644 index 00000000000..ce239605c08 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/updatetenant/SyncUpdateTenant.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_updatetenant_sync] +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.cloud.talent.v4.UpdateTenantRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTenant { + + public static void main(String[] args) throws Exception { + syncUpdateTenant(); + } + + public static void syncUpdateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + UpdateTenantRequest request = + UpdateTenantRequest.newBuilder() + .setTenant(Tenant.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Tenant response = tenantServiceClient.updateTenant(request); + } + } +} +// [END talent_v4_generated_tenantserviceclient_updatetenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/updatetenant/SyncUpdateTenantTenantFieldmask.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/updatetenant/SyncUpdateTenantTenantFieldmask.java new file mode 100644 index 00000000000..a067ddfdb25 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantserviceclient/updatetenant/SyncUpdateTenantTenantFieldmask.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantserviceclient_updatetenant_tenantfieldmask_sync] +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTenantTenantFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTenantTenantFieldmask(); + } + + public static void syncUpdateTenantTenantFieldmask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + Tenant tenant = Tenant.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Tenant response = tenantServiceClient.updateTenant(tenant, updateMask); + } + } +} +// [END talent_v4_generated_tenantserviceclient_updatetenant_tenantfieldmask_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4/tenantservicesettings/createtenant/SyncCreateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4/tenantservicesettings/createtenant/SyncCreateTenant.java new file mode 100644 index 00000000000..d4c550c14f0 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4/tenantservicesettings/createtenant/SyncCreateTenant.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4.samples; + +// [START talent_v4_generated_tenantservicesettings_createtenant_sync] +import com.google.cloud.talent.v4.TenantServiceSettings; +import java.time.Duration; + +public class SyncCreateTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenant(); + } + + public static void syncCreateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceSettings.Builder tenantServiceSettingsBuilder = TenantServiceSettings.newBuilder(); + tenantServiceSettingsBuilder + .createTenantSettings() + .setRetrySettings( + tenantServiceSettingsBuilder.createTenantSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TenantServiceSettings tenantServiceSettings = tenantServiceSettingsBuilder.build(); + } +} +// [END talent_v4_generated_tenantservicesettings_createtenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..ac32dbd64a7 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.CompanyServiceSettings; +import com.google.cloud.talent.v4beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceSettings companyServiceSettings = + CompanyServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CompanyServiceClient companyServiceClient = CompanyServiceClient.create(companyServiceSettings); + } +} +// [END talent_v4beta1_generated_companyserviceclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..b01ff85bcee --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.CompanyServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceSettings companyServiceSettings = + CompanyServiceSettings.newBuilder() + .setTransportChannelProvider( + CompanyServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + CompanyServiceClient companyServiceClient = CompanyServiceClient.create(companyServiceSettings); + } +} +// [END talent_v4beta1_generated_companyserviceclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..21f1b0339f7 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_create_setendpoint_sync] +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.CompanyServiceSettings; +import com.google.cloud.talent.v4beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceSettings companyServiceSettings = + CompanyServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + CompanyServiceClient companyServiceClient = CompanyServiceClient.create(companyServiceSettings); + } +} +// [END talent_v4beta1_generated_companyserviceclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/AsyncCreateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/AsyncCreateCompany.java new file mode 100644 index 00000000000..eb622905c0f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/AsyncCreateCompany.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_createcompany_async] +import com.google.api.core.ApiFuture; +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; + +public class AsyncCreateCompany { + + public static void main(String[] args) throws Exception { + asyncCreateCompany(); + } + + public static void asyncCreateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CreateCompanyRequest request = + CreateCompanyRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setCompany(Company.newBuilder().build()) + .build(); + ApiFuture future = companyServiceClient.createCompanyCallable().futureCall(request); + // Do something. + Company response = future.get(); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_createcompany_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompany.java new file mode 100644 index 00000000000..aa57c987322 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompany.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_createcompany_sync] +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; + +public class SyncCreateCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompany(); + } + + public static void syncCreateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CreateCompanyRequest request = + CreateCompanyRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setCompany(Company.newBuilder().build()) + .build(); + Company response = companyServiceClient.createCompany(request); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_createcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompanyProjectnameCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompanyProjectnameCompany.java new file mode 100644 index 00000000000..75395a02be7 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompanyProjectnameCompany.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_createcompany_projectnamecompany_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.ProjectName; + +public class SyncCreateCompanyProjectnameCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompanyProjectnameCompany(); + } + + public static void syncCreateCompanyProjectnameCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + Company company = Company.newBuilder().build(); + Company response = companyServiceClient.createCompany(parent, company); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_createcompany_projectnamecompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompanyStringCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompanyStringCompany.java new file mode 100644 index 00000000000..a83c4b26f7c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompanyStringCompany.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_createcompany_stringcompany_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncCreateCompanyStringCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompanyStringCompany(); + } + + public static void syncCreateCompanyStringCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + Company company = Company.newBuilder().build(); + Company response = companyServiceClient.createCompany(parent, company); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_createcompany_stringcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompanyTenantnameCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompanyTenantnameCompany.java new file mode 100644 index 00000000000..9d5e65360e0 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/createcompany/SyncCreateCompanyTenantnameCompany.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_createcompany_tenantnamecompany_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncCreateCompanyTenantnameCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompanyTenantnameCompany(); + } + + public static void syncCreateCompanyTenantnameCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + Company company = Company.newBuilder().build(); + Company response = companyServiceClient.createCompany(parent, company); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_createcompany_tenantnamecompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/AsyncDeleteCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/AsyncDeleteCompany.java new file mode 100644 index 00000000000..af83d59b2fb --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/AsyncDeleteCompany.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_deletecompany_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.CompanyName; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.DeleteCompanyRequest; +import com.google.protobuf.Empty; + +public class AsyncDeleteCompany { + + public static void main(String[] args) throws Exception { + asyncDeleteCompany(); + } + + public static void asyncDeleteCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + DeleteCompanyRequest request = + DeleteCompanyRequest.newBuilder() + .setName( + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]") + .toString()) + .build(); + ApiFuture future = companyServiceClient.deleteCompanyCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_deletecompany_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/SyncDeleteCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/SyncDeleteCompany.java new file mode 100644 index 00000000000..a7c39ca8bfa --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/SyncDeleteCompany.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_deletecompany_sync] +import com.google.cloud.talent.v4beta1.CompanyName; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.DeleteCompanyRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteCompany { + + public static void main(String[] args) throws Exception { + syncDeleteCompany(); + } + + public static void syncDeleteCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + DeleteCompanyRequest request = + DeleteCompanyRequest.newBuilder() + .setName( + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]") + .toString()) + .build(); + companyServiceClient.deleteCompany(request); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_deletecompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/SyncDeleteCompanyCompanyname.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/SyncDeleteCompanyCompanyname.java new file mode 100644 index 00000000000..d0828d97870 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/SyncDeleteCompanyCompanyname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_deletecompany_companyname_sync] +import com.google.cloud.talent.v4beta1.CompanyName; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCompanyCompanyname { + + public static void main(String[] args) throws Exception { + syncDeleteCompanyCompanyname(); + } + + public static void syncDeleteCompanyCompanyname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CompanyName name = + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]"); + companyServiceClient.deleteCompany(name); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_deletecompany_companyname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/SyncDeleteCompanyString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/SyncDeleteCompanyString.java new file mode 100644 index 00000000000..14d78995219 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/deletecompany/SyncDeleteCompanyString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_deletecompany_string_sync] +import com.google.cloud.talent.v4beta1.CompanyName; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteCompanyString { + + public static void main(String[] args) throws Exception { + syncDeleteCompanyString(); + } + + public static void syncDeleteCompanyString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + String name = + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]").toString(); + companyServiceClient.deleteCompany(name); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_deletecompany_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/AsyncGetCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/AsyncGetCompany.java new file mode 100644 index 00000000000..10e19f50fc8 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/AsyncGetCompany.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_getcompany_async] +import com.google.api.core.ApiFuture; +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.GetCompanyRequest; + +public class AsyncGetCompany { + + public static void main(String[] args) throws Exception { + asyncGetCompany(); + } + + public static void asyncGetCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + GetCompanyRequest request = + GetCompanyRequest.newBuilder() + .setName( + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]") + .toString()) + .build(); + ApiFuture future = companyServiceClient.getCompanyCallable().futureCall(request); + // Do something. + Company response = future.get(); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_getcompany_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/SyncGetCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/SyncGetCompany.java new file mode 100644 index 00000000000..f2e4ff22375 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/SyncGetCompany.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_getcompany_sync] +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.GetCompanyRequest; + +public class SyncGetCompany { + + public static void main(String[] args) throws Exception { + syncGetCompany(); + } + + public static void syncGetCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + GetCompanyRequest request = + GetCompanyRequest.newBuilder() + .setName( + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]") + .toString()) + .build(); + Company response = companyServiceClient.getCompany(request); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_getcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/SyncGetCompanyCompanyname.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/SyncGetCompanyCompanyname.java new file mode 100644 index 00000000000..1a922f20ef3 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/SyncGetCompanyCompanyname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_getcompany_companyname_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyName; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; + +public class SyncGetCompanyCompanyname { + + public static void main(String[] args) throws Exception { + syncGetCompanyCompanyname(); + } + + public static void syncGetCompanyCompanyname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CompanyName name = + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]"); + Company response = companyServiceClient.getCompany(name); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_getcompany_companyname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/SyncGetCompanyString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/SyncGetCompanyString.java new file mode 100644 index 00000000000..a112d99c7e3 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/getcompany/SyncGetCompanyString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_getcompany_string_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyName; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; + +public class SyncGetCompanyString { + + public static void main(String[] args) throws Exception { + syncGetCompanyString(); + } + + public static void syncGetCompanyString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + String name = + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]").toString(); + Company response = companyServiceClient.getCompany(name); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_getcompany_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/AsyncListCompanies.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/AsyncListCompanies.java new file mode 100644 index 00000000000..2b22fee9613 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/AsyncListCompanies.java @@ -0,0 +1,55 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_listcompanies_async] +import com.google.api.core.ApiFuture; +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; + +public class AsyncListCompanies { + + public static void main(String[] args) throws Exception { + asyncListCompanies(); + } + + public static void asyncListCompanies() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + ListCompaniesRequest request = + ListCompaniesRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setRequireOpenJobs(true) + .build(); + ApiFuture future = + companyServiceClient.listCompaniesPagedCallable().futureCall(request); + // Do something. + for (Company element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_listcompanies_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/AsyncListCompaniesPaged.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/AsyncListCompaniesPaged.java new file mode 100644 index 00000000000..cc4791ba695 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/AsyncListCompaniesPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_listcompanies_paged_async] +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.ListCompaniesResponse; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.common.base.Strings; + +public class AsyncListCompaniesPaged { + + public static void main(String[] args) throws Exception { + asyncListCompaniesPaged(); + } + + public static void asyncListCompaniesPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + ListCompaniesRequest request = + ListCompaniesRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setRequireOpenJobs(true) + .build(); + while (true) { + ListCompaniesResponse response = companyServiceClient.listCompaniesCallable().call(request); + for (Company element : response.getCompaniesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_listcompanies_paged_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompanies.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompanies.java new file mode 100644 index 00000000000..76dd6d7d37b --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompanies.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_listcompanies_sync] +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; + +public class SyncListCompanies { + + public static void main(String[] args) throws Exception { + syncListCompanies(); + } + + public static void syncListCompanies() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + ListCompaniesRequest request = + ListCompaniesRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setRequireOpenJobs(true) + .build(); + for (Company element : companyServiceClient.listCompanies(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_listcompanies_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompaniesProjectname.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompaniesProjectname.java new file mode 100644 index 00000000000..3fb121cbfb9 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompaniesProjectname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_listcompanies_projectname_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.ProjectName; + +public class SyncListCompaniesProjectname { + + public static void main(String[] args) throws Exception { + syncListCompaniesProjectname(); + } + + public static void syncListCompaniesProjectname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (Company element : companyServiceClient.listCompanies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_listcompanies_projectname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompaniesString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompaniesString.java new file mode 100644 index 00000000000..eaba1f06b88 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompaniesString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_listcompanies_string_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncListCompaniesString { + + public static void main(String[] args) throws Exception { + syncListCompaniesString(); + } + + public static void syncListCompaniesString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + for (Company element : companyServiceClient.listCompanies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_listcompanies_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompaniesTenantname.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompaniesTenantname.java new file mode 100644 index 00000000000..ea558fab1f1 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/listcompanies/SyncListCompaniesTenantname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_listcompanies_tenantname_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncListCompaniesTenantname { + + public static void main(String[] args) throws Exception { + syncListCompaniesTenantname(); + } + + public static void syncListCompaniesTenantname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + for (Company element : companyServiceClient.listCompanies(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_listcompanies_tenantname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/updatecompany/AsyncUpdateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/updatecompany/AsyncUpdateCompany.java new file mode 100644 index 00000000000..803e0e2ba08 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/updatecompany/AsyncUpdateCompany.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_updatecompany_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.UpdateCompanyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCompany { + + public static void main(String[] args) throws Exception { + asyncUpdateCompany(); + } + + public static void asyncUpdateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + UpdateCompanyRequest request = + UpdateCompanyRequest.newBuilder() + .setCompany(Company.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = companyServiceClient.updateCompanyCallable().futureCall(request); + // Do something. + Company response = future.get(); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_updatecompany_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/updatecompany/SyncUpdateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/updatecompany/SyncUpdateCompany.java new file mode 100644 index 00000000000..5175dd48132 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/updatecompany/SyncUpdateCompany.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_updatecompany_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; +import com.google.cloud.talent.v4beta1.UpdateCompanyRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCompany { + + public static void main(String[] args) throws Exception { + syncUpdateCompany(); + } + + public static void syncUpdateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + UpdateCompanyRequest request = + UpdateCompanyRequest.newBuilder() + .setCompany(Company.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Company response = companyServiceClient.updateCompany(request); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_updatecompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/updatecompany/SyncUpdateCompanyCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/updatecompany/SyncUpdateCompanyCompany.java new file mode 100644 index 00000000000..d9e1db4e3e0 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyserviceclient/updatecompany/SyncUpdateCompanyCompany.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyserviceclient_updatecompany_company_sync] +import com.google.cloud.talent.v4beta1.Company; +import com.google.cloud.talent.v4beta1.CompanyServiceClient; + +public class SyncUpdateCompanyCompany { + + public static void main(String[] args) throws Exception { + syncUpdateCompanyCompany(); + } + + public static void syncUpdateCompanyCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + Company company = Company.newBuilder().build(); + Company response = companyServiceClient.updateCompany(company); + } + } +} +// [END talent_v4beta1_generated_companyserviceclient_updatecompany_company_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyservicesettings/createcompany/SyncCreateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyservicesettings/createcompany/SyncCreateCompany.java new file mode 100644 index 00000000000..ebbf5d7f2d3 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/companyservicesettings/createcompany/SyncCreateCompany.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_companyservicesettings_createcompany_sync] +import com.google.cloud.talent.v4beta1.CompanyServiceSettings; +import java.time.Duration; + +public class SyncCreateCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompany(); + } + + public static void syncCreateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceSettings.Builder companyServiceSettingsBuilder = + CompanyServiceSettings.newBuilder(); + companyServiceSettingsBuilder + .createCompanySettings() + .setRetrySettings( + companyServiceSettingsBuilder.createCompanySettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CompanyServiceSettings companyServiceSettings = companyServiceSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_companyservicesettings_createcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/completequery/AsyncCompleteQuery.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/completequery/AsyncCompleteQuery.java new file mode 100644 index 00000000000..2ba40db5216 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/completequery/AsyncCompleteQuery.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_completionclient_completequery_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.CompanyName; +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 java.util.ArrayList; + +public class AsyncCompleteQuery { + + public static void main(String[] args) throws Exception { + asyncCompleteQuery(); + } + + public static void asyncCompleteQuery() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompletionClient completionClient = CompletionClient.create()) { + CompleteQueryRequest request = + CompleteQueryRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setQuery("query107944136") + .addAllLanguageCodes(new ArrayList()) + .setPageSize(883849137) + .setCompany( + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]") + .toString()) + .build(); + ApiFuture future = + completionClient.completeQueryCallable().futureCall(request); + // Do something. + CompleteQueryResponse response = future.get(); + } + } +} +// [END talent_v4beta1_generated_completionclient_completequery_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/completequery/SyncCompleteQuery.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/completequery/SyncCompleteQuery.java new file mode 100644 index 00000000000..add0c0549ac --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/completequery/SyncCompleteQuery.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_completionclient_completequery_sync] +import com.google.cloud.talent.v4beta1.CompanyName; +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 java.util.ArrayList; + +public class SyncCompleteQuery { + + public static void main(String[] args) throws Exception { + syncCompleteQuery(); + } + + public static void syncCompleteQuery() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CompletionClient completionClient = CompletionClient.create()) { + CompleteQueryRequest request = + CompleteQueryRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setQuery("query107944136") + .addAllLanguageCodes(new ArrayList()) + .setPageSize(883849137) + .setCompany( + CompanyName.ofProjectTenantCompanyName("[PROJECT]", "[TENANT]", "[COMPANY]") + .toString()) + .build(); + CompleteQueryResponse response = completionClient.completeQuery(request); + } + } +} +// [END talent_v4beta1_generated_completionclient_completequery_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..13480fe2508 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_completionclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4beta1.CompletionClient; +import com.google.cloud.talent.v4beta1.CompletionSettings; +import com.google.cloud.talent.v4beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionSettings completionSettings = + CompletionSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CompletionClient completionClient = CompletionClient.create(completionSettings); + } +} +// [END talent_v4beta1_generated_completionclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..dead4c83f7a --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_completionclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4beta1.CompletionClient; +import com.google.cloud.talent.v4beta1.CompletionSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionSettings completionSettings = + CompletionSettings.newBuilder() + .setTransportChannelProvider( + CompletionSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + CompletionClient completionClient = CompletionClient.create(completionSettings); + } +} +// [END talent_v4beta1_generated_completionclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..da7ccb632d2 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_completionclient_create_setendpoint_sync] +import com.google.cloud.talent.v4beta1.CompletionClient; +import com.google.cloud.talent.v4beta1.CompletionSettings; +import com.google.cloud.talent.v4beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionSettings completionSettings = + CompletionSettings.newBuilder().setEndpoint(myEndpoint).build(); + CompletionClient completionClient = CompletionClient.create(completionSettings); + } +} +// [END talent_v4beta1_generated_completionclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionsettings/completequery/SyncCompleteQuery.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionsettings/completequery/SyncCompleteQuery.java new file mode 100644 index 00000000000..ad289f6a495 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/completionsettings/completequery/SyncCompleteQuery.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_completionsettings_completequery_sync] +import com.google.cloud.talent.v4beta1.CompletionSettings; +import java.time.Duration; + +public class SyncCompleteQuery { + + public static void main(String[] args) throws Exception { + syncCompleteQuery(); + } + + public static void syncCompleteQuery() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionSettings.Builder completionSettingsBuilder = CompletionSettings.newBuilder(); + completionSettingsBuilder + .completeQuerySettings() + .setRetrySettings( + completionSettingsBuilder.completeQuerySettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CompletionSettings completionSettings = completionSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_completionsettings_completequery_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..eebb1e450aa --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_eventserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4beta1.EventServiceClient; +import com.google.cloud.talent.v4beta1.EventServiceSettings; +import com.google.cloud.talent.v4beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceSettings eventServiceSettings = + EventServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + EventServiceClient eventServiceClient = EventServiceClient.create(eventServiceSettings); + } +} +// [END talent_v4beta1_generated_eventserviceclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..579bd27658c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_eventserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4beta1.EventServiceClient; +import com.google.cloud.talent.v4beta1.EventServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceSettings eventServiceSettings = + EventServiceSettings.newBuilder() + .setTransportChannelProvider( + EventServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + EventServiceClient eventServiceClient = EventServiceClient.create(eventServiceSettings); + } +} +// [END talent_v4beta1_generated_eventserviceclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..a03045e0bd1 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_eventserviceclient_create_setendpoint_sync] +import com.google.cloud.talent.v4beta1.EventServiceClient; +import com.google.cloud.talent.v4beta1.EventServiceSettings; +import com.google.cloud.talent.v4beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceSettings eventServiceSettings = + EventServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + EventServiceClient eventServiceClient = EventServiceClient.create(eventServiceSettings); + } +} +// [END talent_v4beta1_generated_eventserviceclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/AsyncCreateClientEvent.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/AsyncCreateClientEvent.java new file mode 100644 index 00000000000..0c1a9b96d7f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/AsyncCreateClientEvent.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_eventserviceclient_createclientevent_async] +import com.google.api.core.ApiFuture; +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.TenantName; + +public class AsyncCreateClientEvent { + + public static void main(String[] args) throws Exception { + asyncCreateClientEvent(); + } + + public static void asyncCreateClientEvent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + CreateClientEventRequest request = + CreateClientEventRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setClientEvent(ClientEvent.newBuilder().build()) + .build(); + ApiFuture future = + eventServiceClient.createClientEventCallable().futureCall(request); + // Do something. + ClientEvent response = future.get(); + } + } +} +// [END talent_v4beta1_generated_eventserviceclient_createclientevent_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEvent.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEvent.java new file mode 100644 index 00000000000..c4311d171cc --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEvent.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_eventserviceclient_createclientevent_sync] +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.TenantName; + +public class SyncCreateClientEvent { + + public static void main(String[] args) throws Exception { + syncCreateClientEvent(); + } + + public static void syncCreateClientEvent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + CreateClientEventRequest request = + CreateClientEventRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setClientEvent(ClientEvent.newBuilder().build()) + .build(); + ClientEvent response = eventServiceClient.createClientEvent(request); + } + } +} +// [END talent_v4beta1_generated_eventserviceclient_createclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEventProjectnameClientevent.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEventProjectnameClientevent.java new file mode 100644 index 00000000000..9961f46157e --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEventProjectnameClientevent.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_eventserviceclient_createclientevent_projectnameclientevent_sync] +import com.google.cloud.talent.v4beta1.ClientEvent; +import com.google.cloud.talent.v4beta1.EventServiceClient; +import com.google.cloud.talent.v4beta1.ProjectName; + +public class SyncCreateClientEventProjectnameClientevent { + + public static void main(String[] args) throws Exception { + syncCreateClientEventProjectnameClientevent(); + } + + public static void syncCreateClientEventProjectnameClientevent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + ClientEvent clientEvent = ClientEvent.newBuilder().build(); + ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent); + } + } +} +// [END talent_v4beta1_generated_eventserviceclient_createclientevent_projectnameclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEventStringClientevent.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEventStringClientevent.java new file mode 100644 index 00000000000..838150fb056 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEventStringClientevent.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_eventserviceclient_createclientevent_stringclientevent_sync] +import com.google.cloud.talent.v4beta1.ClientEvent; +import com.google.cloud.talent.v4beta1.EventServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncCreateClientEventStringClientevent { + + public static void main(String[] args) throws Exception { + syncCreateClientEventStringClientevent(); + } + + public static void syncCreateClientEventStringClientevent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + ClientEvent clientEvent = ClientEvent.newBuilder().build(); + ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent); + } + } +} +// [END talent_v4beta1_generated_eventserviceclient_createclientevent_stringclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEventTenantnameClientevent.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEventTenantnameClientevent.java new file mode 100644 index 00000000000..9ddc9df4ecb --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventserviceclient/createclientevent/SyncCreateClientEventTenantnameClientevent.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_eventserviceclient_createclientevent_tenantnameclientevent_sync] +import com.google.cloud.talent.v4beta1.ClientEvent; +import com.google.cloud.talent.v4beta1.EventServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncCreateClientEventTenantnameClientevent { + + public static void main(String[] args) throws Exception { + syncCreateClientEventTenantnameClientevent(); + } + + public static void syncCreateClientEventTenantnameClientevent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + ClientEvent clientEvent = ClientEvent.newBuilder().build(); + ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent); + } + } +} +// [END talent_v4beta1_generated_eventserviceclient_createclientevent_tenantnameclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventservicesettings/createclientevent/SyncCreateClientEvent.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventservicesettings/createclientevent/SyncCreateClientEvent.java new file mode 100644 index 00000000000..ea27ed0b53b --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/eventservicesettings/createclientevent/SyncCreateClientEvent.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_eventservicesettings_createclientevent_sync] +import com.google.cloud.talent.v4beta1.EventServiceSettings; +import java.time.Duration; + +public class SyncCreateClientEvent { + + public static void main(String[] args) throws Exception { + syncCreateClientEvent(); + } + + public static void syncCreateClientEvent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceSettings.Builder eventServiceSettingsBuilder = EventServiceSettings.newBuilder(); + eventServiceSettingsBuilder + .createClientEventSettings() + .setRetrySettings( + eventServiceSettingsBuilder.createClientEventSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + EventServiceSettings eventServiceSettings = eventServiceSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_eventservicesettings_createclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobs.java new file mode 100644 index 00000000000..967ca66d4c5 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobs.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchcreatejobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.BatchCreateJobsRequest; +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.longrunning.Operation; +import java.util.ArrayList; + +public class AsyncBatchCreateJobs { + + public static void main(String[] args) throws Exception { + asyncBatchCreateJobs(); + } + + public static void asyncBatchCreateJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchCreateJobsRequest request = + BatchCreateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .build(); + ApiFuture future = jobServiceClient.batchCreateJobsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchcreatejobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobsLRO.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobsLRO.java new file mode 100644 index 00000000000..c0b3c6ed07b --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/AsyncBatchCreateJobsLRO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchcreatejobs_lro_async] +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.ArrayList; + +public class AsyncBatchCreateJobsLRO { + + public static void main(String[] args) throws Exception { + asyncBatchCreateJobsLRO(); + } + + public static void asyncBatchCreateJobsLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchCreateJobsRequest request = + BatchCreateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .build(); + OperationFuture future = + jobServiceClient.batchCreateJobsOperationCallable().futureCall(request); + // Do something. + JobOperationResult response = future.get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchcreatejobs_lro_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobs.java new file mode 100644 index 00000000000..23a36782520 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobs.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchcreatejobs_sync] +import com.google.cloud.talent.v4beta1.BatchCreateJobsRequest; +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.ArrayList; + +public class SyncBatchCreateJobs { + + public static void main(String[] args) throws Exception { + syncBatchCreateJobs(); + } + + public static void syncBatchCreateJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchCreateJobsRequest request = + BatchCreateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .build(); + JobOperationResult response = jobServiceClient.batchCreateJobsAsync(request).get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchcreatejobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsProjectnameListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsProjectnameListjob.java new file mode 100644 index 00000000000..58c82e653b1 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsProjectnameListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchcreatejobs_projectnamelistjob_sync] +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.ProjectName; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchCreateJobsProjectnameListjob { + + public static void main(String[] args) throws Exception { + syncBatchCreateJobsProjectnameListjob(); + } + + public static void syncBatchCreateJobsProjectnameListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + List jobs = new ArrayList<>(); + JobOperationResult response = jobServiceClient.batchCreateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchcreatejobs_projectnamelistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsStringListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsStringListjob.java new file mode 100644 index 00000000000..a783183bfd9 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsStringListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchcreatejobs_stringlistjob_sync] +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.ArrayList; +import java.util.List; + +public class SyncBatchCreateJobsStringListjob { + + public static void main(String[] args) throws Exception { + syncBatchCreateJobsStringListjob(); + } + + public static void syncBatchCreateJobsStringListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + List jobs = new ArrayList<>(); + JobOperationResult response = jobServiceClient.batchCreateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchcreatejobs_stringlistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsTenantnameListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsTenantnameListjob.java new file mode 100644 index 00000000000..361049170ea --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchcreatejobs/SyncBatchCreateJobsTenantnameListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchcreatejobs_tenantnamelistjob_sync] +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.ArrayList; +import java.util.List; + +public class SyncBatchCreateJobsTenantnameListjob { + + public static void main(String[] args) throws Exception { + syncBatchCreateJobsTenantnameListjob(); + } + + public static void syncBatchCreateJobsTenantnameListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + List jobs = new ArrayList<>(); + JobOperationResult response = jobServiceClient.batchCreateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchcreatejobs_tenantnamelistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/AsyncBatchDeleteJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/AsyncBatchDeleteJobs.java new file mode 100644 index 00000000000..2c7ed5d1c1c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/AsyncBatchDeleteJobs.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchdeletejobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.protobuf.Empty; + +public class AsyncBatchDeleteJobs { + + public static void main(String[] args) throws Exception { + asyncBatchDeleteJobs(); + } + + public static void asyncBatchDeleteJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchDeleteJobsRequest request = + BatchDeleteJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setFilter("filter-1274492040") + .build(); + ApiFuture future = jobServiceClient.batchDeleteJobsCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchdeletejobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobs.java new file mode 100644 index 00000000000..caf9e1b3ae8 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobs.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchdeletejobs_sync] +import com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.protobuf.Empty; + +public class SyncBatchDeleteJobs { + + public static void main(String[] args) throws Exception { + syncBatchDeleteJobs(); + } + + public static void syncBatchDeleteJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchDeleteJobsRequest request = + BatchDeleteJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setFilter("filter-1274492040") + .build(); + jobServiceClient.batchDeleteJobs(request); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchdeletejobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsProjectnameString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsProjectnameString.java new file mode 100644 index 00000000000..f1539c3699c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsProjectnameString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchdeletejobs_projectnamestring_sync] +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.ProjectName; +import com.google.protobuf.Empty; + +public class SyncBatchDeleteJobsProjectnameString { + + public static void main(String[] args) throws Exception { + syncBatchDeleteJobsProjectnameString(); + } + + public static void syncBatchDeleteJobsProjectnameString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + String filter = "filter-1274492040"; + jobServiceClient.batchDeleteJobs(parent, filter); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchdeletejobs_projectnamestring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsStringString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsStringString.java new file mode 100644 index 00000000000..8bfe715975f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsStringString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchdeletejobs_stringstring_sync] +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.protobuf.Empty; + +public class SyncBatchDeleteJobsStringString { + + public static void main(String[] args) throws Exception { + syncBatchDeleteJobsStringString(); + } + + public static void syncBatchDeleteJobsStringString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + String filter = "filter-1274492040"; + jobServiceClient.batchDeleteJobs(parent, filter); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchdeletejobs_stringstring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsTenantnameString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsTenantnameString.java new file mode 100644 index 00000000000..79b0a2ae161 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchdeletejobs/SyncBatchDeleteJobsTenantnameString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchdeletejobs_tenantnamestring_sync] +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.protobuf.Empty; + +public class SyncBatchDeleteJobsTenantnameString { + + public static void main(String[] args) throws Exception { + syncBatchDeleteJobsTenantnameString(); + } + + public static void syncBatchDeleteJobsTenantnameString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + String filter = "filter-1274492040"; + jobServiceClient.batchDeleteJobs(parent, filter); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchdeletejobs_tenantnamestring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobs.java new file mode 100644 index 00000000000..037504bd500 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobs.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchupdatejobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.BatchUpdateJobsRequest; +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncBatchUpdateJobs { + + public static void main(String[] args) throws Exception { + asyncBatchUpdateJobs(); + } + + public static void asyncBatchUpdateJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchUpdateJobsRequest request = + BatchUpdateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.batchUpdateJobsCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchupdatejobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobsLRO.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobsLRO.java new file mode 100644 index 00000000000..16990944bb0 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/AsyncBatchUpdateJobsLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchupdatejobs_lro_async] +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 com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class AsyncBatchUpdateJobsLRO { + + public static void main(String[] args) throws Exception { + asyncBatchUpdateJobsLRO(); + } + + public static void asyncBatchUpdateJobsLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchUpdateJobsRequest request = + BatchUpdateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + OperationFuture future = + jobServiceClient.batchUpdateJobsOperationCallable().futureCall(request); + // Do something. + JobOperationResult response = future.get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchupdatejobs_lro_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobs.java new file mode 100644 index 00000000000..1bdb7b20982 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobs.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchupdatejobs_sync] +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 com.google.protobuf.FieldMask; +import java.util.ArrayList; + +public class SyncBatchUpdateJobs { + + public static void main(String[] args) throws Exception { + syncBatchUpdateJobs(); + } + + public static void syncBatchUpdateJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + BatchUpdateJobsRequest request = + BatchUpdateJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .addAllJobs(new ArrayList()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + JobOperationResult response = jobServiceClient.batchUpdateJobsAsync(request).get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchupdatejobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsProjectnameListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsProjectnameListjob.java new file mode 100644 index 00000000000..43bc2ee51fd --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsProjectnameListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchupdatejobs_projectnamelistjob_sync] +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.ProjectName; +import java.util.ArrayList; +import java.util.List; + +public class SyncBatchUpdateJobsProjectnameListjob { + + public static void main(String[] args) throws Exception { + syncBatchUpdateJobsProjectnameListjob(); + } + + public static void syncBatchUpdateJobsProjectnameListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + List jobs = new ArrayList<>(); + JobOperationResult response = jobServiceClient.batchUpdateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchupdatejobs_projectnamelistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsStringListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsStringListjob.java new file mode 100644 index 00000000000..276e766a281 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsStringListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchupdatejobs_stringlistjob_sync] +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.ArrayList; +import java.util.List; + +public class SyncBatchUpdateJobsStringListjob { + + public static void main(String[] args) throws Exception { + syncBatchUpdateJobsStringListjob(); + } + + public static void syncBatchUpdateJobsStringListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + List jobs = new ArrayList<>(); + JobOperationResult response = jobServiceClient.batchUpdateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchupdatejobs_stringlistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsTenantnameListjob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsTenantnameListjob.java new file mode 100644 index 00000000000..ef825ff4533 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/batchupdatejobs/SyncBatchUpdateJobsTenantnameListjob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_batchupdatejobs_tenantnamelistjob_sync] +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.ArrayList; +import java.util.List; + +public class SyncBatchUpdateJobsTenantnameListjob { + + public static void main(String[] args) throws Exception { + syncBatchUpdateJobsTenantnameListjob(); + } + + public static void syncBatchUpdateJobsTenantnameListjob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + List jobs = new ArrayList<>(); + JobOperationResult response = jobServiceClient.batchUpdateJobsAsync(parent, jobs).get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_batchupdatejobs_tenantnamelistjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..82d8340e68d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobServiceSettings; +import com.google.cloud.talent.v4beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END talent_v4beta1_generated_jobserviceclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..8ded6509325 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder() + .setTransportChannelProvider( + JobServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END talent_v4beta1_generated_jobserviceclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..fb10d5e57c6 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_create_setendpoint_sync] +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobServiceSettings; +import com.google.cloud.talent.v4beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceSettings jobServiceSettings = + JobServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings); + } +} +// [END talent_v4beta1_generated_jobserviceclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/AsyncCreateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/AsyncCreateJob.java new file mode 100644 index 00000000000..2624c603b08 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/AsyncCreateJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_createjob_async] +import com.google.api.core.ApiFuture; +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; + +public class AsyncCreateJob { + + public static void main(String[] args) throws Exception { + asyncCreateJob(); + } + + public static void asyncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateJobRequest request = + CreateJobRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setJob(Job.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.createJobCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_createjob_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJob.java new file mode 100644 index 00000000000..7536406885b --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_createjob_sync] +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; + +public class SyncCreateJob { + + public static void main(String[] args) throws Exception { + syncCreateJob(); + } + + public static void syncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + CreateJobRequest request = + CreateJobRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setJob(Job.newBuilder().build()) + .build(); + Job response = jobServiceClient.createJob(request); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_createjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJobProjectnameJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJobProjectnameJob.java new file mode 100644 index 00000000000..e0bb2ae21b5 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJobProjectnameJob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_createjob_projectnamejob_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.ProjectName; + +public class SyncCreateJobProjectnameJob { + + public static void main(String[] args) throws Exception { + syncCreateJobProjectnameJob(); + } + + public static void syncCreateJobProjectnameJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + Job job = Job.newBuilder().build(); + Job response = jobServiceClient.createJob(parent, job); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_createjob_projectnamejob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJobStringJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJobStringJob.java new file mode 100644 index 00000000000..0e12dea81c6 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJobStringJob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_createjob_stringjob_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncCreateJobStringJob { + + public static void main(String[] args) throws Exception { + syncCreateJobStringJob(); + } + + public static void syncCreateJobStringJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + Job job = Job.newBuilder().build(); + Job response = jobServiceClient.createJob(parent, job); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_createjob_stringjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJobTenantnameJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJobTenantnameJob.java new file mode 100644 index 00000000000..6d65df91a2a --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/createjob/SyncCreateJobTenantnameJob.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_createjob_tenantnamejob_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncCreateJobTenantnameJob { + + public static void main(String[] args) throws Exception { + syncCreateJobTenantnameJob(); + } + + public static void syncCreateJobTenantnameJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + Job job = Job.newBuilder().build(); + Job response = jobServiceClient.createJob(parent, job); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_createjob_tenantnamejob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/AsyncDeleteJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/AsyncDeleteJob.java new file mode 100644 index 00000000000..740f82c74c0 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/AsyncDeleteJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_deletejob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.DeleteJobRequest; +import com.google.cloud.talent.v4beta1.JobName; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteJob { + + public static void main(String[] args) throws Exception { + asyncDeleteJob(); + } + + public static void asyncDeleteJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteJobRequest request = + DeleteJobRequest.newBuilder() + .setName(JobName.ofProjectTenantJobName("[PROJECT]", "[TENANT]", "[JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.deleteJobCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_deletejob_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/SyncDeleteJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/SyncDeleteJob.java new file mode 100644 index 00000000000..15590c06db9 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/SyncDeleteJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_deletejob_sync] +import com.google.cloud.talent.v4beta1.DeleteJobRequest; +import com.google.cloud.talent.v4beta1.JobName; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteJob { + + public static void main(String[] args) throws Exception { + syncDeleteJob(); + } + + public static void syncDeleteJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + DeleteJobRequest request = + DeleteJobRequest.newBuilder() + .setName(JobName.ofProjectTenantJobName("[PROJECT]", "[TENANT]", "[JOB]").toString()) + .build(); + jobServiceClient.deleteJob(request); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_deletejob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/SyncDeleteJobJobname.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/SyncDeleteJobJobname.java new file mode 100644 index 00000000000..874a1c47b07 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/SyncDeleteJobJobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_deletejob_jobname_sync] +import com.google.cloud.talent.v4beta1.JobName; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteJobJobname { + + public static void main(String[] args) throws Exception { + syncDeleteJobJobname(); + } + + public static void syncDeleteJobJobname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + JobName name = JobName.ofProjectTenantJobName("[PROJECT]", "[TENANT]", "[JOB]"); + jobServiceClient.deleteJob(name); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_deletejob_jobname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/SyncDeleteJobString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/SyncDeleteJobString.java new file mode 100644 index 00000000000..53661d2ab65 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/deletejob/SyncDeleteJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_deletejob_string_sync] +import com.google.cloud.talent.v4beta1.JobName; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteJobString { + + public static void main(String[] args) throws Exception { + syncDeleteJobString(); + } + + public static void syncDeleteJobString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = JobName.ofProjectTenantJobName("[PROJECT]", "[TENANT]", "[JOB]").toString(); + jobServiceClient.deleteJob(name); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_deletejob_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/AsyncGetJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/AsyncGetJob.java new file mode 100644 index 00000000000..af90d799dc8 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/AsyncGetJob.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_getjob_async] +import com.google.api.core.ApiFuture; +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; + +public class AsyncGetJob { + + public static void main(String[] args) throws Exception { + asyncGetJob(); + } + + public static void asyncGetJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetJobRequest request = + GetJobRequest.newBuilder() + .setName(JobName.ofProjectTenantJobName("[PROJECT]", "[TENANT]", "[JOB]").toString()) + .build(); + ApiFuture future = jobServiceClient.getJobCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_getjob_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/SyncGetJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/SyncGetJob.java new file mode 100644 index 00000000000..0973a6027b2 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/SyncGetJob.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_getjob_sync] +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; + +public class SyncGetJob { + + public static void main(String[] args) throws Exception { + syncGetJob(); + } + + public static void syncGetJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + GetJobRequest request = + GetJobRequest.newBuilder() + .setName(JobName.ofProjectTenantJobName("[PROJECT]", "[TENANT]", "[JOB]").toString()) + .build(); + Job response = jobServiceClient.getJob(request); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_getjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/SyncGetJobJobname.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/SyncGetJobJobname.java new file mode 100644 index 00000000000..5ac746a576d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/SyncGetJobJobname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_getjob_jobname_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobName; +import com.google.cloud.talent.v4beta1.JobServiceClient; + +public class SyncGetJobJobname { + + public static void main(String[] args) throws Exception { + syncGetJobJobname(); + } + + public static void syncGetJobJobname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + JobName name = JobName.ofProjectTenantJobName("[PROJECT]", "[TENANT]", "[JOB]"); + Job response = jobServiceClient.getJob(name); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_getjob_jobname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/SyncGetJobString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/SyncGetJobString.java new file mode 100644 index 00000000000..f003707b43d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/getjob/SyncGetJobString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_getjob_string_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobName; +import com.google.cloud.talent.v4beta1.JobServiceClient; + +public class SyncGetJobString { + + public static void main(String[] args) throws Exception { + syncGetJobString(); + } + + public static void syncGetJobString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String name = JobName.ofProjectTenantJobName("[PROJECT]", "[TENANT]", "[JOB]").toString(); + Job response = jobServiceClient.getJob(name); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_getjob_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/AsyncListJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/AsyncListJobs.java new file mode 100644 index 00000000000..70dab31b10a --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/AsyncListJobs.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_listjobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobView; +import com.google.cloud.talent.v4beta1.ListJobsRequest; +import com.google.cloud.talent.v4beta1.TenantName; + +public class AsyncListJobs { + + public static void main(String[] args) throws Exception { + asyncListJobs(); + } + + public static void asyncListJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListJobsRequest request = + ListJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setJobView(JobView.forNumber(0)) + .build(); + ApiFuture future = jobServiceClient.listJobsPagedCallable().futureCall(request); + // Do something. + for (Job element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_listjobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/AsyncListJobsPaged.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/AsyncListJobsPaged.java new file mode 100644 index 00000000000..2dcebafcb33 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/AsyncListJobsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_listjobs_paged_async] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobView; +import com.google.cloud.talent.v4beta1.ListJobsRequest; +import com.google.cloud.talent.v4beta1.ListJobsResponse; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.common.base.Strings; + +public class AsyncListJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListJobsPaged(); + } + + public static void asyncListJobsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListJobsRequest request = + ListJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setJobView(JobView.forNumber(0)) + .build(); + while (true) { + ListJobsResponse response = jobServiceClient.listJobsCallable().call(request); + for (Job element : response.getJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_listjobs_paged_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobs.java new file mode 100644 index 00000000000..f899d3d8626 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobs.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_listjobs_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobView; +import com.google.cloud.talent.v4beta1.ListJobsRequest; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncListJobs { + + public static void main(String[] args) throws Exception { + syncListJobs(); + } + + public static void syncListJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ListJobsRequest request = + ListJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setFilter("filter-1274492040") + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .setJobView(JobView.forNumber(0)) + .build(); + for (Job element : jobServiceClient.listJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_listjobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobsProjectnameString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobsProjectnameString.java new file mode 100644 index 00000000000..98b6c1c21b0 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobsProjectnameString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_listjobs_projectnamestring_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.ProjectName; + +public class SyncListJobsProjectnameString { + + public static void main(String[] args) throws Exception { + syncListJobsProjectnameString(); + } + + public static void syncListJobsProjectnameString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + String filter = "filter-1274492040"; + for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_listjobs_projectnamestring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobsStringString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobsStringString.java new file mode 100644 index 00000000000..0a916890d49 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobsStringString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_listjobs_stringstring_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncListJobsStringString { + + public static void main(String[] args) throws Exception { + syncListJobsStringString(); + } + + public static void syncListJobsStringString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + String parent = TenantName.of("[PROJECT]", "[TENANT]").toString(); + String filter = "filter-1274492040"; + for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_listjobs_stringstring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobsTenantnameString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobsTenantnameString.java new file mode 100644 index 00000000000..fbbd374f6d9 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/listjobs/SyncListJobsTenantnameString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_listjobs_tenantnamestring_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.TenantName; + +public class SyncListJobsTenantnameString { + + public static void main(String[] args) throws Exception { + syncListJobsTenantnameString(); + } + + public static void syncListJobsTenantnameString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); + String filter = "filter-1274492040"; + for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_listjobs_tenantnamestring_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobs/AsyncSearchJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobs/AsyncSearchJobs.java new file mode 100644 index 00000000000..8b75dcd16bf --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobs/AsyncSearchJobs.java @@ -0,0 +1,69 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_searchjobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.HistogramQuery; +import com.google.cloud.talent.v4beta1.JobQuery; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobView; +import com.google.cloud.talent.v4beta1.RequestMetadata; +import com.google.cloud.talent.v4beta1.SearchJobsRequest; +import com.google.cloud.talent.v4beta1.SearchJobsResponse; +import com.google.cloud.talent.v4beta1.TenantName; +import java.util.ArrayList; + +public class AsyncSearchJobs { + + public static void main(String[] args) throws Exception { + asyncSearchJobs(); + } + + public static void asyncSearchJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .setRequirePreciseResultSize(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + ApiFuture future = + jobServiceClient.searchJobsPagedCallable().futureCall(request); + // Do something. + for (SearchJobsResponse.MatchingJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_searchjobs_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobs/AsyncSearchJobsPaged.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobs/AsyncSearchJobsPaged.java new file mode 100644 index 00000000000..69d1295b6bb --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobs/AsyncSearchJobsPaged.java @@ -0,0 +1,75 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_searchjobs_paged_async] +import com.google.cloud.talent.v4beta1.HistogramQuery; +import com.google.cloud.talent.v4beta1.JobQuery; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobView; +import com.google.cloud.talent.v4beta1.RequestMetadata; +import com.google.cloud.talent.v4beta1.SearchJobsRequest; +import com.google.cloud.talent.v4beta1.SearchJobsResponse; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.common.base.Strings; +import java.util.ArrayList; + +public class AsyncSearchJobsPaged { + + public static void main(String[] args) throws Exception { + asyncSearchJobsPaged(); + } + + public static void asyncSearchJobsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .setRequirePreciseResultSize(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + while (true) { + SearchJobsResponse response = jobServiceClient.searchJobsCallable().call(request); + for (SearchJobsResponse.MatchingJob element : response.getMatchingJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_searchjobs_paged_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobs/SyncSearchJobs.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobs/SyncSearchJobs.java new file mode 100644 index 00000000000..cab4ec13187 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobs/SyncSearchJobs.java @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_searchjobs_sync] +import com.google.cloud.talent.v4beta1.HistogramQuery; +import com.google.cloud.talent.v4beta1.JobQuery; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobView; +import com.google.cloud.talent.v4beta1.RequestMetadata; +import com.google.cloud.talent.v4beta1.SearchJobsRequest; +import com.google.cloud.talent.v4beta1.SearchJobsResponse; +import com.google.cloud.talent.v4beta1.TenantName; +import java.util.ArrayList; + +public class SyncSearchJobs { + + public static void main(String[] args) throws Exception { + syncSearchJobs(); + } + + public static void syncSearchJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .setRequirePreciseResultSize(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + for (SearchJobsResponse.MatchingJob element : + jobServiceClient.searchJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_searchjobs_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobsforalert/AsyncSearchJobsForAlert.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobsforalert/AsyncSearchJobsForAlert.java new file mode 100644 index 00000000000..3eedd7b6d36 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobsforalert/AsyncSearchJobsForAlert.java @@ -0,0 +1,69 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_searchjobsforalert_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.HistogramQuery; +import com.google.cloud.talent.v4beta1.JobQuery; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobView; +import com.google.cloud.talent.v4beta1.RequestMetadata; +import com.google.cloud.talent.v4beta1.SearchJobsRequest; +import com.google.cloud.talent.v4beta1.SearchJobsResponse; +import com.google.cloud.talent.v4beta1.TenantName; +import java.util.ArrayList; + +public class AsyncSearchJobsForAlert { + + public static void main(String[] args) throws Exception { + asyncSearchJobsForAlert(); + } + + public static void asyncSearchJobsForAlert() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .setRequirePreciseResultSize(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + ApiFuture future = + jobServiceClient.searchJobsForAlertPagedCallable().futureCall(request); + // Do something. + for (SearchJobsResponse.MatchingJob element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_searchjobsforalert_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobsforalert/AsyncSearchJobsForAlertPaged.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobsforalert/AsyncSearchJobsForAlertPaged.java new file mode 100644 index 00000000000..bda1639dd56 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobsforalert/AsyncSearchJobsForAlertPaged.java @@ -0,0 +1,75 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_searchjobsforalert_paged_async] +import com.google.cloud.talent.v4beta1.HistogramQuery; +import com.google.cloud.talent.v4beta1.JobQuery; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobView; +import com.google.cloud.talent.v4beta1.RequestMetadata; +import com.google.cloud.talent.v4beta1.SearchJobsRequest; +import com.google.cloud.talent.v4beta1.SearchJobsResponse; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.common.base.Strings; +import java.util.ArrayList; + +public class AsyncSearchJobsForAlertPaged { + + public static void main(String[] args) throws Exception { + asyncSearchJobsForAlertPaged(); + } + + public static void asyncSearchJobsForAlertPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .setRequirePreciseResultSize(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + while (true) { + SearchJobsResponse response = jobServiceClient.searchJobsForAlertCallable().call(request); + for (SearchJobsResponse.MatchingJob element : response.getMatchingJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_searchjobsforalert_paged_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobsforalert/SyncSearchJobsForAlert.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobsforalert/SyncSearchJobsForAlert.java new file mode 100644 index 00000000000..cb69408a2cd --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/searchjobsforalert/SyncSearchJobsForAlert.java @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_searchjobsforalert_sync] +import com.google.cloud.talent.v4beta1.HistogramQuery; +import com.google.cloud.talent.v4beta1.JobQuery; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.JobView; +import com.google.cloud.talent.v4beta1.RequestMetadata; +import com.google.cloud.talent.v4beta1.SearchJobsRequest; +import com.google.cloud.talent.v4beta1.SearchJobsResponse; +import com.google.cloud.talent.v4beta1.TenantName; +import java.util.ArrayList; + +public class SyncSearchJobsForAlert { + + public static void main(String[] args) throws Exception { + syncSearchJobsForAlert(); + } + + public static void syncSearchJobsForAlert() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .setRequestMetadata(RequestMetadata.newBuilder().build()) + .setJobQuery(JobQuery.newBuilder().build()) + .setEnableBroadening(true) + .setRequirePreciseResultSize(true) + .addAllHistogramQueries(new ArrayList()) + .setJobView(JobView.forNumber(0)) + .setOffset(-1019779949) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setOrderBy("orderBy-1207110587") + .setCustomRankingInfo(SearchJobsRequest.CustomRankingInfo.newBuilder().build()) + .setDisableKeywordMatch(true) + .build(); + for (SearchJobsResponse.MatchingJob element : + jobServiceClient.searchJobsForAlert(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_searchjobsforalert_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/updatejob/AsyncUpdateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/updatejob/AsyncUpdateJob.java new file mode 100644 index 00000000000..a71d0bcdfcd --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/updatejob/AsyncUpdateJob.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_updatejob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.UpdateJobRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateJob { + + public static void main(String[] args) throws Exception { + asyncUpdateJob(); + } + + public static void asyncUpdateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateJobRequest request = + UpdateJobRequest.newBuilder() + .setJob(Job.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = jobServiceClient.updateJobCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_updatejob_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/updatejob/SyncUpdateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/updatejob/SyncUpdateJob.java new file mode 100644 index 00000000000..e538228d94e --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/updatejob/SyncUpdateJob.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_updatejob_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; +import com.google.cloud.talent.v4beta1.UpdateJobRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateJob { + + public static void main(String[] args) throws Exception { + syncUpdateJob(); + } + + public static void syncUpdateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + UpdateJobRequest request = + UpdateJobRequest.newBuilder() + .setJob(Job.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Job response = jobServiceClient.updateJob(request); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_updatejob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/updatejob/SyncUpdateJobJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/updatejob/SyncUpdateJobJob.java new file mode 100644 index 00000000000..8491689d752 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobserviceclient/updatejob/SyncUpdateJobJob.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobserviceclient_updatejob_job_sync] +import com.google.cloud.talent.v4beta1.Job; +import com.google.cloud.talent.v4beta1.JobServiceClient; + +public class SyncUpdateJobJob { + + public static void main(String[] args) throws Exception { + syncUpdateJobJob(); + } + + public static void syncUpdateJobJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + Job job = Job.newBuilder().build(); + Job response = jobServiceClient.updateJob(job); + } + } +} +// [END talent_v4beta1_generated_jobserviceclient_updatejob_job_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobservicesettings/createjob/SyncCreateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobservicesettings/createjob/SyncCreateJob.java new file mode 100644 index 00000000000..329af6acc4c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/jobservicesettings/createjob/SyncCreateJob.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_jobservicesettings_createjob_sync] +import com.google.cloud.talent.v4beta1.JobServiceSettings; +import java.time.Duration; + +public class SyncCreateJob { + + public static void main(String[] args) throws Exception { + syncCreateJob(); + } + + public static void syncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceSettings.Builder jobServiceSettingsBuilder = JobServiceSettings.newBuilder(); + jobServiceSettingsBuilder + .createJobSettings() + .setRetrySettings( + jobServiceSettingsBuilder.createJobSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobServiceSettings jobServiceSettings = jobServiceSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_jobservicesettings_createjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/companyservicestubsettings/createcompany/SyncCreateCompany.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/companyservicestubsettings/createcompany/SyncCreateCompany.java new file mode 100644 index 00000000000..ca8fadc8a68 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/companyservicestubsettings/createcompany/SyncCreateCompany.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.stub.samples; + +// [START talent_v4beta1_generated_companyservicestubsettings_createcompany_sync] +import com.google.cloud.talent.v4beta1.stub.CompanyServiceStubSettings; +import java.time.Duration; + +public class SyncCreateCompany { + + public static void main(String[] args) throws Exception { + syncCreateCompany(); + } + + public static void syncCreateCompany() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompanyServiceStubSettings.Builder companyServiceSettingsBuilder = + CompanyServiceStubSettings.newBuilder(); + companyServiceSettingsBuilder + .createCompanySettings() + .setRetrySettings( + companyServiceSettingsBuilder.createCompanySettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CompanyServiceStubSettings companyServiceSettings = companyServiceSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_companyservicestubsettings_createcompany_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/completionstubsettings/completequery/SyncCompleteQuery.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/completionstubsettings/completequery/SyncCompleteQuery.java new file mode 100644 index 00000000000..da564025fa2 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/completionstubsettings/completequery/SyncCompleteQuery.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.stub.samples; + +// [START talent_v4beta1_generated_completionstubsettings_completequery_sync] +import com.google.cloud.talent.v4beta1.stub.CompletionStubSettings; +import java.time.Duration; + +public class SyncCompleteQuery { + + public static void main(String[] args) throws Exception { + syncCompleteQuery(); + } + + public static void syncCompleteQuery() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CompletionStubSettings.Builder completionSettingsBuilder = CompletionStubSettings.newBuilder(); + completionSettingsBuilder + .completeQuerySettings() + .setRetrySettings( + completionSettingsBuilder.completeQuerySettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CompletionStubSettings completionSettings = completionSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_completionstubsettings_completequery_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/eventservicestubsettings/createclientevent/SyncCreateClientEvent.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/eventservicestubsettings/createclientevent/SyncCreateClientEvent.java new file mode 100644 index 00000000000..45d96470c93 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/eventservicestubsettings/createclientevent/SyncCreateClientEvent.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.stub.samples; + +// [START talent_v4beta1_generated_eventservicestubsettings_createclientevent_sync] +import com.google.cloud.talent.v4beta1.stub.EventServiceStubSettings; +import java.time.Duration; + +public class SyncCreateClientEvent { + + public static void main(String[] args) throws Exception { + syncCreateClientEvent(); + } + + public static void syncCreateClientEvent() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + EventServiceStubSettings.Builder eventServiceSettingsBuilder = + EventServiceStubSettings.newBuilder(); + eventServiceSettingsBuilder + .createClientEventSettings() + .setRetrySettings( + eventServiceSettingsBuilder.createClientEventSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + EventServiceStubSettings eventServiceSettings = eventServiceSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_eventservicestubsettings_createclientevent_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/jobservicestubsettings/createjob/SyncCreateJob.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/jobservicestubsettings/createjob/SyncCreateJob.java new file mode 100644 index 00000000000..baaa5978f52 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/jobservicestubsettings/createjob/SyncCreateJob.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.stub.samples; + +// [START talent_v4beta1_generated_jobservicestubsettings_createjob_sync] +import com.google.cloud.talent.v4beta1.stub.JobServiceStubSettings; +import java.time.Duration; + +public class SyncCreateJob { + + public static void main(String[] args) throws Exception { + syncCreateJob(); + } + + public static void syncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobServiceStubSettings.Builder jobServiceSettingsBuilder = JobServiceStubSettings.newBuilder(); + jobServiceSettingsBuilder + .createJobSettings() + .setRetrySettings( + jobServiceSettingsBuilder.createJobSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobServiceStubSettings jobServiceSettings = jobServiceSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_jobservicestubsettings_createjob_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/tenantservicestubsettings/createtenant/SyncCreateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/tenantservicestubsettings/createtenant/SyncCreateTenant.java new file mode 100644 index 00000000000..750793af6b1 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/stub/tenantservicestubsettings/createtenant/SyncCreateTenant.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.stub.samples; + +// [START talent_v4beta1_generated_tenantservicestubsettings_createtenant_sync] +import com.google.cloud.talent.v4beta1.stub.TenantServiceStubSettings; +import java.time.Duration; + +public class SyncCreateTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenant(); + } + + public static void syncCreateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceStubSettings.Builder tenantServiceSettingsBuilder = + TenantServiceStubSettings.newBuilder(); + tenantServiceSettingsBuilder + .createTenantSettings() + .setRetrySettings( + tenantServiceSettingsBuilder.createTenantSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TenantServiceStubSettings tenantServiceSettings = tenantServiceSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_tenantservicestubsettings_createtenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/create/SyncCreateSetCredentialsProvider.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000000..810d5455b67 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.cloud.talent.v4beta1.TenantServiceSettings; +import com.google.cloud.talent.v4beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceSettings tenantServiceSettings = + TenantServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + TenantServiceClient tenantServiceClient = TenantServiceClient.create(tenantServiceSettings); + } +} +// [END talent_v4beta1_generated_tenantserviceclient_create_setcredentialsprovider_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/create/SyncCreateSetCredentialsProvider1.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000000..41bf04fad20 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.cloud.talent.v4beta1.TenantServiceSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceSettings tenantServiceSettings = + TenantServiceSettings.newBuilder() + .setTransportChannelProvider( + TenantServiceSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + TenantServiceClient tenantServiceClient = TenantServiceClient.create(tenantServiceSettings); + } +} +// [END talent_v4beta1_generated_tenantserviceclient_create_setcredentialsprovider1_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/create/SyncCreateSetEndpoint.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000000..e791a8af675 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_create_setendpoint_sync] +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.cloud.talent.v4beta1.TenantServiceSettings; +import com.google.cloud.talent.v4beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceSettings tenantServiceSettings = + TenantServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + TenantServiceClient tenantServiceClient = TenantServiceClient.create(tenantServiceSettings); + } +} +// [END talent_v4beta1_generated_tenantserviceclient_create_setendpoint_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/AsyncCreateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/AsyncCreateTenant.java new file mode 100644 index 00000000000..4c0e11ae265 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/AsyncCreateTenant.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_createtenant_async] +import com.google.api.core.ApiFuture; +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 class AsyncCreateTenant { + + public static void main(String[] args) throws Exception { + asyncCreateTenant(); + } + + public static void asyncCreateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + CreateTenantRequest request = + CreateTenantRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setTenant(Tenant.newBuilder().build()) + .build(); + ApiFuture future = tenantServiceClient.createTenantCallable().futureCall(request); + // Do something. + Tenant response = future.get(); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_createtenant_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/SyncCreateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/SyncCreateTenant.java new file mode 100644 index 00000000000..07447cd64b2 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/SyncCreateTenant.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_createtenant_sync] +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 class SyncCreateTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenant(); + } + + public static void syncCreateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + CreateTenantRequest request = + CreateTenantRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setTenant(Tenant.newBuilder().build()) + .build(); + Tenant response = tenantServiceClient.createTenant(request); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_createtenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/SyncCreateTenantProjectnameTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/SyncCreateTenantProjectnameTenant.java new file mode 100644 index 00000000000..111195830d2 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/SyncCreateTenantProjectnameTenant.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_createtenant_projectnametenant_sync] +import com.google.cloud.talent.v4beta1.ProjectName; +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantServiceClient; + +public class SyncCreateTenantProjectnameTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenantProjectnameTenant(); + } + + public static void syncCreateTenantProjectnameTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + Tenant tenant = Tenant.newBuilder().build(); + Tenant response = tenantServiceClient.createTenant(parent, tenant); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_createtenant_projectnametenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/SyncCreateTenantStringTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/SyncCreateTenantStringTenant.java new file mode 100644 index 00000000000..15130889c8d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/createtenant/SyncCreateTenantStringTenant.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_createtenant_stringtenant_sync] +import com.google.cloud.talent.v4beta1.ProjectName; +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantServiceClient; + +public class SyncCreateTenantStringTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenantStringTenant(); + } + + public static void syncCreateTenantStringTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + Tenant tenant = Tenant.newBuilder().build(); + Tenant response = tenantServiceClient.createTenant(parent, tenant); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_createtenant_stringtenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/AsyncDeleteTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/AsyncDeleteTenant.java new file mode 100644 index 00000000000..7b0ad1ce99c --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/AsyncDeleteTenant.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_deletetenant_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.DeleteTenantRequest; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTenant { + + public static void main(String[] args) throws Exception { + asyncDeleteTenant(); + } + + public static void asyncDeleteTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + DeleteTenantRequest request = + DeleteTenantRequest.newBuilder() + .setName(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .build(); + ApiFuture future = tenantServiceClient.deleteTenantCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_deletetenant_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/SyncDeleteTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/SyncDeleteTenant.java new file mode 100644 index 00000000000..bd63418dfcc --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/SyncDeleteTenant.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_deletetenant_sync] +import com.google.cloud.talent.v4beta1.DeleteTenantRequest; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTenant { + + public static void main(String[] args) throws Exception { + syncDeleteTenant(); + } + + public static void syncDeleteTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + DeleteTenantRequest request = + DeleteTenantRequest.newBuilder() + .setName(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .build(); + tenantServiceClient.deleteTenant(request); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_deletetenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/SyncDeleteTenantString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/SyncDeleteTenantString.java new file mode 100644 index 00000000000..fbd486a4f3a --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/SyncDeleteTenantString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_deletetenant_string_sync] +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTenantString { + + public static void main(String[] args) throws Exception { + syncDeleteTenantString(); + } + + public static void syncDeleteTenantString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + String name = TenantName.of("[PROJECT]", "[TENANT]").toString(); + tenantServiceClient.deleteTenant(name); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_deletetenant_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/SyncDeleteTenantTenantname.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/SyncDeleteTenantTenantname.java new file mode 100644 index 00000000000..fbf592119d4 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/deletetenant/SyncDeleteTenantTenantname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_deletetenant_tenantname_sync] +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTenantTenantname { + + public static void main(String[] args) throws Exception { + syncDeleteTenantTenantname(); + } + + public static void syncDeleteTenantTenantname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + TenantName name = TenantName.of("[PROJECT]", "[TENANT]"); + tenantServiceClient.deleteTenant(name); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_deletetenant_tenantname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/AsyncGetTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/AsyncGetTenant.java new file mode 100644 index 00000000000..62db592ea49 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/AsyncGetTenant.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_gettenant_async] +import com.google.api.core.ApiFuture; +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 class AsyncGetTenant { + + public static void main(String[] args) throws Exception { + asyncGetTenant(); + } + + public static void asyncGetTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + GetTenantRequest request = + GetTenantRequest.newBuilder() + .setName(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .build(); + ApiFuture future = tenantServiceClient.getTenantCallable().futureCall(request); + // Do something. + Tenant response = future.get(); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_gettenant_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/SyncGetTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/SyncGetTenant.java new file mode 100644 index 00000000000..176b34f65bf --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/SyncGetTenant.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_gettenant_sync] +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 class SyncGetTenant { + + public static void main(String[] args) throws Exception { + syncGetTenant(); + } + + public static void syncGetTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + GetTenantRequest request = + GetTenantRequest.newBuilder() + .setName(TenantName.of("[PROJECT]", "[TENANT]").toString()) + .build(); + Tenant response = tenantServiceClient.getTenant(request); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_gettenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/SyncGetTenantString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/SyncGetTenantString.java new file mode 100644 index 00000000000..895b542b3be --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/SyncGetTenantString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_gettenant_string_sync] +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.cloud.talent.v4beta1.TenantServiceClient; + +public class SyncGetTenantString { + + public static void main(String[] args) throws Exception { + syncGetTenantString(); + } + + public static void syncGetTenantString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + String name = TenantName.of("[PROJECT]", "[TENANT]").toString(); + Tenant response = tenantServiceClient.getTenant(name); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_gettenant_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/SyncGetTenantTenantname.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/SyncGetTenantTenantname.java new file mode 100644 index 00000000000..1a88ce88eac --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/gettenant/SyncGetTenantTenantname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_gettenant_tenantname_sync] +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantName; +import com.google.cloud.talent.v4beta1.TenantServiceClient; + +public class SyncGetTenantTenantname { + + public static void main(String[] args) throws Exception { + syncGetTenantTenantname(); + } + + public static void syncGetTenantTenantname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + TenantName name = TenantName.of("[PROJECT]", "[TENANT]"); + Tenant response = tenantServiceClient.getTenant(name); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_gettenant_tenantname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/AsyncListTenants.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/AsyncListTenants.java new file mode 100644 index 00000000000..35d7128fbe5 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/AsyncListTenants.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_listtenants_async] +import com.google.api.core.ApiFuture; +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 class AsyncListTenants { + + public static void main(String[] args) throws Exception { + asyncListTenants(); + } + + public static void asyncListTenants() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ListTenantsRequest request = + ListTenantsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + ApiFuture future = tenantServiceClient.listTenantsPagedCallable().futureCall(request); + // Do something. + for (Tenant element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_listtenants_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/AsyncListTenantsPaged.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/AsyncListTenantsPaged.java new file mode 100644 index 00000000000..f7e299d8b4d --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/AsyncListTenantsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_listtenants_paged_async] +import com.google.cloud.talent.v4beta1.ListTenantsRequest; +import com.google.cloud.talent.v4beta1.ListTenantsResponse; +import com.google.cloud.talent.v4beta1.ProjectName; +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.common.base.Strings; + +public class AsyncListTenantsPaged { + + public static void main(String[] args) throws Exception { + asyncListTenantsPaged(); + } + + public static void asyncListTenantsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ListTenantsRequest request = + ListTenantsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + while (true) { + ListTenantsResponse response = tenantServiceClient.listTenantsCallable().call(request); + for (Tenant element : response.getTenantsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_listtenants_paged_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/SyncListTenants.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/SyncListTenants.java new file mode 100644 index 00000000000..14ea2dce76f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/SyncListTenants.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_listtenants_sync] +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 class SyncListTenants { + + public static void main(String[] args) throws Exception { + syncListTenants(); + } + + public static void syncListTenants() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ListTenantsRequest request = + ListTenantsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageToken("pageToken873572522") + .setPageSize(883849137) + .build(); + for (Tenant element : tenantServiceClient.listTenants(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_listtenants_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/SyncListTenantsProjectname.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/SyncListTenantsProjectname.java new file mode 100644 index 00000000000..55c6af42446 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/SyncListTenantsProjectname.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_listtenants_projectname_sync] +import com.google.cloud.talent.v4beta1.ProjectName; +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantServiceClient; + +public class SyncListTenantsProjectname { + + public static void main(String[] args) throws Exception { + syncListTenantsProjectname(); + } + + public static void syncListTenantsProjectname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (Tenant element : tenantServiceClient.listTenants(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_listtenants_projectname_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/SyncListTenantsString.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/SyncListTenantsString.java new file mode 100644 index 00000000000..2c966668808 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/listtenants/SyncListTenantsString.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_listtenants_string_sync] +import com.google.cloud.talent.v4beta1.ProjectName; +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantServiceClient; + +public class SyncListTenantsString { + + public static void main(String[] args) throws Exception { + syncListTenantsString(); + } + + public static void syncListTenantsString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + for (Tenant element : tenantServiceClient.listTenants(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_listtenants_string_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/updatetenant/AsyncUpdateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/updatetenant/AsyncUpdateTenant.java new file mode 100644 index 00000000000..447f225c7f4 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/updatetenant/AsyncUpdateTenant.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_updatetenant_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.cloud.talent.v4beta1.UpdateTenantRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTenant { + + public static void main(String[] args) throws Exception { + asyncUpdateTenant(); + } + + public static void asyncUpdateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + UpdateTenantRequest request = + UpdateTenantRequest.newBuilder() + .setTenant(Tenant.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = tenantServiceClient.updateTenantCallable().futureCall(request); + // Do something. + Tenant response = future.get(); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_updatetenant_async] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/updatetenant/SyncUpdateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/updatetenant/SyncUpdateTenant.java new file mode 100644 index 00000000000..ff50a33c1ed --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/updatetenant/SyncUpdateTenant.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_updatetenant_sync] +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantServiceClient; +import com.google.cloud.talent.v4beta1.UpdateTenantRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTenant { + + public static void main(String[] args) throws Exception { + syncUpdateTenant(); + } + + public static void syncUpdateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + UpdateTenantRequest request = + UpdateTenantRequest.newBuilder() + .setTenant(Tenant.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Tenant response = tenantServiceClient.updateTenant(request); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_updatetenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/updatetenant/SyncUpdateTenantTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/updatetenant/SyncUpdateTenantTenant.java new file mode 100644 index 00000000000..722ec2fe62f --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantserviceclient/updatetenant/SyncUpdateTenantTenant.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantserviceclient_updatetenant_tenant_sync] +import com.google.cloud.talent.v4beta1.Tenant; +import com.google.cloud.talent.v4beta1.TenantServiceClient; + +public class SyncUpdateTenantTenant { + + public static void main(String[] args) throws Exception { + syncUpdateTenantTenant(); + } + + public static void syncUpdateTenantTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { + Tenant tenant = Tenant.newBuilder().build(); + Tenant response = tenantServiceClient.updateTenant(tenant); + } + } +} +// [END talent_v4beta1_generated_tenantserviceclient_updatetenant_tenant_sync] diff --git a/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantservicesettings/createtenant/SyncCreateTenant.java b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantservicesettings/createtenant/SyncCreateTenant.java new file mode 100644 index 00000000000..d700f9a7571 --- /dev/null +++ b/talent/snippets/generated/com/google/cloud/talent/v4beta1/tenantservicesettings/createtenant/SyncCreateTenant.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.talent.v4beta1.samples; + +// [START talent_v4beta1_generated_tenantservicesettings_createtenant_sync] +import com.google.cloud.talent.v4beta1.TenantServiceSettings; +import java.time.Duration; + +public class SyncCreateTenant { + + public static void main(String[] args) throws Exception { + syncCreateTenant(); + } + + public static void syncCreateTenant() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TenantServiceSettings.Builder tenantServiceSettingsBuilder = TenantServiceSettings.newBuilder(); + tenantServiceSettingsBuilder + .createTenantSettings() + .setRetrySettings( + tenantServiceSettingsBuilder.createTenantSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TenantServiceSettings tenantServiceSettings = tenantServiceSettingsBuilder.build(); + } +} +// [END talent_v4beta1_generated_tenantservicesettings_createtenant_sync] diff --git a/talent/snippets/pom.xml b/talent/snippets/pom.xml new file mode 100644 index 00000000000..595ff8afa73 --- /dev/null +++ b/talent/snippets/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + com.google.cloud + talent-snippets + jar + Google Talent Solution Snippets + https://github.com/googleapis/java-talent + + + + com.google.cloud.samples + shared-configuration + 1.2.0 + + + + 1.8 + 1.8 + UTF-8 + + + + + + + + com.google.cloud + libraries-bom + 26.1.4 + pom + import + + + + + + + com.google.cloud + google-cloud-talent + + + + + junit + junit + 4.13.2 + test + + + com.google.truth + truth + 1.1.3 + test + + + diff --git a/talent/snippets/src/main/java/com/example/jobs/CommuteSearchJobs.java b/talent/snippets/src/main/java/com/example/jobs/CommuteSearchJobs.java new file mode 100644 index 00000000000..3218faac986 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/CommuteSearchJobs.java @@ -0,0 +1,95 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_commute_search] + +import com.google.cloud.talent.v4.CommuteFilter; +import com.google.cloud.talent.v4.CommuteMethod; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobQuery; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.RequestMetadata; +import com.google.cloud.talent.v4.SearchJobsRequest; +import com.google.cloud.talent.v4.SearchJobsResponse; +import com.google.cloud.talent.v4.TenantName; +import com.google.protobuf.Duration; +import com.google.type.LatLng; +import java.io.IOException; + +public class CommuteSearchJobs { + + public static void searchJobs() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + searchJobs(projectId, tenantId); + } + + // Search Jobs with histogram queries. + public static void searchJobs(String projectId, String tenantId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName 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.DRIVING; + long seconds = 3600L; + 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).getMatchingJobsList()) { + System.out.format("Job summary: %s%n", responseItem.getJobSummary()); + System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet()); + Job job = responseItem.getJob(); + System.out.format("Job name: %s%n", job.getName()); + System.out.format("Job title: %s%n", job.getTitle()); + } + } + } +} +// [END job_search_commute_search] diff --git a/talent/snippets/src/main/java/com/example/jobs/CustomRankingSearchJobs.java b/talent/snippets/src/main/java/com/example/jobs/CustomRankingSearchJobs.java new file mode 100644 index 00000000000..cf0e95d4448 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/CustomRankingSearchJobs.java @@ -0,0 +1,81 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_custom_ranking_search] + +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.RequestMetadata; +import com.google.cloud.talent.v4.SearchJobsRequest; +import com.google.cloud.talent.v4.SearchJobsResponse; +import com.google.cloud.talent.v4.TenantName; +import java.io.IOException; + +public class CustomRankingSearchJobs { + + public static void searchCustomRankingJobs() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + searchCustomRankingJobs(projectId, tenantId); + } + + // Search Jobs using custom rankings. + public static void searchCustomRankingJobs(String projectId, String tenantId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName 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).getMatchingJobsList()) { + System.out.format("Job summary: %s%n", responseItem.getJobSummary()); + System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet()); + Job job = responseItem.getJob(); + System.out.format("Job name: %s%n", job.getName()); + System.out.format("Job title: %s%n", job.getTitle()); + } + } + } +} +// [END job_search_custom_ranking_search] diff --git a/talent/snippets/src/main/java/com/example/jobs/HistogramSearchJobs.java b/talent/snippets/src/main/java/com/example/jobs/HistogramSearchJobs.java new file mode 100644 index 00000000000..5f6bde45f11 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/HistogramSearchJobs.java @@ -0,0 +1,78 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_histogram_search] + +import com.google.cloud.talent.v4.HistogramQuery; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.RequestMetadata; +import com.google.cloud.talent.v4.SearchJobsRequest; +import com.google.cloud.talent.v4.SearchJobsResponse; +import com.google.cloud.talent.v4.TenantName; +import java.io.IOException; + +public class HistogramSearchJobs { + + public static void searchJobs() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String query = "count(base_compensation, [bucket(12, 20)])"; + searchJobs(projectId, tenantId, query); + } + + // Search Jobs with histogram queries. + public static void searchJobs(String projectId, String tenantId, String query) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of(projectId, tenantId); + + String domain = "http://www.jobUrl.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(); + SearchJobsRequest request = + SearchJobsRequest.newBuilder() + .setParent(parent.toString()) + .setRequestMetadata(requestMetadata) + .addHistogramQueries(histogramQueriesElement) + .build(); + + for (SearchJobsResponse.MatchingJob responseItem : + jobServiceClient.searchJobs(request).getMatchingJobsList()) { + System.out.format("Job summary: %s%n", responseItem.getJobSummary()); + System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet()); + Job job = responseItem.getJob(); + System.out.format("Job name: %s%n", job.getName()); + System.out.format("Job title: %s%n", job.getTitle()); + } + } + } +} +// [END job_search_histogram_search] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchAutoCompleteJobTitle.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchAutoCompleteJobTitle.java new file mode 100644 index 00000000000..321e416d0f9 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchAutoCompleteJobTitle.java @@ -0,0 +1,61 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_autocomplete_job_title] + +import com.google.cloud.talent.v4.CompleteQueryRequest; +import com.google.cloud.talent.v4.CompleteQueryResponse; +import com.google.cloud.talent.v4.CompletionClient; +import com.google.cloud.talent.v4.TenantName; +import java.io.IOException; + +public class JobSearchAutoCompleteJobTitle { + + public static void completeQuery() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String query = "your-query-for-job-title"; + completeQuery(projectId, tenantId, query); + } + + // Complete job title given partial text (autocomplete). + public static void completeQuery(String projectId, String tenantId, String query) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (CompletionClient completionClient = CompletionClient.create()) { + TenantName parent = TenantName.of(projectId, tenantId); + CompleteQueryRequest request = + CompleteQueryRequest.newBuilder() + .setTenant(parent.toString()) + .setQuery(query) + .setPageSize(5) // limit for number of results + .addLanguageCodes("en-US") // language code + .build(); + CompleteQueryResponse response = completionClient.completeQuery(request); + for (CompleteQueryResponse.CompletionResult result : response.getCompletionResultsList()) { + System.out.format("Suggested title: %s%n", result.getSuggestion()); + // Suggestion type is JOB_TITLE or COMPANY_TITLE + System.out.format("Suggestion type: %s%n", result.getType()); + } + } + } +} +// [END job_search_autocomplete_job_title] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateClientEvent.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateClientEvent.java new file mode 100644 index 00000000000..a8273ae5b1f --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateClientEvent.java @@ -0,0 +1,85 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_create_client_event] + +import com.google.cloud.talent.v4.ClientEvent; +import com.google.cloud.talent.v4.CreateClientEventRequest; +import com.google.cloud.talent.v4.EventServiceClient; +import com.google.cloud.talent.v4.JobEvent; +import com.google.cloud.talent.v4.TenantName; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +public class JobSearchCreateClientEvent { + + public static void createClientEvent() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String requestId = "your-req-id-from-response-metadata"; + String eventId = "your-unique-identifier-id"; + createClientEvent(projectId, tenantId, requestId, eventId); + } + + // Creates a client event. + public static void createClientEvent( + String projectId, String tenantId, String requestId, String eventId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (EventServiceClient eventServiceClient = EventServiceClient.create()) { + TenantName 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 = 3L; + 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. "); + System.out.println(response.toString()); + } + } +} +// [END job_search_create_client_event] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateCompany.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateCompany.java new file mode 100644 index 00000000000..587c48e459f --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateCompany.java @@ -0,0 +1,63 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_create_company_beta] + +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.CreateCompanyRequest; +import com.google.cloud.talent.v4.TenantName; +import java.io.IOException; + +public class JobSearchCreateCompany { + + public static void createCompany() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String displayName = "your-company-display-name"; + String externalId = "your-external-id"; + createCompany(projectId, tenantId, displayName, externalId); + } + + // Create a company. + public static void createCompany( + String projectId, String tenantId, String displayName, String externalId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + TenantName 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.format("Name: %s%n", response.getName()); + System.out.format("Display Name: %s%n", response.getDisplayName()); + System.out.format("External ID: %s%n", response.getExternalId()); + } + } +} +// [END job_search_create_company_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateJob.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateJob.java new file mode 100644 index 00000000000..af2dad8e62c --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateJob.java @@ -0,0 +1,88 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_create_job_beta] + +import com.google.cloud.talent.v4.CreateJobRequest; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +public class JobSearchCreateJob { + + public static void createJob() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String companyId = "your-company-id"; + String requisitionId = "your-unique-req-id"; + String jobApplicationUrl = "your-job-url"; + // String projectId = "me-qa-1"; + // String tenantId = "8ed97629-27ee-4215-909b-18cfe3b7e8e3"; + // String companyId = "05317758-b30e-4b26-a57d-d9e54e4cccd8"; + // String requisitionId = "test-requisitionid-1"; + // String jobApplicationUrl = "http://job.url"; + createJob(projectId, tenantId, companyId, requisitionId, jobApplicationUrl); + } + + // Create a job. + public static void createJob( + String projectId, + String tenantId, + String companyId, + String requisitionId, + String jobApplicationUrl) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of(projectId, tenantId); + Job.ApplicationInfo applicationInfo = + Job.ApplicationInfo.newBuilder().addUris(jobApplicationUrl).build(); + + List addresses = + Arrays.asList( + "1600 Amphitheatre Parkway, Mountain View, CA 94043", + "111 8th Avenue, New York, NY 10011"); + + // By default, job will expire in 30 days. + // https://cloud.google.com/talent-solution/job-search/docs/jobs + Job job = + Job.newBuilder() + .setCompany(companyId) + .setRequisitionId(requisitionId) + .setTitle("Software Developer") + .setDescription("Develop, maintain the software solutions.") + .setApplicationInfo(applicationInfo) + .addAllAddresses(addresses) + .setLanguageCode("en-US") + .build(); + + CreateJobRequest request = + CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build(); + + Job response = jobServiceClient.createJob(request); + System.out.format("Created job: %s%n", response.getName()); + } + } +} +// [END job_search_create_job_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java new file mode 100644 index 00000000000..7e79d55a0e2 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_create_job_custom_attributes] + +import com.google.cloud.talent.v4.CreateJobRequest; +import com.google.cloud.talent.v4.CustomAttribute; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.TenantName; +import java.io.IOException; + +public class JobSearchCreateJobCustomAttributes { + + public static void createJob() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String companyId = "your-company-id"; + String requisitionId = "your-unique-req-id"; + createJob(projectId, tenantId, companyId, requisitionId); + } + + // Create Job with Custom Attributes. + public static void createJob( + String projectId, String tenantId, String companyId, String requisitionId) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of(projectId, tenantId); + + // Custom attribute can be string or numeric value, and can be filtered in search queries. + // https://cloud.google.com/talent-solution/job-search/docs/custom-attributes + CustomAttribute customAttribute = + CustomAttribute.newBuilder() + .addStringValues("Internship") + .addStringValues("Apprenticeship") + .setFilterable(true) + .build(); + + Job job = + Job.newBuilder() + .setCompany(companyId) + .setTitle("Software Developer I") + .setDescription("This is a description of this wonderful job!") + .putCustomAttributes("FOR_STUDENTS", customAttribute) + .setRequisitionId(requisitionId) + .setLanguageCode("en-US") + .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()); + } + } +} +// [END job_search_create_job_custom_attributes] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateTenant.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateTenant.java new file mode 100644 index 00000000000..abcab4a9d69 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchCreateTenant.java @@ -0,0 +1,55 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_create_tenant_beta] + +import com.google.cloud.talent.v4.CreateTenantRequest; +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; +import java.io.IOException; + +public class JobSearchCreateTenant { + + public static void createTenant() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String externalId = "your-external-id"; + createTenant(projectId, externalId); + } + + // Create Tenant for scoping resources, e.g. companies and jobs. + public static void createTenant(String projectId, String externalId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + 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.format("Name: %s%n", response.getName()); + System.out.format("External ID: %s%n", response.getExternalId()); + } + } +} +// [END job_search_create_tenant_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchDeleteCompany.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchDeleteCompany.java new file mode 100644 index 00000000000..5472de65566 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchDeleteCompany.java @@ -0,0 +1,53 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_delete_company_beta] + +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.DeleteCompanyRequest; +import java.io.IOException; + +public class JobSearchDeleteCompany { + + public static void deleteCompany() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String companyId = "your-company-id"; + deleteCompany(projectId, tenantId, companyId); + } + + // Delete Company. + public static void deleteCompany(String projectId, String tenantId, String companyId) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CompanyName name = CompanyName.of(projectId, tenantId, companyId); + + DeleteCompanyRequest request = + DeleteCompanyRequest.newBuilder().setName(name.toString()).build(); + + companyServiceClient.deleteCompany(request); + System.out.println("Deleted company"); + } + } +} +// [END job_search_delete_company_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchDeleteJob.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchDeleteJob.java new file mode 100644 index 00000000000..9603f1630c3 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchDeleteJob.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_delete_job_beta] + +import com.google.cloud.talent.v4.DeleteJobRequest; +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; +import java.io.IOException; + +public class JobSearchDeleteJob { + + public static void deleteJob() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String jobId = "your-job-id"; + deleteJob(projectId, tenantId, jobId); + } + + // Delete Job. + public static void deleteJob(String projectId, String tenantId, String jobId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + JobName name = JobName.of(projectId, tenantId, jobId); + + DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build(); + + jobServiceClient.deleteJob(request); + System.out.println("Deleted job."); + } + } +} +// [END job_search_delete_job_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchDeleteTenant.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchDeleteTenant.java new file mode 100644 index 00000000000..d7f949f49cd --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchDeleteTenant.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_delete_tenant_beta] + +import com.google.cloud.talent.v4.DeleteTenantRequest; +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; +import java.io.IOException; + +public class JobSearchDeleteTenant { + + public static void deleteTenant() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + deleteTenant(projectId, tenantId); + } + + // Delete Tenant. + public static void deleteTenant(String projectId, String tenantId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + 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."); + } + } +} +// [END job_search_delete_tenant_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchGetCompany.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchGetCompany.java new file mode 100644 index 00000000000..9a4da2d076e --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchGetCompany.java @@ -0,0 +1,54 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_get_company_beta] + +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyName; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.GetCompanyRequest; +import java.io.IOException; + +public class JobSearchGetCompany { + + public static void getCompany() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String companyId = "your-company-id"; + getCompany(projectId, tenantId, companyId); + } + + // Get Company. + public static void getCompany(String projectId, String tenantId, String companyId) + throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + CompanyName name = CompanyName.of(projectId, tenantId, companyId); + + GetCompanyRequest request = GetCompanyRequest.newBuilder().setName(name.toString()).build(); + + Company response = companyServiceClient.getCompany(request); + System.out.format("Company name: %s%n", response.getName()); + System.out.format("Display name: %s%n", response.getDisplayName()); + } + } +} +// [END job_search_get_company_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchGetJob.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchGetJob.java new file mode 100644 index 00000000000..0314f149406 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchGetJob.java @@ -0,0 +1,65 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_get_job_beta] + +import com.google.cloud.talent.v4.GetJobRequest; +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobName; +import com.google.cloud.talent.v4.JobServiceClient; +import java.io.IOException; + +public class JobSearchGetJob { + + public static void getJob() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String jobId = "your-job-id"; + getJob(projectId, tenantId, jobId); + } + + // Get Job. + public static void getJob(String projectId, String tenantId, String jobId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + JobName name = JobName.of(projectId, tenantId, jobId); + + GetJobRequest request = GetJobRequest.newBuilder().setName(name.toString()).build(); + + Job response = jobServiceClient.getJob(request); + System.out.format("Job name: %s%n", response.getName()); + System.out.format("Requisition ID: %s%n", response.getRequisitionId()); + System.out.format("Title: %s%n", response.getTitle()); + System.out.format("Description: %s%n", response.getDescription()); + System.out.format("Posting language: %s%n", response.getLanguageCode()); + for (String address : response.getAddressesList()) { + System.out.format("Address: %s%n", address); + } + for (String email : response.getApplicationInfo().getEmailsList()) { + System.out.format("Email: %s%n", email); + } + for (String websiteUri : response.getApplicationInfo().getUrisList()) { + System.out.format("Website: %s%n", websiteUri); + } + } + } +} +// [END job_search_get_job_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchGetTenant.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchGetTenant.java new file mode 100644 index 00000000000..c91631046dd --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchGetTenant.java @@ -0,0 +1,52 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_get_tenant_beta] + +import com.google.cloud.talent.v4.GetTenantRequest; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantName; +import com.google.cloud.talent.v4.TenantServiceClient; +import java.io.IOException; + +public class JobSearchGetTenant { + + public static void getTenant() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + getTenant(projectId, tenantId); + } + + // Get Tenant by name. + public static void getTenant(String projectId, String tenantId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + 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.format("Name: %s%n", response.getName()); + System.out.format("External ID: %s%n", response.getExternalId()); + } + } +} +// [END job_search_get_tenant_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchListCompanies.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchListCompanies.java new file mode 100644 index 00000000000..0313045fdb0 --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchListCompanies.java @@ -0,0 +1,55 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_list_companies_beta] + +import com.google.cloud.talent.v4.Company; +import com.google.cloud.talent.v4.CompanyServiceClient; +import com.google.cloud.talent.v4.ListCompaniesRequest; +import com.google.cloud.talent.v4.TenantName; +import java.io.IOException; + +public class JobSearchListCompanies { + + public static void listCompanies() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + listCompanies(projectId, tenantId); + } + + // List Companies. + public static void listCompanies(String projectId, String tenantId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { + TenantName parent = TenantName.of(projectId, tenantId); + + ListCompaniesRequest request = + ListCompaniesRequest.newBuilder().setParent(parent.toString()).build(); + + for (Company responseItem : companyServiceClient.listCompanies(request).iterateAll()) { + System.out.format("Company Name: %s%n", responseItem.getName()); + System.out.format("Display Name: %s%n", responseItem.getDisplayName()); + System.out.format("External ID: %s%n", responseItem.getExternalId()); + } + } + } +} +// [END job_search_list_companies_beta] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchListJobs.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchListJobs.java new file mode 100644 index 00000000000..9fe1bbc85ab --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchListJobs.java @@ -0,0 +1,55 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_list_jobs] + +import com.google.cloud.talent.v4.Job; +import com.google.cloud.talent.v4.JobServiceClient; +import com.google.cloud.talent.v4.ListJobsRequest; +import com.google.cloud.talent.v4.TenantName; +import java.io.IOException; + +public class JobSearchListJobs { + + public static void listJobs() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + String tenantId = "your-tenant-id"; + String query = "count(base_compensation, [bucket(12, 20)])"; + listJobs(projectId, tenantId, query); + } + + // Search Jobs with histogram queries. + public static void listJobs(String projectId, String tenantId, String filter) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + try (JobServiceClient jobServiceClient = JobServiceClient.create()) { + TenantName parent = TenantName.of(projectId, tenantId); + ListJobsRequest request = + ListJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build(); + for (Job responseItem : jobServiceClient.listJobs(request).iterateAll()) { + System.out.format("Job name: %s%n", responseItem.getName()); + System.out.format("Job requisition ID: %s%n", responseItem.getRequisitionId()); + System.out.format("Job title: %s%n", responseItem.getTitle()); + System.out.format("Job description: %s%n", responseItem.getDescription()); + } + } + } +} +// [END job_search_list_jobs] diff --git a/talent/snippets/src/main/java/com/example/jobs/JobSearchListTenants.java b/talent/snippets/src/main/java/com/example/jobs/JobSearchListTenants.java new file mode 100644 index 00000000000..d71191f08cc --- /dev/null +++ b/talent/snippets/src/main/java/com/example/jobs/JobSearchListTenants.java @@ -0,0 +1,53 @@ +/* + * 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 + * + * http://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.example.jobs; + +// [START job_search_list_tenants_beta] + +import com.google.cloud.talent.v4.ListTenantsRequest; +import com.google.cloud.talent.v4.ProjectName; +import com.google.cloud.talent.v4.Tenant; +import com.google.cloud.talent.v4.TenantServiceClient; +import java.io.IOException; + +public class JobSearchListTenants { + + public static void listTenants() throws IOException { + // TODO(developer): Replace these variables before running the sample. + String projectId = "your-project-id"; + listTenants(projectId); + } + + // List Tenants. + public static void listTenants(String projectId) throws IOException { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. After completing all of your requests, call + // the "close" method on the client to safely clean up any remaining background resources. + 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.format("Tenant Name: %s%n", responseItem.getName()); + System.out.format("External ID: %s%n", responseItem.getExternalId()); + } + } + } +} +// [END job_search_list_tenants_beta] diff --git a/talent/snippets/src/test/java/CommuteSearchJobsTest.java b/talent/snippets/src/test/java/CommuteSearchJobsTest.java new file mode 100644 index 00000000000..15836240753 --- /dev/null +++ b/talent/snippets/src/test/java/CommuteSearchJobsTest.java @@ -0,0 +1,55 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.CommuteSearchJobs; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CommuteSearchJobsTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testCommuteSearchJobs() throws IOException { + // retrieve a job. + CommuteSearchJobs.searchJobs(PROJECT_ID, TENANT_ID); + String got = bout.toString(); + + assertThat(got).contains("Job summary:"); + assertThat(got).contains("Job title snippet:"); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/CustomRankingSearchJobsTest.java b/talent/snippets/src/test/java/CustomRankingSearchJobsTest.java new file mode 100644 index 00000000000..2f5aa257e2b --- /dev/null +++ b/talent/snippets/src/test/java/CustomRankingSearchJobsTest.java @@ -0,0 +1,56 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.CustomRankingSearchJobs; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomRankingSearchJobsTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testCustomRankingSearchJobs() throws IOException { + // retrieve a job. + CustomRankingSearchJobs.searchCustomRankingJobs(PROJECT_ID, TENANT_ID); + String got = bout.toString(); + + assertThat(got).contains("Job summary:"); + assertThat(got).contains("Job title snippet:"); + assertThat(got).contains("Job title:"); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/HistogramSearchJobsTest.java b/talent/snippets/src/test/java/HistogramSearchJobsTest.java new file mode 100644 index 00000000000..8e2b7b043af --- /dev/null +++ b/talent/snippets/src/test/java/HistogramSearchJobsTest.java @@ -0,0 +1,55 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.HistogramSearchJobs; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class HistogramSearchJobsTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testHistogramSearch() throws IOException { + // retrieve a job. + HistogramSearchJobs.searchJobs( + PROJECT_ID, TENANT_ID, "count(base_compensation, [bucket(12, 20)])"); + String got = bout.toString(); + assertThat(got).contains("Job summary:"); + assertThat(got).contains("Job title snippet:"); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchAutoCompleteJobTitleTest.java b/talent/snippets/src/test/java/JobSearchAutoCompleteJobTitleTest.java new file mode 100644 index 00000000000..61b36650278 --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchAutoCompleteJobTitleTest.java @@ -0,0 +1,54 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchAutoCompleteJobTitle; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchAutoCompleteJobTitleTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testAutoCompleteJobTitle() throws IOException { + // retrieve a tenant. + JobSearchAutoCompleteJobTitle.completeQuery(PROJECT_ID, TENANT_ID, "Developer Program"); + String got = bout.toString(); + assertThat(got).contains("Suggested title:"); + assertThat(got).contains("Suggestion type:"); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchCreateCompanyTest.java b/talent/snippets/src/test/java/JobSearchCreateCompanyTest.java new file mode 100644 index 00000000000..325e1af44ca --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchCreateCompanyTest.java @@ -0,0 +1,64 @@ +/* + * 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 + * + * http://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. + */ +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchCreateCompany; +import com.example.jobs.JobSearchDeleteCompany; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchCreateCompanyTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + + private static final String COMPANY_EXT_ID = + String.format("COMP_EXT_ID_%s", UUID.randomUUID().toString().substring(0, 20)); + private static final String COMPANY_DISPLAY_NAME = "DO_NOT_DELETE_COMPANY"; + + private String companyId; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testCreateCompany() throws IOException { + // retrieve a tenant. + JobSearchCreateCompany.createCompany( + PROJECT_ID, TENANT_ID, COMPANY_DISPLAY_NAME, COMPANY_EXT_ID); + String got = bout.toString(); + assertThat(got).contains("Created Company"); + + companyId = JobSearchGetJobTest.extractLastId(got.split("\n")[1]); + } + + @After + public void tearDown() throws IOException { + // delete that job. + JobSearchDeleteCompany.deleteCompany(PROJECT_ID, TENANT_ID, companyId); + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchCreateJobTest.java b/talent/snippets/src/test/java/JobSearchCreateJobTest.java new file mode 100644 index 00000000000..c53cf1b55a8 --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchCreateJobTest.java @@ -0,0 +1,72 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchCreateJob; +import com.example.jobs.JobSearchDeleteJob; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchCreateJobTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); + private static final String POST_UNIQUE_ID = + String.format( + "TEST_POST_ID_%s", + UUID.randomUUID().toString().substring(0, 20)); // Posting ID. Unique per job. + + private String jobId; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testCreateJob() throws IOException { + // create a job. + JobSearchCreateJob.createJob( + PROJECT_ID, TENANT_ID, COMPANY_ID, POST_UNIQUE_ID, "http://www.jobUrl.com"); + String got = bout.toString(); + + assertThat(got).contains("Created job:"); + jobId = JobSearchGetJobTest.extractLastId(got.split("\n")[0].trim()); + + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() throws IOException { + // delete that job. + JobSearchDeleteJob.deleteJob(PROJECT_ID, TENANT_ID, jobId); + String got = bout.toString(); + assertThat(got).contains("Deleted job"); + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchCreateJobWithCustomAttrTest.java b/talent/snippets/src/test/java/JobSearchCreateJobWithCustomAttrTest.java new file mode 100644 index 00000000000..0671921b78e --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchCreateJobWithCustomAttrTest.java @@ -0,0 +1,71 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchCreateJobCustomAttributes; +import com.example.jobs.JobSearchDeleteJob; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchCreateJobWithCustomAttrTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); + private static final String POST_UNIQUE_ID = + String.format( + "TEST_POST_ID_%s", + UUID.randomUUID().toString().substring(0, 20)); // Posting ID. Unique per job. + + private String jobId; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testCreateJob() throws IOException { + // create a job with custom attributes. + JobSearchCreateJobCustomAttributes.createJob(PROJECT_ID, TENANT_ID, COMPANY_ID, POST_UNIQUE_ID); + String got = bout.toString(); + + assertThat(got).contains("Created job:"); + jobId = JobSearchGetJobTest.extractLastId(got.split("\n")[0].trim()); + + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() throws IOException { + // delete that job. + JobSearchDeleteJob.deleteJob(PROJECT_ID, TENANT_ID, jobId); + String got = bout.toString(); + assertThat(got).contains("Deleted job"); + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchCreateTenantTest.java b/talent/snippets/src/test/java/JobSearchCreateTenantTest.java new file mode 100644 index 00000000000..fdbe993233f --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchCreateTenantTest.java @@ -0,0 +1,63 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchCreateTenant; +import com.example.jobs.JobSearchDeleteTenant; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchCreateTenantTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_EXT_ID = + String.format("EXTERNAL_TEMP_TENANT_ID_%s", UUID.randomUUID().toString().substring(0, 20)); + + private String tenantId; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testCreateTenant() throws IOException { + // create a tenant. + JobSearchCreateTenant.createTenant(PROJECT_ID, TENANT_EXT_ID); + + String got = bout.toString(); + assertThat(got).contains("Created Tenant"); + + tenantId = JobSearchGetJobTest.extractLastId(got.split("\n")[1]); + } + + @After + public void tearDown() throws IOException { + + // clean up. + JobSearchDeleteTenant.deleteTenant(PROJECT_ID, tenantId); + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchDeleteCompanyTest.java b/talent/snippets/src/test/java/JobSearchDeleteCompanyTest.java new file mode 100644 index 00000000000..a321d80e0e6 --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchDeleteCompanyTest.java @@ -0,0 +1,68 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchCreateCompany; +import com.example.jobs.JobSearchDeleteCompany; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchDeleteCompanyTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + + private static final String COMPANY_EXT_ID = + String.format("COMP_EXT_ID_%s", UUID.randomUUID().toString().substring(0, 20)); + private static final String COMPANY_DISPLAY_NAME = "DO_NOT_DELETE_COMPANY"; + + private String companyId; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + + // create a company + JobSearchCreateCompany.createCompany( + PROJECT_ID, TENANT_ID, COMPANY_DISPLAY_NAME, COMPANY_EXT_ID); + String got = bout.toString(); + assertThat(got).contains("Created Company"); + + companyId = JobSearchGetJobTest.extractLastId(got.split("\n")[1]); + } + + @Test + public void testDeleteCompany() throws IOException { + // retrieve a tenant. + JobSearchDeleteCompany.deleteCompany(PROJECT_ID, TENANT_ID, companyId); + String got = bout.toString(); + assertThat(got).contains("Deleted company"); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchDeleteJobTest.java b/talent/snippets/src/test/java/JobSearchDeleteJobTest.java new file mode 100644 index 00000000000..7896a43d808 --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchDeleteJobTest.java @@ -0,0 +1,73 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchCreateJob; +import com.example.jobs.JobSearchDeleteJob; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchDeleteJobTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); + private static final String POST_UNIQUE_ID = + String.format( + "TEST_POST_ID_%s", + UUID.randomUUID().toString().substring(0, 20)); // Posting ID. Unique per job. + + private String jobId; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + + JobSearchCreateJob.createJob( + PROJECT_ID, TENANT_ID, COMPANY_ID, POST_UNIQUE_ID, "http://www.jobUrl.com"); + + String got = bout.toString(); + assertThat(got).contains("Created job:"); + jobId = JobSearchGetJobTest.extractLastId(got.split("\n")[0].trim()); + + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @Test + public void testDeleteJob() throws IOException { + // delete a job. + JobSearchDeleteJob.deleteJob(PROJECT_ID, TENANT_ID, jobId); + String got = bout.toString(); + + assertThat(got).contains("Deleted job"); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchDeleteTenantTest.java b/talent/snippets/src/test/java/JobSearchDeleteTenantTest.java new file mode 100644 index 00000000000..5f2b1867572 --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchDeleteTenantTest.java @@ -0,0 +1,65 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchCreateTenant; +import com.example.jobs.JobSearchDeleteTenant; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.UUID; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchDeleteTenantTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_EXT_ID = + String.format("EXTERNAL_TEMP_TENANT_ID_%s", UUID.randomUUID().toString().substring(0, 20)); + private String tenantId; + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + + // create a tenant for job and company + JobSearchCreateTenant.createTenant(PROJECT_ID, TENANT_EXT_ID); + + String got = bout.toString(); + assertThat(got).contains("Created Tenant"); + + tenantId = JobSearchGetJobTest.extractLastId(got.split("\n")[1]); + } + + @Test + public void testDeleteTenantTest() throws IOException { + // delete a tenant. + JobSearchDeleteTenant.deleteTenant(PROJECT_ID, tenantId); + String got = bout.toString(); + assertThat(got).contains("Deleted Tenant."); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchGetCompanyTest.java b/talent/snippets/src/test/java/JobSearchGetCompanyTest.java new file mode 100644 index 00000000000..95d915bd7d1 --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchGetCompanyTest.java @@ -0,0 +1,55 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchGetCompany; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchGetCompanyTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testGetCompany() throws IOException { + // retrieve a tenant. + JobSearchGetCompany.getCompany(PROJECT_ID, TENANT_ID, COMPANY_ID); + String got = bout.toString(); + assertThat(got).contains("Company name:"); + assertThat(got).contains("Display name:"); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchGetJobTest.java b/talent/snippets/src/test/java/JobSearchGetJobTest.java new file mode 100644 index 00000000000..ad1b9501653 --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchGetJobTest.java @@ -0,0 +1,63 @@ +/* + * 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 + * + * http://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. + */ +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchGetJob; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchGetJobTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + private static final String JOB_ID = System.getenv("CTS_GET_JOB_ID"); + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testGetJob() throws IOException { + // retrieve a job. + JobSearchGetJob.getJob(PROJECT_ID, TENANT_ID, JOB_ID); + String got = bout.toString(); + assertThat(got).contains("Job name: "); + assertThat(got).contains("Website:"); + } + + @After + public void tearDown() { + System.setOut(out); + } + + // Helper method for getting the last id from the full path. + public static String extractLastId(String fullPath) { + if (fullPath == null || fullPath.length() < 1 || !fullPath.contains("/")) { + throw new IllegalArgumentException("Not valid path"); + } + String[] parts = fullPath.split("/"); + return parts[parts.length - 1]; + } +} diff --git a/talent/snippets/src/test/java/JobSearchGetTenantTest.java b/talent/snippets/src/test/java/JobSearchGetTenantTest.java new file mode 100644 index 00000000000..ccd1d1b5e46 --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchGetTenantTest.java @@ -0,0 +1,53 @@ +/* + * 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 + * + * http://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. + */ +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchGetTenant; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchGetTenantTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testGetTenant() throws IOException { + // retrieve a tenant. + JobSearchGetTenant.getTenant(PROJECT_ID, TENANT_ID); + String got = bout.toString(); + assertThat(got).contains("Name:"); + assertThat(got).contains("External ID:"); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchListCompaniesTest.java b/talent/snippets/src/test/java/JobSearchListCompaniesTest.java new file mode 100644 index 00000000000..4138c6bdfca --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchListCompaniesTest.java @@ -0,0 +1,55 @@ +/* + * 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 + * + * http://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. + */ +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchListCompanies; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchListCompaniesTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testListCompanies() throws IOException { + // retrieve a tenant. + JobSearchListCompanies.listCompanies(PROJECT_ID, TENANT_ID); + String got = bout.toString(); + assertThat(got).contains("Company Name:"); + assertThat(got).contains("Display Name:"); + assertThat(got).contains("External ID:"); + } + + @After + public void tearDown() { + // delete that job. + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchListJobsTest.java b/talent/snippets/src/test/java/JobSearchListJobsTest.java new file mode 100644 index 00000000000..c3070fccb09 --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchListJobsTest.java @@ -0,0 +1,59 @@ +/* + * 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 + * + * http://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. + */ + +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchListJobs; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchListJobsTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); + private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); + + private static final String FILTER = "companyName=\"projects/%s/companies/%s\""; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testListJobs() throws IOException { + // retrieve a job. + JobSearchListJobs.listJobs( + PROJECT_ID, TENANT_ID, String.format(FILTER, PROJECT_ID, COMPANY_ID)); + String got = bout.toString(); + + assertThat(got).contains("Job name:"); + assertThat(got).contains("Job requisition ID:"); + assertThat(got).contains("Job title:"); + } + + @After + public void tearDown() { + System.setOut(out); + } +} diff --git a/talent/snippets/src/test/java/JobSearchListTenantsTest.java b/talent/snippets/src/test/java/JobSearchListTenantsTest.java new file mode 100644 index 00000000000..d615bebf30c --- /dev/null +++ b/talent/snippets/src/test/java/JobSearchListTenantsTest.java @@ -0,0 +1,52 @@ +/* + * 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 + * + * http://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. + */ +import static com.google.common.truth.Truth.assertThat; + +import com.example.jobs.JobSearchListTenants; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JobSearchListTenantsTest { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = System.out; + System.setOut(new PrintStream(bout)); + } + + @Test + public void testListTenants() throws IOException { + // retrieve a tenant. + JobSearchListTenants.listTenants(PROJECT_ID); + String got = bout.toString(); + assertThat(got).contains("Tenant Name:"); + assertThat(got).contains("External ID:"); + } + + @After + public void tearDown() { + System.setOut(out); + } +}