Skip to content

Commit ceecd91

Browse files
feat: Enable REST transport for most of Java and Go clients (#681)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 456641589 Source-Link: googleapis/googleapis@8a251f5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9
1 parent 09cd503 commit ceecd91

File tree

156 files changed

+7050
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+7050
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.servicedirectory.v1.samples;
18+
19+
// [START servicedirectory_v1_generated_lookupserviceclient_create_setcredentialsprovider_sync]
20+
import com.google.api.gax.core.FixedCredentialsProvider;
21+
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
22+
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
23+
import com.google.cloud.servicedirectory.v1.myCredentials;
24+
25+
public class SyncCreateSetCredentialsProvider {
26+
27+
public static void main(String[] args) throws Exception {
28+
syncCreateSetCredentialsProvider();
29+
}
30+
31+
public static void syncCreateSetCredentialsProvider() throws Exception {
32+
// This snippet has been automatically generated for illustrative purposes only.
33+
// It may require modifications to work in your environment.
34+
LookupServiceSettings lookupServiceSettings =
35+
LookupServiceSettings.newBuilder()
36+
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
37+
.build();
38+
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
39+
}
40+
}
41+
// [END servicedirectory_v1_generated_lookupserviceclient_create_setcredentialsprovider_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.servicedirectory.v1.samples;
18+
19+
// [START servicedirectory_v1_generated_lookupserviceclient_create_setcredentialsprovider1_sync]
20+
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
21+
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
22+
23+
public class SyncCreateSetCredentialsProvider1 {
24+
25+
public static void main(String[] args) throws Exception {
26+
syncCreateSetCredentialsProvider1();
27+
}
28+
29+
public static void syncCreateSetCredentialsProvider1() throws Exception {
30+
// This snippet has been automatically generated for illustrative purposes only.
31+
// It may require modifications to work in your environment.
32+
LookupServiceSettings lookupServiceSettings =
33+
LookupServiceSettings.newBuilder()
34+
.setTransportChannelProvider(
35+
LookupServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
36+
.build();
37+
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
38+
}
39+
}
40+
// [END servicedirectory_v1_generated_lookupserviceclient_create_setcredentialsprovider1_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.servicedirectory.v1.samples;
18+
19+
// [START servicedirectory_v1_generated_lookupserviceclient_create_setendpoint_sync]
20+
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
21+
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
22+
import com.google.cloud.servicedirectory.v1.myEndpoint;
23+
24+
public class SyncCreateSetEndpoint {
25+
26+
public static void main(String[] args) throws Exception {
27+
syncCreateSetEndpoint();
28+
}
29+
30+
public static void syncCreateSetEndpoint() throws Exception {
31+
// This snippet has been automatically generated for illustrative purposes only.
32+
// It may require modifications to work in your environment.
33+
LookupServiceSettings lookupServiceSettings =
34+
LookupServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
35+
LookupServiceClient lookupServiceClient = LookupServiceClient.create(lookupServiceSettings);
36+
}
37+
}
38+
// [END servicedirectory_v1_generated_lookupserviceclient_create_setendpoint_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.servicedirectory.v1.samples;
18+
19+
// [START servicedirectory_v1_generated_lookupserviceclient_resolveservice_async]
20+
import com.google.api.core.ApiFuture;
21+
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
22+
import com.google.cloud.servicedirectory.v1.ResolveServiceRequest;
23+
import com.google.cloud.servicedirectory.v1.ResolveServiceResponse;
24+
import com.google.cloud.servicedirectory.v1.ServiceName;
25+
26+
public class AsyncResolveService {
27+
28+
public static void main(String[] args) throws Exception {
29+
asyncResolveService();
30+
}
31+
32+
public static void asyncResolveService() throws Exception {
33+
// This snippet has been automatically generated for illustrative purposes only.
34+
// It may require modifications to work in your environment.
35+
try (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) {
36+
ResolveServiceRequest request =
37+
ResolveServiceRequest.newBuilder()
38+
.setName(
39+
ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString())
40+
.setMaxEndpoints(2074789987)
41+
.setEndpointFilter("endpointFilter-1834249875")
42+
.build();
43+
ApiFuture<ResolveServiceResponse> future =
44+
lookupServiceClient.resolveServiceCallable().futureCall(request);
45+
// Do something.
46+
ResolveServiceResponse response = future.get();
47+
}
48+
}
49+
}
50+
// [END servicedirectory_v1_generated_lookupserviceclient_resolveservice_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.servicedirectory.v1.samples;
18+
19+
// [START servicedirectory_v1_generated_lookupserviceclient_resolveservice_sync]
20+
import com.google.cloud.servicedirectory.v1.LookupServiceClient;
21+
import com.google.cloud.servicedirectory.v1.ResolveServiceRequest;
22+
import com.google.cloud.servicedirectory.v1.ResolveServiceResponse;
23+
import com.google.cloud.servicedirectory.v1.ServiceName;
24+
25+
public class SyncResolveService {
26+
27+
public static void main(String[] args) throws Exception {
28+
syncResolveService();
29+
}
30+
31+
public static void syncResolveService() throws Exception {
32+
// This snippet has been automatically generated for illustrative purposes only.
33+
// It may require modifications to work in your environment.
34+
try (LookupServiceClient lookupServiceClient = LookupServiceClient.create()) {
35+
ResolveServiceRequest request =
36+
ResolveServiceRequest.newBuilder()
37+
.setName(
38+
ServiceName.of("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]").toString())
39+
.setMaxEndpoints(2074789987)
40+
.setEndpointFilter("endpointFilter-1834249875")
41+
.build();
42+
ResolveServiceResponse response = lookupServiceClient.resolveService(request);
43+
}
44+
}
45+
}
46+
// [END servicedirectory_v1_generated_lookupserviceclient_resolveservice_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.servicedirectory.v1.samples;
18+
19+
// [START servicedirectory_v1_generated_lookupservicesettings_resolveservice_sync]
20+
import com.google.cloud.servicedirectory.v1.LookupServiceSettings;
21+
import java.time.Duration;
22+
23+
public class SyncResolveService {
24+
25+
public static void main(String[] args) throws Exception {
26+
syncResolveService();
27+
}
28+
29+
public static void syncResolveService() throws Exception {
30+
// This snippet has been automatically generated for illustrative purposes only.
31+
// It may require modifications to work in your environment.
32+
LookupServiceSettings.Builder lookupServiceSettingsBuilder = LookupServiceSettings.newBuilder();
33+
lookupServiceSettingsBuilder
34+
.resolveServiceSettings()
35+
.setRetrySettings(
36+
lookupServiceSettingsBuilder
37+
.resolveServiceSettings()
38+
.getRetrySettings()
39+
.toBuilder()
40+
.setTotalTimeout(Duration.ofSeconds(30))
41+
.build());
42+
LookupServiceSettings lookupServiceSettings = lookupServiceSettingsBuilder.build();
43+
}
44+
}
45+
// [END servicedirectory_v1_generated_lookupservicesettings_resolveservice_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.servicedirectory.v1.samples;
18+
19+
// [START
20+
// servicedirectory_v1_generated_registrationserviceclient_create_setcredentialsprovider_sync]
21+
import com.google.api.gax.core.FixedCredentialsProvider;
22+
import com.google.cloud.servicedirectory.v1.RegistrationServiceClient;
23+
import com.google.cloud.servicedirectory.v1.RegistrationServiceSettings;
24+
import com.google.cloud.servicedirectory.v1.myCredentials;
25+
26+
public class SyncCreateSetCredentialsProvider {
27+
28+
public static void main(String[] args) throws Exception {
29+
syncCreateSetCredentialsProvider();
30+
}
31+
32+
public static void syncCreateSetCredentialsProvider() throws Exception {
33+
// This snippet has been automatically generated for illustrative purposes only.
34+
// It may require modifications to work in your environment.
35+
RegistrationServiceSettings registrationServiceSettings =
36+
RegistrationServiceSettings.newBuilder()
37+
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
38+
.build();
39+
RegistrationServiceClient registrationServiceClient =
40+
RegistrationServiceClient.create(registrationServiceSettings);
41+
}
42+
}
43+
// [END servicedirectory_v1_generated_registrationserviceclient_create_setcredentialsprovider_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.servicedirectory.v1.samples;
18+
19+
// [START
20+
// servicedirectory_v1_generated_registrationserviceclient_create_setcredentialsprovider1_sync]
21+
import com.google.cloud.servicedirectory.v1.RegistrationServiceClient;
22+
import com.google.cloud.servicedirectory.v1.RegistrationServiceSettings;
23+
24+
public class SyncCreateSetCredentialsProvider1 {
25+
26+
public static void main(String[] args) throws Exception {
27+
syncCreateSetCredentialsProvider1();
28+
}
29+
30+
public static void syncCreateSetCredentialsProvider1() throws Exception {
31+
// This snippet has been automatically generated for illustrative purposes only.
32+
// It may require modifications to work in your environment.
33+
RegistrationServiceSettings registrationServiceSettings =
34+
RegistrationServiceSettings.newBuilder()
35+
.setTransportChannelProvider(
36+
RegistrationServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
37+
.build();
38+
RegistrationServiceClient registrationServiceClient =
39+
RegistrationServiceClient.create(registrationServiceSettings);
40+
}
41+
}
42+
// [END servicedirectory_v1_generated_registrationserviceclient_create_setcredentialsprovider1_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.servicedirectory.v1.samples;
18+
19+
// [START servicedirectory_v1_generated_registrationserviceclient_create_setendpoint_sync]
20+
import com.google.cloud.servicedirectory.v1.RegistrationServiceClient;
21+
import com.google.cloud.servicedirectory.v1.RegistrationServiceSettings;
22+
import com.google.cloud.servicedirectory.v1.myEndpoint;
23+
24+
public class SyncCreateSetEndpoint {
25+
26+
public static void main(String[] args) throws Exception {
27+
syncCreateSetEndpoint();
28+
}
29+
30+
public static void syncCreateSetEndpoint() throws Exception {
31+
// This snippet has been automatically generated for illustrative purposes only.
32+
// It may require modifications to work in your environment.
33+
RegistrationServiceSettings registrationServiceSettings =
34+
RegistrationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
35+
RegistrationServiceClient registrationServiceClient =
36+
RegistrationServiceClient.create(registrationServiceSettings);
37+
}
38+
}
39+
// [END servicedirectory_v1_generated_registrationserviceclient_create_setendpoint_sync]

0 commit comments

Comments
 (0)