Skip to content

Commit 5142eca

Browse files
chore(bazel): Update WORKSPACE files for rules_gapic, gax_java, generator_java versions (#230)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 472750037 Source-Link: googleapis/googleapis@88f2ea3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/230a5588306aae18fe8f2a57f14d4039ad72c901 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjMwYTU1ODgzMDZhYWUxOGZlOGYyYTU3ZjE0ZDQwMzlhZDcyYzkwMSJ9
1 parent f35e8bf commit 5142eca

File tree

113 files changed

+5584
-234
lines changed

Some content is hidden

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

113 files changed

+5584
-234
lines changed

java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuClient.java

Lines changed: 245 additions & 98 deletions
Large diffs are not rendered by default.

java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/TpuSettings.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@
5656
* <p>For example, to set the total timeout of getNode to 30 seconds:
5757
*
5858
* <pre>{@code
59-
* // This snippet has been automatically generated for illustrative purposes only.
60-
* // It may require modifications to work in your environment.
59+
* // This snippet has been automatically generated and should be regarded as a code template only.
60+
* // It will require modifications to work:
61+
* // - It may require correct/in-range values for request initialization.
62+
* // - It may require specifying regional endpoints when creating the service client as shown in
63+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
6164
* TpuSettings.Builder tpuSettingsBuilder = TpuSettings.newBuilder();
6265
* tpuSettingsBuilder
6366
* .getNodeSettings()
6467
* .setRetrySettings(
65-
* tpuSettingsBuilder
66-
* .getNodeSettings()
67-
* .getRetrySettings()
68-
* .toBuilder()
68+
* tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder()
6969
* .setTotalTimeout(Duration.ofSeconds(30))
7070
* .build());
7171
* TpuSettings tpuSettings = tpuSettingsBuilder.build();

java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/package-info.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@
2626
* <p>Sample for TpuClient:
2727
*
2828
* <pre>{@code
29-
* // This snippet has been automatically generated for illustrative purposes only.
30-
* // It may require modifications to work in your environment.
29+
* // This snippet has been automatically generated and should be regarded as a code template only.
30+
* // It will require modifications to work:
31+
* // - It may require correct/in-range values for request initialization.
32+
* // - It may require specifying regional endpoints when creating the service client as shown in
33+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3134
* try (TpuClient tpuClient = TpuClient.create()) {
3235
* NodeName name = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]");
3336
* Node response = tpuClient.getNode(name);

java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v1/stub/TpuStubSettings.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@
9292
* <p>For example, to set the total timeout of getNode to 30 seconds:
9393
*
9494
* <pre>{@code
95-
* // This snippet has been automatically generated for illustrative purposes only.
96-
* // It may require modifications to work in your environment.
95+
* // This snippet has been automatically generated and should be regarded as a code template only.
96+
* // It will require modifications to work:
97+
* // - It may require correct/in-range values for request initialization.
98+
* // - It may require specifying regional endpoints when creating the service client as shown in
99+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
97100
* TpuStubSettings.Builder tpuSettingsBuilder = TpuStubSettings.newBuilder();
98101
* tpuSettingsBuilder
99102
* .getNodeSettings()
100103
* .setRetrySettings(
101-
* tpuSettingsBuilder
102-
* .getNodeSettings()
103-
* .getRetrySettings()
104-
* .toBuilder()
104+
* tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder()
105105
* .setTotalTimeout(Duration.ofSeconds(30))
106106
* .build());
107107
* TpuStubSettings tpuSettings = tpuSettingsBuilder.build();

java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuClient.java

Lines changed: 270 additions & 108 deletions
Large diffs are not rendered by default.

java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/TpuSettings.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@
5656
* <p>For example, to set the total timeout of getNode to 30 seconds:
5757
*
5858
* <pre>{@code
59-
* // This snippet has been automatically generated for illustrative purposes only.
60-
* // It may require modifications to work in your environment.
59+
* // This snippet has been automatically generated and should be regarded as a code template only.
60+
* // It will require modifications to work:
61+
* // - It may require correct/in-range values for request initialization.
62+
* // - It may require specifying regional endpoints when creating the service client as shown in
63+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
6164
* TpuSettings.Builder tpuSettingsBuilder = TpuSettings.newBuilder();
6265
* tpuSettingsBuilder
6366
* .getNodeSettings()
6467
* .setRetrySettings(
65-
* tpuSettingsBuilder
66-
* .getNodeSettings()
67-
* .getRetrySettings()
68-
* .toBuilder()
68+
* tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder()
6969
* .setTotalTimeout(Duration.ofSeconds(30))
7070
* .build());
7171
* TpuSettings tpuSettings = tpuSettingsBuilder.build();

java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/package-info.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828
* <p>Sample for TpuClient:
2929
*
3030
* <pre>{@code
31-
* // This snippet has been automatically generated for illustrative purposes only.
32-
* // It may require modifications to work in your environment.
31+
* // This snippet has been automatically generated and should be regarded as a code template only.
32+
* // It will require modifications to work:
33+
* // - It may require correct/in-range values for request initialization.
34+
* // - It may require specifying regional endpoints when creating the service client as shown in
35+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
3336
* try (TpuClient tpuClient = TpuClient.create()) {
3437
* NodeName name = NodeName.of("[PROJECT]", "[LOCATION]", "[NODE]");
3538
* Node response = tpuClient.getNode(name);

java-tpu/google-cloud-tpu/src/main/java/com/google/cloud/tpu/v2alpha1/stub/TpuStubSettings.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@
9696
* <p>For example, to set the total timeout of getNode to 30 seconds:
9797
*
9898
* <pre>{@code
99-
* // This snippet has been automatically generated for illustrative purposes only.
100-
* // It may require modifications to work in your environment.
99+
* // This snippet has been automatically generated and should be regarded as a code template only.
100+
* // It will require modifications to work:
101+
* // - It may require correct/in-range values for request initialization.
102+
* // - It may require specifying regional endpoints when creating the service client as shown in
103+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
101104
* TpuStubSettings.Builder tpuSettingsBuilder = TpuStubSettings.newBuilder();
102105
* tpuSettingsBuilder
103106
* .getNodeSettings()
104107
* .setRetrySettings(
105-
* tpuSettingsBuilder
106-
* .getNodeSettings()
107-
* .getRetrySettings()
108-
* .toBuilder()
108+
* tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder()
109109
* .setTotalTimeout(Duration.ofSeconds(30))
110110
* .build());
111111
* TpuStubSettings tpuSettings = tpuSettingsBuilder.build();
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.tpu.v1.stub.samples;
18+
19+
// [START tpu_v1_generated_tpustubsettings_getnode_sync]
20+
import com.google.cloud.tpu.v1.stub.TpuStubSettings;
21+
import java.time.Duration;
22+
23+
public class SyncGetNode {
24+
25+
public static void main(String[] args) throws Exception {
26+
syncGetNode();
27+
}
28+
29+
public static void syncGetNode() throws Exception {
30+
// This snippet has been automatically generated and should be regarded as a code template only.
31+
// It will require modifications to work:
32+
// - It may require correct/in-range values for request initialization.
33+
// - It may require specifying regional endpoints when creating the service client as shown in
34+
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
35+
TpuStubSettings.Builder tpuSettingsBuilder = TpuStubSettings.newBuilder();
36+
tpuSettingsBuilder
37+
.getNodeSettings()
38+
.setRetrySettings(
39+
tpuSettingsBuilder.getNodeSettings().getRetrySettings().toBuilder()
40+
.setTotalTimeout(Duration.ofSeconds(30))
41+
.build());
42+
TpuStubSettings tpuSettings = tpuSettingsBuilder.build();
43+
}
44+
}
45+
// [END tpu_v1_generated_tpustubsettings_getnode_sync]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.tpu.v1.samples;
18+
19+
// [START tpu_v1_generated_tpuclient_create_setcredentialsprovider_sync]
20+
import com.google.api.gax.core.FixedCredentialsProvider;
21+
import com.google.cloud.tpu.v1.TpuClient;
22+
import com.google.cloud.tpu.v1.TpuSettings;
23+
import com.google.cloud.tpu.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 and should be regarded as a code template only.
33+
// It will require modifications to work:
34+
// - It may require correct/in-range values for request initialization.
35+
// - It may require specifying regional endpoints when creating the service client as shown in
36+
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
37+
TpuSettings tpuSettings =
38+
TpuSettings.newBuilder()
39+
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
40+
.build();
41+
TpuClient tpuClient = TpuClient.create(tpuSettings);
42+
}
43+
}
44+
// [END tpu_v1_generated_tpuclient_create_setcredentialsprovider_sync]
Lines changed: 40 additions & 0 deletions
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.tpu.v1.samples;
18+
19+
// [START tpu_v1_generated_tpuclient_create_setendpoint_sync]
20+
import com.google.cloud.tpu.v1.TpuClient;
21+
import com.google.cloud.tpu.v1.TpuSettings;
22+
import com.google.cloud.tpu.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 and should be regarded as a code template only.
32+
// It will require modifications to work:
33+
// - It may require correct/in-range values for request initialization.
34+
// - It may require specifying regional endpoints when creating the service client as shown in
35+
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
36+
TpuSettings tpuSettings = TpuSettings.newBuilder().setEndpoint(myEndpoint).build();
37+
TpuClient tpuClient = TpuClient.create(tpuSettings);
38+
}
39+
}
40+
// [END tpu_v1_generated_tpuclient_create_setendpoint_sync]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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.tpu.v1.samples;
18+
19+
// [START tpu_v1_generated_tpuclient_createnode_async]
20+
import com.google.api.core.ApiFuture;
21+
import com.google.cloud.tpu.v1.CreateNodeRequest;
22+
import com.google.cloud.tpu.v1.LocationName;
23+
import com.google.cloud.tpu.v1.Node;
24+
import com.google.cloud.tpu.v1.TpuClient;
25+
import com.google.longrunning.Operation;
26+
27+
public class AsyncCreateNode {
28+
29+
public static void main(String[] args) throws Exception {
30+
asyncCreateNode();
31+
}
32+
33+
public static void asyncCreateNode() throws Exception {
34+
// This snippet has been automatically generated and should be regarded as a code template only.
35+
// It will require modifications to work:
36+
// - It may require correct/in-range values for request initialization.
37+
// - It may require specifying regional endpoints when creating the service client as shown in
38+
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
39+
try (TpuClient tpuClient = TpuClient.create()) {
40+
CreateNodeRequest request =
41+
CreateNodeRequest.newBuilder()
42+
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
43+
.setNodeId("nodeId-1040171331")
44+
.setNode(Node.newBuilder().build())
45+
.build();
46+
ApiFuture<Operation> future = tpuClient.createNodeCallable().futureCall(request);
47+
// Do something.
48+
Operation response = future.get();
49+
}
50+
}
51+
}
52+
// [END tpu_v1_generated_tpuclient_createnode_async]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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.tpu.v1.samples;
18+
19+
// [START tpu_v1_generated_tpuclient_createnode_lro_async]
20+
import com.google.api.gax.longrunning.OperationFuture;
21+
import com.google.cloud.tpu.v1.CreateNodeRequest;
22+
import com.google.cloud.tpu.v1.LocationName;
23+
import com.google.cloud.tpu.v1.Node;
24+
import com.google.cloud.tpu.v1.OperationMetadata;
25+
import com.google.cloud.tpu.v1.TpuClient;
26+
27+
public class AsyncCreateNodeLRO {
28+
29+
public static void main(String[] args) throws Exception {
30+
asyncCreateNodeLRO();
31+
}
32+
33+
public static void asyncCreateNodeLRO() throws Exception {
34+
// This snippet has been automatically generated and should be regarded as a code template only.
35+
// It will require modifications to work:
36+
// - It may require correct/in-range values for request initialization.
37+
// - It may require specifying regional endpoints when creating the service client as shown in
38+
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
39+
try (TpuClient tpuClient = TpuClient.create()) {
40+
CreateNodeRequest request =
41+
CreateNodeRequest.newBuilder()
42+
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
43+
.setNodeId("nodeId-1040171331")
44+
.setNode(Node.newBuilder().build())
45+
.build();
46+
OperationFuture<Node, OperationMetadata> future =
47+
tpuClient.createNodeOperationCallable().futureCall(request);
48+
// Do something.
49+
Node response = future.get();
50+
}
51+
}
52+
}
53+
// [END tpu_v1_generated_tpuclient_createnode_lro_async]

0 commit comments

Comments
 (0)