Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Commit b612d8e

Browse files
feat: add AutoscalingPolicyServiceClient (#66)
1 parent 5321a0f commit b612d8e

17 files changed

+2710
-1528
lines changed

.kokoro/linkage-monitor.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ cd github/java-dataproc/
2323
java -version
2424
echo ${JOB_TYPE}
2525

26-
mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgcloud.download.skip=true -B -V
26+
mvn install -B -V \
27+
-DskipTests=true \
28+
-Dclirr.skip=true \
29+
-Denforcer.skip=true \
30+
-Dmaven.javadoc.skip=true \
31+
-Dgcloud.download.skip=true
2732

2833
# Kokoro job cloud-opensource-java/ubuntu/linkage-monitor-gcs creates this JAR
2934
JAR=linkage-monitor-latest-all-deps.jar

google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/AutoscalingPolicyServiceClient.java

Lines changed: 701 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
/*
2+
* Copyright 2020 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+
package com.google.cloud.dataproc.v1;
17+
18+
import static com.google.cloud.dataproc.v1.AutoscalingPolicyServiceClient.ListAutoscalingPoliciesPagedResponse;
19+
20+
import com.google.api.core.ApiFunction;
21+
import com.google.api.core.BetaApi;
22+
import com.google.api.gax.core.GoogleCredentialsProvider;
23+
import com.google.api.gax.core.InstantiatingExecutorProvider;
24+
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
25+
import com.google.api.gax.rpc.ApiClientHeaderProvider;
26+
import com.google.api.gax.rpc.ClientContext;
27+
import com.google.api.gax.rpc.ClientSettings;
28+
import com.google.api.gax.rpc.PagedCallSettings;
29+
import com.google.api.gax.rpc.TransportChannelProvider;
30+
import com.google.api.gax.rpc.UnaryCallSettings;
31+
import com.google.cloud.dataproc.v1.stub.AutoscalingPolicyServiceStubSettings;
32+
import com.google.protobuf.Empty;
33+
import java.io.IOException;
34+
import java.util.List;
35+
import javax.annotation.Generated;
36+
37+
// AUTO-GENERATED DOCUMENTATION AND CLASS
38+
/**
39+
* Settings class to configure an instance of {@link AutoscalingPolicyServiceClient}.
40+
*
41+
* <p>The default instance has everything set to sensible defaults:
42+
*
43+
* <ul>
44+
* <li>The default service address (dataproc.googleapis.com) and default port (443) are used.
45+
* <li>Credentials are acquired automatically through Application Default Credentials.
46+
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
47+
* </ul>
48+
*
49+
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
50+
* build() is called, the tree of builders is called to create the complete settings object.
51+
*
52+
* <p>For example, to set the total timeout of createAutoscalingPolicy to 30 seconds:
53+
*
54+
* <pre>
55+
* <code>
56+
* AutoscalingPolicyServiceSettings.Builder autoscalingPolicyServiceSettingsBuilder =
57+
* AutoscalingPolicyServiceSettings.newBuilder();
58+
* autoscalingPolicyServiceSettingsBuilder.createAutoscalingPolicySettings().getRetrySettings().toBuilder()
59+
* .setTotalTimeout(Duration.ofSeconds(30));
60+
* AutoscalingPolicyServiceSettings autoscalingPolicyServiceSettings = autoscalingPolicyServiceSettingsBuilder.build();
61+
* </code>
62+
* </pre>
63+
*/
64+
@Generated("by gapic-generator")
65+
@BetaApi
66+
public class AutoscalingPolicyServiceSettings
67+
extends ClientSettings<AutoscalingPolicyServiceSettings> {
68+
/** Returns the object with the settings used for calls to createAutoscalingPolicy. */
69+
public UnaryCallSettings<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
70+
createAutoscalingPolicySettings() {
71+
return ((AutoscalingPolicyServiceStubSettings) getStubSettings())
72+
.createAutoscalingPolicySettings();
73+
}
74+
75+
/** Returns the object with the settings used for calls to updateAutoscalingPolicy. */
76+
public UnaryCallSettings<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
77+
updateAutoscalingPolicySettings() {
78+
return ((AutoscalingPolicyServiceStubSettings) getStubSettings())
79+
.updateAutoscalingPolicySettings();
80+
}
81+
82+
/** Returns the object with the settings used for calls to getAutoscalingPolicy. */
83+
public UnaryCallSettings<GetAutoscalingPolicyRequest, AutoscalingPolicy>
84+
getAutoscalingPolicySettings() {
85+
return ((AutoscalingPolicyServiceStubSettings) getStubSettings())
86+
.getAutoscalingPolicySettings();
87+
}
88+
89+
/** Returns the object with the settings used for calls to listAutoscalingPolicies. */
90+
public PagedCallSettings<
91+
ListAutoscalingPoliciesRequest,
92+
ListAutoscalingPoliciesResponse,
93+
ListAutoscalingPoliciesPagedResponse>
94+
listAutoscalingPoliciesSettings() {
95+
return ((AutoscalingPolicyServiceStubSettings) getStubSettings())
96+
.listAutoscalingPoliciesSettings();
97+
}
98+
99+
/** Returns the object with the settings used for calls to deleteAutoscalingPolicy. */
100+
public UnaryCallSettings<DeleteAutoscalingPolicyRequest, Empty>
101+
deleteAutoscalingPolicySettings() {
102+
return ((AutoscalingPolicyServiceStubSettings) getStubSettings())
103+
.deleteAutoscalingPolicySettings();
104+
}
105+
106+
public static final AutoscalingPolicyServiceSettings create(
107+
AutoscalingPolicyServiceStubSettings stub) throws IOException {
108+
return new AutoscalingPolicyServiceSettings.Builder(stub.toBuilder()).build();
109+
}
110+
111+
/** Returns a builder for the default ExecutorProvider for this service. */
112+
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
113+
return AutoscalingPolicyServiceStubSettings.defaultExecutorProviderBuilder();
114+
}
115+
116+
/** Returns the default service endpoint. */
117+
public static String getDefaultEndpoint() {
118+
return AutoscalingPolicyServiceStubSettings.getDefaultEndpoint();
119+
}
120+
121+
/** Returns the default service scopes. */
122+
public static List<String> getDefaultServiceScopes() {
123+
return AutoscalingPolicyServiceStubSettings.getDefaultServiceScopes();
124+
}
125+
126+
/** Returns a builder for the default credentials for this service. */
127+
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
128+
return AutoscalingPolicyServiceStubSettings.defaultCredentialsProviderBuilder();
129+
}
130+
131+
/** Returns a builder for the default ChannelProvider for this service. */
132+
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
133+
return AutoscalingPolicyServiceStubSettings.defaultGrpcTransportProviderBuilder();
134+
}
135+
136+
public static TransportChannelProvider defaultTransportChannelProvider() {
137+
return AutoscalingPolicyServiceStubSettings.defaultTransportChannelProvider();
138+
}
139+
140+
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
141+
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
142+
return AutoscalingPolicyServiceStubSettings.defaultApiClientHeaderProviderBuilder();
143+
}
144+
145+
/** Returns a new builder for this class. */
146+
public static Builder newBuilder() {
147+
return Builder.createDefault();
148+
}
149+
150+
/** Returns a new builder for this class. */
151+
public static Builder newBuilder(ClientContext clientContext) {
152+
return new Builder(clientContext);
153+
}
154+
155+
/** Returns a builder containing all the values of this settings class. */
156+
public Builder toBuilder() {
157+
return new Builder(this);
158+
}
159+
160+
protected AutoscalingPolicyServiceSettings(Builder settingsBuilder) throws IOException {
161+
super(settingsBuilder);
162+
}
163+
164+
/** Builder for AutoscalingPolicyServiceSettings. */
165+
public static class Builder
166+
extends ClientSettings.Builder<AutoscalingPolicyServiceSettings, Builder> {
167+
protected Builder() throws IOException {
168+
this((ClientContext) null);
169+
}
170+
171+
protected Builder(ClientContext clientContext) {
172+
super(AutoscalingPolicyServiceStubSettings.newBuilder(clientContext));
173+
}
174+
175+
private static Builder createDefault() {
176+
return new Builder(AutoscalingPolicyServiceStubSettings.newBuilder());
177+
}
178+
179+
protected Builder(AutoscalingPolicyServiceSettings settings) {
180+
super(settings.getStubSettings().toBuilder());
181+
}
182+
183+
protected Builder(AutoscalingPolicyServiceStubSettings.Builder stubSettings) {
184+
super(stubSettings);
185+
}
186+
187+
public AutoscalingPolicyServiceStubSettings.Builder getStubSettingsBuilder() {
188+
return ((AutoscalingPolicyServiceStubSettings.Builder) getStubSettings());
189+
}
190+
191+
// NEXT_MAJOR_VER: remove 'throws Exception'
192+
/**
193+
* Applies the given settings updater function to all of the unary API methods in this service.
194+
*
195+
* <p>Note: This method does not support applying settings to streaming methods.
196+
*/
197+
public Builder applyToAllUnaryMethods(
198+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
199+
super.applyToAllUnaryMethods(
200+
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
201+
return this;
202+
}
203+
204+
/** Returns the builder for the settings used for calls to createAutoscalingPolicy. */
205+
public UnaryCallSettings.Builder<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
206+
createAutoscalingPolicySettings() {
207+
return getStubSettingsBuilder().createAutoscalingPolicySettings();
208+
}
209+
210+
/** Returns the builder for the settings used for calls to updateAutoscalingPolicy. */
211+
public UnaryCallSettings.Builder<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
212+
updateAutoscalingPolicySettings() {
213+
return getStubSettingsBuilder().updateAutoscalingPolicySettings();
214+
}
215+
216+
/** Returns the builder for the settings used for calls to getAutoscalingPolicy. */
217+
public UnaryCallSettings.Builder<GetAutoscalingPolicyRequest, AutoscalingPolicy>
218+
getAutoscalingPolicySettings() {
219+
return getStubSettingsBuilder().getAutoscalingPolicySettings();
220+
}
221+
222+
/** Returns the builder for the settings used for calls to listAutoscalingPolicies. */
223+
public PagedCallSettings.Builder<
224+
ListAutoscalingPoliciesRequest,
225+
ListAutoscalingPoliciesResponse,
226+
ListAutoscalingPoliciesPagedResponse>
227+
listAutoscalingPoliciesSettings() {
228+
return getStubSettingsBuilder().listAutoscalingPoliciesSettings();
229+
}
230+
231+
/** Returns the builder for the settings used for calls to deleteAutoscalingPolicy. */
232+
public UnaryCallSettings.Builder<DeleteAutoscalingPolicyRequest, Empty>
233+
deleteAutoscalingPolicySettings() {
234+
return getStubSettingsBuilder().deleteAutoscalingPolicySettings();
235+
}
236+
237+
@Override
238+
public AutoscalingPolicyServiceSettings build() throws IOException {
239+
return new AutoscalingPolicyServiceSettings(this);
240+
}
241+
}
242+
}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,22 @@
6969
* }
7070
* </code>
7171
* </pre>
72+
*
73+
* ============================== AutoscalingPolicyServiceClient ==============================
74+
*
75+
* <p>Service Description: The API interface for managing autoscaling policies in the Dataproc API.
76+
*
77+
* <p>Sample for AutoscalingPolicyServiceClient:
78+
*
79+
* <pre>
80+
* <code>
81+
* try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.create()) {
82+
* String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
83+
* AutoscalingPolicy policy = AutoscalingPolicy.newBuilder().build();
84+
* AutoscalingPolicy response = autoscalingPolicyServiceClient.createAutoscalingPolicy(formattedParent, policy);
85+
* }
86+
* </code>
87+
* </pre>
7288
*/
7389
@Generated("by gapic-generator")
7490
package com.google.cloud.dataproc.v1;
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright 2020 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+
package com.google.cloud.dataproc.v1.stub;
17+
18+
import static com.google.cloud.dataproc.v1.AutoscalingPolicyServiceClient.ListAutoscalingPoliciesPagedResponse;
19+
20+
import com.google.api.core.BetaApi;
21+
import com.google.api.gax.core.BackgroundResource;
22+
import com.google.api.gax.rpc.UnaryCallable;
23+
import com.google.cloud.dataproc.v1.AutoscalingPolicy;
24+
import com.google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest;
25+
import com.google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest;
26+
import com.google.cloud.dataproc.v1.GetAutoscalingPolicyRequest;
27+
import com.google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest;
28+
import com.google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse;
29+
import com.google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest;
30+
import com.google.protobuf.Empty;
31+
import javax.annotation.Generated;
32+
33+
// AUTO-GENERATED DOCUMENTATION AND CLASS
34+
/**
35+
* Base stub class for Google Cloud Dataproc API.
36+
*
37+
* <p>This class is for advanced usage and reflects the underlying API directly.
38+
*/
39+
@Generated("by gapic-generator")
40+
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
41+
public abstract class AutoscalingPolicyServiceStub implements BackgroundResource {
42+
43+
public UnaryCallable<CreateAutoscalingPolicyRequest, AutoscalingPolicy>
44+
createAutoscalingPolicyCallable() {
45+
throw new UnsupportedOperationException("Not implemented: createAutoscalingPolicyCallable()");
46+
}
47+
48+
public UnaryCallable<UpdateAutoscalingPolicyRequest, AutoscalingPolicy>
49+
updateAutoscalingPolicyCallable() {
50+
throw new UnsupportedOperationException("Not implemented: updateAutoscalingPolicyCallable()");
51+
}
52+
53+
public UnaryCallable<GetAutoscalingPolicyRequest, AutoscalingPolicy>
54+
getAutoscalingPolicyCallable() {
55+
throw new UnsupportedOperationException("Not implemented: getAutoscalingPolicyCallable()");
56+
}
57+
58+
public UnaryCallable<ListAutoscalingPoliciesRequest, ListAutoscalingPoliciesPagedResponse>
59+
listAutoscalingPoliciesPagedCallable() {
60+
throw new UnsupportedOperationException(
61+
"Not implemented: listAutoscalingPoliciesPagedCallable()");
62+
}
63+
64+
public UnaryCallable<ListAutoscalingPoliciesRequest, ListAutoscalingPoliciesResponse>
65+
listAutoscalingPoliciesCallable() {
66+
throw new UnsupportedOperationException("Not implemented: listAutoscalingPoliciesCallable()");
67+
}
68+
69+
public UnaryCallable<DeleteAutoscalingPolicyRequest, Empty> deleteAutoscalingPolicyCallable() {
70+
throw new UnsupportedOperationException("Not implemented: deleteAutoscalingPolicyCallable()");
71+
}
72+
73+
@Override
74+
public abstract void close();
75+
}

0 commit comments

Comments
 (0)