Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] samples: migrate code from googleapis/java-servicedirectory #7397

Closed
wants to merge 99 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
7629cb2
chore: updated grpc code output, add samples scaffold (#12)
yoshi-automation Mar 19, 2020
60d882b
chore(deps): update dependency com.google.cloud:libraries-bom to v4.3…
renovate-bot Mar 23, 2020
788c23e
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Mar 25, 2020
2a98c43
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Mar 30, 2020
bdaff62
chore(deps): update dependency com.google.cloud:libraries-bom to v4.4…
renovate-bot Apr 1, 2020
327945f
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Apr 6, 2020
967e7f6
chore(deps): update dependency com.google.cloud:libraries-bom to v4.4…
renovate-bot Apr 6, 2020
0ce73aa
chore(deps): update dependency com.google.cloud:libraries-bom to v5 (…
renovate-bot Apr 14, 2020
3a45936
chore(deps): update dependency com.google.cloud:libraries-bom to v5.1…
renovate-bot Apr 14, 2020
ae083bf
samples: add code snippets for Service Directory. (#28)
makk94 Apr 15, 2020
3603c65
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Apr 16, 2020
58c3ad1
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Apr 17, 2020
e479068
chore(deps): update dependency com.google.cloud:libraries-bom to v5.2…
renovate-bot Apr 23, 2020
151bac3
chore(deps): update dependency com.google.cloud:libraries-bom to v5.3…
renovate-bot Apr 28, 2020
d1e738f
chore(deps): update dependency com.google.cloud:libraries-bom to v5.4…
renovate-bot May 19, 2020
e7785da
chore(deps): update dependency com.google.cloud:libraries-bom to v5.5…
renovate-bot May 29, 2020
a13b734
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Jun 10, 2020
85ccee0
chore(deps): update dependency com.google.cloud:libraries-bom to v5.7…
renovate-bot Jun 10, 2020
97468ab
chore(deps): update dependency com.google.cloud:libraries-bom to v6 (…
renovate-bot Jun 16, 2020
3897b47
chore(deps): update dependency com.google.cloud:libraries-bom to v7 (…
renovate-bot Jun 17, 2020
d9ea33d
chore(deps): update dependency com.google.cloud:libraries-bom to v7.0…
renovate-bot Jun 22, 2020
7b6e264
chore(deps): update dependency com.google.cloud:libraries-bom to v8 (…
renovate-bot Jun 26, 2020
c99021c
samples: add quickstart (#82)
Jun 30, 2020
d18770d
chore(deps): update dependency com.google.cloud:libraries-bom to v8.1…
renovate-bot Jul 16, 2020
5812140
chore(deps): update dependency com.google.cloud:libraries-bom to v9 (…
renovate-bot Aug 14, 2020
680d688
chore(deps): update dependency com.google.cloud:libraries-bom to v9.1.0
renovate-bot Aug 17, 2020
a39bea3
chore(deps): update dependency com.google.cloud:libraries-bom to v10 …
renovate-bot Sep 22, 2020
43061f1
chore(deps): update dependency com.google.cloud:libraries-bom to v11 …
renovate-bot Sep 24, 2020
9901199
chore(deps): update dependency com.google.cloud:libraries-bom to v12 …
renovate-bot Oct 6, 2020
9bba14d
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Oct 9, 2020
07329bb
test(deps): update dependency junit:junit to v4.13.1
renovate-bot Oct 12, 2020
aaed4b8
chore(deps): update dependency com.google.cloud:libraries-bom to v12.…
renovate-bot Oct 15, 2020
e9fa2fa
chore(deps): update dependency com.google.cloud:libraries-bom to v13 …
renovate-bot Oct 20, 2020
71620e9
chore(deps): update dependency com.google.cloud:libraries-bom to v13.…
renovate-bot Oct 21, 2020
4df3864
test(deps): update dependency com.google.truth:truth to v1.1 (#189)
renovate-bot Oct 22, 2020
0f4f7fb
chore(deps): update dependency com.google.cloud:libraries-bom to v13.…
renovate-bot Oct 23, 2020
237a5a5
chore(deps): update dependency com.google.cloud:libraries-bom to v13.…
renovate-bot Oct 26, 2020
64dcf87
chore(deps): update dependency com.google.cloud:libraries-bom to v13.…
renovate-bot Oct 30, 2020
256cfad
chore(deps): update dependency com.google.cloud:libraries-bom to v14 …
renovate-bot Nov 4, 2020
0584936
chore(deps): update dependency com.google.cloud:libraries-bom to v15 …
renovate-bot Nov 5, 2020
d28803b
chore(deps): update dependency com.google.cloud:libraries-bom to v15.…
renovate-bot Nov 12, 2020
0953ea9
chore(deps): update dependency com.google.cloud:libraries-bom to v16 …
renovate-bot Nov 19, 2020
5cc1f4a
chore(deps): update dependency com.google.cloud:libraries-bom to v16.…
renovate-bot Dec 15, 2020
143dc94
chore(deps): update dependency com.google.cloud:libraries-bom to v16.…
renovate-bot Jan 7, 2021
452778c
test(deps): update dependency com.google.truth:truth to v1.1.2 (#281)
renovate-bot Jan 25, 2021
9b6d561
chore(deps): update dependency com.google.cloud:libraries-bom to v16.…
renovate-bot Jan 26, 2021
635411d
chore(deps): update dependency com.google.cloud:libraries-bom to v16.…
renovate-bot Feb 10, 2021
099e32d
feat: update java samples to v1 (#274)
katiehochberg Feb 10, 2021
44454b0
test(deps): update dependency junit:junit to v4.13.2 (#298)
renovate-bot Feb 16, 2021
bd2c0ca
chore(deps): update dependency com.google.cloud:libraries-bom to v17 …
renovate-bot Feb 24, 2021
346d6da
chore(deps): update dependency com.google.cloud:libraries-bom to v18 …
renovate-bot Feb 25, 2021
e6f2127
chore(deps): update dependency com.google.cloud:libraries-bom to v18.…
renovate-bot Mar 3, 2021
dcae6f7
chore(deps): update dependency com.google.cloud:libraries-bom to v19 …
renovate-bot Mar 4, 2021
ca31ca8
chore(deps): update dependency com.google.cloud:libraries-bom to v19.…
renovate-bot Mar 24, 2021
811332c
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Apr 9, 2021
70d19c0
chore(deps): update dependency com.google.cloud:libraries-bom to v20 …
renovate-bot Apr 12, 2021
7a600f1
chore(deps): update dependency com.google.cloud:libraries-bom to v20.…
renovate-bot Apr 19, 2021
65729b5
chore(deps): update dependency com.google.cloud:libraries-bom to v20.…
renovate-bot Apr 29, 2021
fa6a49b
chore(deps): update dependency com.google.cloud:libraries-bom to v20.…
renovate-bot May 13, 2021
0bb43a0
chore(deps): update dependency com.google.cloud:libraries-bom to v20.…
renovate-bot May 17, 2021
d8a30e7
test(deps): update dependency com.google.truth:truth to v1.1.3 (#412)
renovate-bot May 26, 2021
f81848a
chore(deps): update dependency com.google.cloud:libraries-bom to v20.…
renovate-bot May 31, 2021
3b715f5
chore(deps): update dependency com.google.cloud:libraries-bom to v20.…
renovate-bot Jun 7, 2021
be5027c
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Jun 7, 2021
26b03d8
chore(deps): update dependency com.google.cloud:libraries-bom to v20.…
renovate-bot Jun 23, 2021
15fb430
chore(deps): update dependency com.google.cloud:libraries-bom to v20.…
renovate-bot Jul 9, 2021
bf8a5aa
chore(deps): update dependency com.google.cloud:libraries-bom to v20.…
renovate-bot Jul 27, 2021
800ef3e
chore(deps): update dependency com.google.cloud:libraries-bom to v21 …
renovate-bot Aug 19, 2021
90068ad
chore(deps): update dependency com.google.cloud:libraries-bom to v22 …
renovate-bot Aug 27, 2021
af75a50
chore(deps): update dependency com.google.cloud:libraries-bom to v23 …
renovate-bot Sep 13, 2021
0c8c952
chore(deps): update dependency com.google.cloud:libraries-bom to v23.…
renovate-bot Oct 1, 2021
0d0758e
chore(deps): update dependency com.google.cloud:libraries-bom to v24 …
renovate-bot Oct 27, 2021
28b760c
chore(deps): update dependency com.google.cloud.samples:shared-config…
renovate-bot Dec 6, 2021
b399cb5
chore(deps): update dependency com.google.cloud:libraries-bom to v24.…
renovate-bot Dec 8, 2021
9d2aad5
chore(deps): update dependency com.google.cloud:libraries-bom to v24.…
renovate-bot Dec 28, 2021
5203d12
chore(deps): update dependency com.google.cloud:libraries-bom to v24.…
renovate-bot Jan 7, 2022
0a3912d
chore(deps): update dependency com.google.cloud:libraries-bom to v24.…
renovate-bot Jan 18, 2022
ab31fab
chore(deps): update dependency com.google.cloud:libraries-bom to v24.…
renovate-bot Feb 8, 2022
cd5c3c9
build(deps): update dependency org.sonatype.plugins:nexus-staging-mav…
renovate-bot Feb 14, 2022
d2e0833
build(deps): update dependency org.sonatype.plugins:nexus-staging-mav…
renovate-bot Feb 15, 2022
34012a4
build(deps): update dependency org.sonatype.plugins:nexus-staging-mav…
renovate-bot Feb 17, 2022
50e2060
chore(deps): update dependency com.google.cloud:libraries-bom to v25 …
renovate-bot Mar 14, 2022
39f4755
chore(deps): update dependency com.google.cloud:libraries-bom to v25.…
renovate-bot Apr 1, 2022
6aca7bf
build(deps): update dependency org.sonatype.plugins:nexus-staging-mav…
renovate-bot Apr 21, 2022
2fc6410
chore(deps): update dependency com.google.cloud:libraries-bom to v25.…
renovate-bot Apr 27, 2022
c3ee048
chore(deps): update dependency com.google.cloud:libraries-bom to v25.…
renovate-bot May 16, 2022
09cd503
chore(deps): update dependency com.google.cloud:libraries-bom to v25.…
renovate-bot Jun 6, 2022
ceecd91
feat: Enable REST transport for most of Java and Go clients (#681)
gcf-owl-bot[bot] Jun 23, 2022
cbb788a
chore(deps): update dependency com.google.cloud:libraries-bom to v26 …
renovate-bot Jul 11, 2022
28d5542
build(deps): update dependency org.apache.maven.plugins:maven-deploy-…
renovate-bot Jul 19, 2022
139161a
chore(deps): update dependency com.google.cloud:libraries-bom to v26.…
renovate-bot Aug 16, 2022
dd0c31e
chore: remove unused proto imports (#703)
gcf-owl-bot[bot] Aug 22, 2022
28a24fb
chore(deps): update dependency com.google.cloud:libraries-bom to v26.…
renovate-bot Aug 31, 2022
518fc41
chore(bazel): Update WORKSPACE files for rules_gapic, gax_java, gener…
gcf-owl-bot[bot] Sep 9, 2022
554cb6d
chore(deps): update dependency com.google.cloud:libraries-bom to v26.…
renovate-bot Sep 20, 2022
0b47aa4
chore(deps): update dependency com.google.cloud:libraries-bom to v26.…
renovate-bot Oct 7, 2022
7ab2a58
chore(deps): update dependency com.google.cloud:libraries-bom to v26.…
renovate-bot Nov 8, 2022
7f1fb5f
chore: Set `rest_numeric_enums = False` for all gapic rules explicitl…
gcf-owl-bot[bot] Nov 8, 2022
1b355c7
Merge remote-tracking branch 'migration/main' into java-servicedirect…
Shabirmean Nov 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions servicedirectory/snippets/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-servicedirectory-samples</artifactId>
<version>0.0.1-SNAPSHOT</version><!-- This artifact should not be released -->
<packaging>pom</packaging>
<name>Google Service Directory Samples Parent</name>
<url>https://github.com/googleapis/java-servicedirectory</url>
<description>
Java idiomatic client for Google Cloud Platform services.
</description>

<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.2.0</version>
</parent>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<modules>
<module>install-without-bom</module>
<module>snapshot</module>
<module>snippets</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<configuration>
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
</project>
46 changes: 46 additions & 0 deletions servicedirectory/snippets/snippets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Service Directory

[Service Directory](https://cloud.google.com/service-directory/) is a platform
for discovering, publishing, and connecting services. It offers customers a
single place to register and discover their services in a consistent and
reliable way, regardless of their environment. These sample Java applications
demonstrate how to access the Service Directory API using the Google Java API
Client Libraries.

## Prerequisites

### Enable the API

You must enable the Service Directory API for your project in order to use these
samples. You can do so
[here](https://console.cloud.google.com/flows/enableapi?apiid=servicedirectory.googleapis.com&_ga=2.140387959.57242806.1585772225-360187285.1585772225).

### Set Environment Variables

You must set your project ID in order to run the tests

`$ export GOOGLE_CLOUD_PROJECT=<your-project-id-here>`

### Grant Permissions

You must ensure that the
[user account or service account](https://cloud.google.com/iam/docs/service-accounts#differences_between_a_service_account_and_a_user_account)
you used to authorize your gcloud session has the proper permissions to edit
Service Directory resources for your project. In the Cloud Console under IAM,
add the `Service Directory Admin` role to the project whose service account
you're using to test.

More information can be found in the
[Authentication docs](https://cloud.google.com/docs/authentication/production).

## Quickstart

Install [Maven](https://maven.apache.org/).

Build your project with:

mvn clean package -DskipTests

You can run all tests with:

mvn clean verify
Original file line number Diff line number Diff line change
@@ -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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_LookupService_Create_SetCredentialsProvider_sync]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
import com.google.cloud.servicedirectory.v1.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
LookupServiceSettings lookupServiceSettings =
LookupServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
}
}
// [END servicedirectory_v1_generated_LookupService_Create_SetCredentialsProvider_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_LookupService_Create_SetCredentialsProvider1_sync]
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;

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
LookupServiceSettings lookupServiceSettings =
LookupServiceSettings.newHttpJsonBuilder().build();
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
}
}
// [END servicedirectory_v1_generated_LookupService_Create_SetCredentialsProvider1_sync]
Original file line number Diff line number Diff line change
@@ -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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_LookupService_Create_SetEndpoint_sync]
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
import com.google.cloud.servicedirectory.v1.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
LookupServiceSettings lookupServiceSettings =
LookupServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
}
}
// [END servicedirectory_v1_generated_LookupService_Create_SetEndpoint_sync]
Original file line number Diff line number Diff line change
@@ -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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_LookupService_ResolveService_async]
import com.google.api.core.ApiFuture;
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.ResolveServiceRequest;
import com.google.cloud.servicedirectory.v1.ResolveServiceResponse;
import com.google.cloud.servicedirectory.v1.ServiceName;

public class AsyncResolveService {

public static void main(String[] args) throws Exception {
asyncResolveService();
}

public static void asyncResolveService() 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 (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) {
ResolveServiceRequest request =
ResolveServiceRequest.newBuilder()
.setName(
ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString())
.setMaxEndpoints(2074789987)
.setEndpointFilter("endpointFilter-1834249875")
.build();
ApiFuture<ResolveServiceResponse> future =
lookupServiceClient.resolveServiceCallable().futureCall(request);
// Do something.
ResolveServiceResponse response = future.get();
}
}
}
// [END servicedirectory_v1_generated_LookupService_ResolveService_async]
Original file line number Diff line number Diff line change
@@ -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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_LookupService_ResolveService_sync]
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
import com.google.cloud.servicedirectory.v1.ResolveServiceRequest;
import com.google.cloud.servicedirectory.v1.ResolveServiceResponse;
import com.google.cloud.servicedirectory.v1.ServiceName;

public class SyncResolveService {

public static void main(String[] args) throws Exception {
syncResolveService();
}

public static void syncResolveService() 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 (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) {
ResolveServiceRequest request =
ResolveServiceRequest.newBuilder()
.setName(
ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString())
.setMaxEndpoints(2074789987)
.setEndpointFilter("endpointFilter-1834249875")
.build();
ResolveServiceResponse response = lookupServiceClient.resolveService(request);
}
}
}
// [END servicedirectory_v1_generated_LookupService_ResolveService_sync]
Original file line number Diff line number Diff line change
@@ -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.servicedirectory.v1.samples;

// [START servicedirectory_v1_generated_LookupServiceSettings_ResolveService_sync]
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
import java.time.Duration;

public class SyncResolveService {

public static void main(String[] args) throws Exception {
syncResolveService();
}

public static void syncResolveService() 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
LookupServiceSettings.Builder lookupServiceSettingsBuilder = LookupServiceSettings.newBuilder();
lookupServiceSettingsBuilder
.resolveServiceSettings()
.setRetrySettings(
lookupServiceSettingsBuilder.resolveServiceSettings().getRetrySettings().toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
LookupServiceSettings lookupServiceSettings = lookupServiceSettingsBuilder.build();
}
}
// [END servicedirectory_v1_generated_LookupServiceSettings_ResolveService_sync]
Loading