Skip to content

Commit 6e725ff

Browse files
feat: [cloudprofiler] add ListProfiles RPC to ExportService (#10150)
* feat: add `ListProfiles` RPC to `ExportService` PiperOrigin-RevId: 590653747 Source-Link: googleapis/googleapis@f8a2933 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4f504867233bf21c59b6867aa751817f3702629c Copy-Tag: eyJwIjoiamF2YS1wcm9maWxlci8uT3dsQm90LnlhbWwiLCJoIjoiNGY1MDQ4NjcyMzNiZjIxYzU5YjY4NjdhYTc1MTgxN2YzNzAyNjI5YyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent ebfda8b commit 6e725ff

File tree

31 files changed

+5441
-30
lines changed

31 files changed

+5441
-30
lines changed

java-profiler/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
195195
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
196196
[stability-image]: https://img.shields.io/badge/stability-stable-green
197197
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-profiler.svg
198-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-profiler/2.30.0
198+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-profiler/2.32.0
199199
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
200200
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
201201
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

java-profiler/google-cloud-profiler/src/main/java/com/google/devtools/cloudprofiler/v2/ExportServiceClient.java

Lines changed: 392 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
/*
2+
* Copyright 2023 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.devtools.cloudprofiler.v2;
18+
19+
import static com.google.devtools.cloudprofiler.v2.ExportServiceClient.ListProfilesPagedResponse;
20+
21+
import com.google.api.core.ApiFunction;
22+
import com.google.api.core.BetaApi;
23+
import com.google.api.gax.core.GoogleCredentialsProvider;
24+
import com.google.api.gax.core.InstantiatingExecutorProvider;
25+
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
26+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
27+
import com.google.api.gax.rpc.ApiClientHeaderProvider;
28+
import com.google.api.gax.rpc.ClientContext;
29+
import com.google.api.gax.rpc.ClientSettings;
30+
import com.google.api.gax.rpc.PagedCallSettings;
31+
import com.google.api.gax.rpc.TransportChannelProvider;
32+
import com.google.api.gax.rpc.UnaryCallSettings;
33+
import com.google.devtools.cloudprofiler.v2.stub.ExportServiceStubSettings;
34+
import java.io.IOException;
35+
import java.util.List;
36+
import javax.annotation.Generated;
37+
38+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
39+
/**
40+
* Settings class to configure an instance of {@link ExportServiceClient}.
41+
*
42+
* <p>The default instance has everything set to sensible defaults:
43+
*
44+
* <ul>
45+
* <li>The default service address (cloudprofiler.googleapis.com) and default port (443) are used.
46+
* <li>Credentials are acquired automatically through Application Default Credentials.
47+
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
48+
* </ul>
49+
*
50+
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
51+
* build() is called, the tree of builders is called to create the complete settings object.
52+
*
53+
* <p>For example, to set the total timeout of listProfiles to 30 seconds:
54+
*
55+
* <pre>{@code
56+
* // This snippet has been automatically generated and should be regarded as a code template only.
57+
* // It will require modifications to work:
58+
* // - It may require correct/in-range values for request initialization.
59+
* // - It may require specifying regional endpoints when creating the service client as shown in
60+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
61+
* ExportServiceSettings.Builder exportServiceSettingsBuilder = ExportServiceSettings.newBuilder();
62+
* exportServiceSettingsBuilder
63+
* .listProfilesSettings()
64+
* .setRetrySettings(
65+
* exportServiceSettingsBuilder
66+
* .listProfilesSettings()
67+
* .getRetrySettings()
68+
* .toBuilder()
69+
* .setTotalTimeout(Duration.ofSeconds(30))
70+
* .build());
71+
* ExportServiceSettings exportServiceSettings = exportServiceSettingsBuilder.build();
72+
* }</pre>
73+
*/
74+
@Generated("by gapic-generator-java")
75+
public class ExportServiceSettings extends ClientSettings<ExportServiceSettings> {
76+
77+
/** Returns the object with the settings used for calls to listProfiles. */
78+
public PagedCallSettings<ListProfilesRequest, ListProfilesResponse, ListProfilesPagedResponse>
79+
listProfilesSettings() {
80+
return ((ExportServiceStubSettings) getStubSettings()).listProfilesSettings();
81+
}
82+
83+
public static final ExportServiceSettings create(ExportServiceStubSettings stub)
84+
throws IOException {
85+
return new ExportServiceSettings.Builder(stub.toBuilder()).build();
86+
}
87+
88+
/** Returns a builder for the default ExecutorProvider for this service. */
89+
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
90+
return ExportServiceStubSettings.defaultExecutorProviderBuilder();
91+
}
92+
93+
/** Returns the default service endpoint. */
94+
public static String getDefaultEndpoint() {
95+
return ExportServiceStubSettings.getDefaultEndpoint();
96+
}
97+
98+
/** Returns the default service scopes. */
99+
public static List<String> getDefaultServiceScopes() {
100+
return ExportServiceStubSettings.getDefaultServiceScopes();
101+
}
102+
103+
/** Returns a builder for the default credentials for this service. */
104+
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
105+
return ExportServiceStubSettings.defaultCredentialsProviderBuilder();
106+
}
107+
108+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
109+
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
110+
return ExportServiceStubSettings.defaultGrpcTransportProviderBuilder();
111+
}
112+
113+
/** Returns a builder for the default REST ChannelProvider for this service. */
114+
@BetaApi
115+
public static InstantiatingHttpJsonChannelProvider.Builder
116+
defaultHttpJsonTransportProviderBuilder() {
117+
return ExportServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
118+
}
119+
120+
public static TransportChannelProvider defaultTransportChannelProvider() {
121+
return ExportServiceStubSettings.defaultTransportChannelProvider();
122+
}
123+
124+
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
125+
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
126+
return ExportServiceStubSettings.defaultApiClientHeaderProviderBuilder();
127+
}
128+
129+
/** Returns a new gRPC builder for this class. */
130+
public static Builder newBuilder() {
131+
return Builder.createDefault();
132+
}
133+
134+
/** Returns a new REST builder for this class. */
135+
@BetaApi
136+
public static Builder newHttpJsonBuilder() {
137+
return Builder.createHttpJsonDefault();
138+
}
139+
140+
/** Returns a new builder for this class. */
141+
public static Builder newBuilder(ClientContext clientContext) {
142+
return new Builder(clientContext);
143+
}
144+
145+
/** Returns a builder containing all the values of this settings class. */
146+
public Builder toBuilder() {
147+
return new Builder(this);
148+
}
149+
150+
protected ExportServiceSettings(Builder settingsBuilder) throws IOException {
151+
super(settingsBuilder);
152+
}
153+
154+
/** Builder for ExportServiceSettings. */
155+
public static class Builder extends ClientSettings.Builder<ExportServiceSettings, Builder> {
156+
157+
protected Builder() throws IOException {
158+
this(((ClientContext) null));
159+
}
160+
161+
protected Builder(ClientContext clientContext) {
162+
super(ExportServiceStubSettings.newBuilder(clientContext));
163+
}
164+
165+
protected Builder(ExportServiceSettings settings) {
166+
super(settings.getStubSettings().toBuilder());
167+
}
168+
169+
protected Builder(ExportServiceStubSettings.Builder stubSettings) {
170+
super(stubSettings);
171+
}
172+
173+
private static Builder createDefault() {
174+
return new Builder(ExportServiceStubSettings.newBuilder());
175+
}
176+
177+
@BetaApi
178+
private static Builder createHttpJsonDefault() {
179+
return new Builder(ExportServiceStubSettings.newHttpJsonBuilder());
180+
}
181+
182+
public ExportServiceStubSettings.Builder getStubSettingsBuilder() {
183+
return ((ExportServiceStubSettings.Builder) getStubSettings());
184+
}
185+
186+
/**
187+
* Applies the given settings updater function to all of the unary API methods in this service.
188+
*
189+
* <p>Note: This method does not support applying settings to streaming methods.
190+
*/
191+
public Builder applyToAllUnaryMethods(
192+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
193+
super.applyToAllUnaryMethods(
194+
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
195+
return this;
196+
}
197+
198+
/** Returns the builder for the settings used for calls to listProfiles. */
199+
public PagedCallSettings.Builder<
200+
ListProfilesRequest, ListProfilesResponse, ListProfilesPagedResponse>
201+
listProfilesSettings() {
202+
return getStubSettingsBuilder().listProfilesSettings();
203+
}
204+
205+
@Override
206+
public ExportServiceSettings build() throws IOException {
207+
return new ExportServiceSettings(this);
208+
}
209+
}
210+
}

java-profiler/google-cloud-profiler/src/main/java/com/google/devtools/cloudprofiler/v2/gapic_metadata.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@
2222
}
2323
}
2424
}
25+
},
26+
"ExportService": {
27+
"clients": {
28+
"grpc": {
29+
"libraryClient": "ExportServiceClient",
30+
"rpcs": {
31+
"ListProfiles": {
32+
"methods": ["listProfiles", "listProfilesPagedCallable", "listProfilesCallable"]
33+
}
34+
}
35+
}
36+
}
2537
}
2638
}
2739
}

java-profiler/google-cloud-profiler/src/main/java/com/google/devtools/cloudprofiler/v2/package-info.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,32 @@
4949
* Profile response = profilerServiceClient.createProfile(request);
5050
* }
5151
* }</pre>
52+
*
53+
* <p>======================= ExportServiceClient =======================
54+
*
55+
* <p>Service Description: Service allows existing Cloud Profiler customers to export their profile
56+
* data out of Google Cloud.
57+
*
58+
* <p>Sample for ExportServiceClient:
59+
*
60+
* <pre>{@code
61+
* // This snippet has been automatically generated and should be regarded as a code template only.
62+
* // It will require modifications to work:
63+
* // - It may require correct/in-range values for request initialization.
64+
* // - It may require specifying regional endpoints when creating the service client as shown in
65+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
66+
* try (ExportServiceClient exportServiceClient = ExportServiceClient.create()) {
67+
* ListProfilesRequest request =
68+
* ListProfilesRequest.newBuilder()
69+
* .setParent(ProjectName.of("[PROJECT]").toString())
70+
* .setPageSize(883849137)
71+
* .setPageToken("pageToken873572522")
72+
* .build();
73+
* for (Profile element : exportServiceClient.listProfiles(request).iterateAll()) {
74+
* // doThingsWith(element);
75+
* }
76+
* }
77+
* }</pre>
5278
*/
5379
@Generated("by gapic-generator-java")
5480
package com.google.devtools.cloudprofiler.v2;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2023 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.devtools.cloudprofiler.v2.stub;
18+
19+
import static com.google.devtools.cloudprofiler.v2.ExportServiceClient.ListProfilesPagedResponse;
20+
21+
import com.google.api.gax.core.BackgroundResource;
22+
import com.google.api.gax.rpc.UnaryCallable;
23+
import com.google.devtools.cloudprofiler.v2.ListProfilesRequest;
24+
import com.google.devtools.cloudprofiler.v2.ListProfilesResponse;
25+
import javax.annotation.Generated;
26+
27+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
28+
/**
29+
* Base stub class for the ExportService service API.
30+
*
31+
* <p>This class is for advanced usage and reflects the underlying API directly.
32+
*/
33+
@Generated("by gapic-generator-java")
34+
public abstract class ExportServiceStub implements BackgroundResource {
35+
36+
public UnaryCallable<ListProfilesRequest, ListProfilesPagedResponse> listProfilesPagedCallable() {
37+
throw new UnsupportedOperationException("Not implemented: listProfilesPagedCallable()");
38+
}
39+
40+
public UnaryCallable<ListProfilesRequest, ListProfilesResponse> listProfilesCallable() {
41+
throw new UnsupportedOperationException("Not implemented: listProfilesCallable()");
42+
}
43+
44+
@Override
45+
public abstract void close();
46+
}

0 commit comments

Comments
 (0)