• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.compute.v1;
18 
19 import static com.google.cloud.compute.v1.ProjectsClient.GetXpnResourcesPagedResponse;
20 import static com.google.cloud.compute.v1.ProjectsClient.ListXpnHostsPagedResponse;
21 
22 import com.google.api.core.ApiFunction;
23 import com.google.api.core.BetaApi;
24 import com.google.api.gax.core.GoogleCredentialsProvider;
25 import com.google.api.gax.core.InstantiatingExecutorProvider;
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.OperationCallSettings;
31 import com.google.api.gax.rpc.PagedCallSettings;
32 import com.google.api.gax.rpc.TransportChannelProvider;
33 import com.google.api.gax.rpc.UnaryCallSettings;
34 import com.google.cloud.compute.v1.stub.ProjectsStubSettings;
35 import java.io.IOException;
36 import java.util.List;
37 import javax.annotation.Generated;
38 
39 // AUTO-GENERATED DOCUMENTATION AND CLASS.
40 /**
41  * Settings class to configure an instance of {@link ProjectsClient}.
42  *
43  * <p>The default instance has everything set to sensible defaults:
44  *
45  * <ul>
46  *   <li>The default service address (compute.googleapis.com) and default port (443) are used.
47  *   <li>Credentials are acquired automatically through Application Default Credentials.
48  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
49  * </ul>
50  *
51  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
52  * build() is called, the tree of builders is called to create the complete settings object.
53  *
54  * <p>For example, to set the total timeout of get to 30 seconds:
55  *
56  * <pre>{@code
57  * // This snippet has been automatically generated and should be regarded as a code template only.
58  * // It will require modifications to work:
59  * // - It may require correct/in-range values for request initialization.
60  * // - It may require specifying regional endpoints when creating the service client as shown in
61  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
62  * ProjectsSettings.Builder projectsSettingsBuilder = ProjectsSettings.newBuilder();
63  * projectsSettingsBuilder
64  *     .getSettings()
65  *     .setRetrySettings(
66  *         projectsSettingsBuilder
67  *             .getSettings()
68  *             .getRetrySettings()
69  *             .toBuilder()
70  *             .setTotalTimeout(Duration.ofSeconds(30))
71  *             .build());
72  * ProjectsSettings projectsSettings = projectsSettingsBuilder.build();
73  * }</pre>
74  */
75 @Generated("by gapic-generator-java")
76 public class ProjectsSettings extends ClientSettings<ProjectsSettings> {
77 
78   /** Returns the object with the settings used for calls to disableXpnHost. */
disableXpnHostSettings()79   public UnaryCallSettings<DisableXpnHostProjectRequest, Operation> disableXpnHostSettings() {
80     return ((ProjectsStubSettings) getStubSettings()).disableXpnHostSettings();
81   }
82 
83   /** Returns the object with the settings used for calls to disableXpnHost. */
84   public OperationCallSettings<DisableXpnHostProjectRequest, Operation, Operation>
disableXpnHostOperationSettings()85       disableXpnHostOperationSettings() {
86     return ((ProjectsStubSettings) getStubSettings()).disableXpnHostOperationSettings();
87   }
88 
89   /** Returns the object with the settings used for calls to disableXpnResource. */
90   public UnaryCallSettings<DisableXpnResourceProjectRequest, Operation>
disableXpnResourceSettings()91       disableXpnResourceSettings() {
92     return ((ProjectsStubSettings) getStubSettings()).disableXpnResourceSettings();
93   }
94 
95   /** Returns the object with the settings used for calls to disableXpnResource. */
96   public OperationCallSettings<DisableXpnResourceProjectRequest, Operation, Operation>
disableXpnResourceOperationSettings()97       disableXpnResourceOperationSettings() {
98     return ((ProjectsStubSettings) getStubSettings()).disableXpnResourceOperationSettings();
99   }
100 
101   /** Returns the object with the settings used for calls to enableXpnHost. */
enableXpnHostSettings()102   public UnaryCallSettings<EnableXpnHostProjectRequest, Operation> enableXpnHostSettings() {
103     return ((ProjectsStubSettings) getStubSettings()).enableXpnHostSettings();
104   }
105 
106   /** Returns the object with the settings used for calls to enableXpnHost. */
107   public OperationCallSettings<EnableXpnHostProjectRequest, Operation, Operation>
enableXpnHostOperationSettings()108       enableXpnHostOperationSettings() {
109     return ((ProjectsStubSettings) getStubSettings()).enableXpnHostOperationSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to enableXpnResource. */
enableXpnResourceSettings()113   public UnaryCallSettings<EnableXpnResourceProjectRequest, Operation> enableXpnResourceSettings() {
114     return ((ProjectsStubSettings) getStubSettings()).enableXpnResourceSettings();
115   }
116 
117   /** Returns the object with the settings used for calls to enableXpnResource. */
118   public OperationCallSettings<EnableXpnResourceProjectRequest, Operation, Operation>
enableXpnResourceOperationSettings()119       enableXpnResourceOperationSettings() {
120     return ((ProjectsStubSettings) getStubSettings()).enableXpnResourceOperationSettings();
121   }
122 
123   /** Returns the object with the settings used for calls to get. */
getSettings()124   public UnaryCallSettings<GetProjectRequest, Project> getSettings() {
125     return ((ProjectsStubSettings) getStubSettings()).getSettings();
126   }
127 
128   /** Returns the object with the settings used for calls to getXpnHost. */
getXpnHostSettings()129   public UnaryCallSettings<GetXpnHostProjectRequest, Project> getXpnHostSettings() {
130     return ((ProjectsStubSettings) getStubSettings()).getXpnHostSettings();
131   }
132 
133   /** Returns the object with the settings used for calls to getXpnResources. */
134   public PagedCallSettings<
135           GetXpnResourcesProjectsRequest, ProjectsGetXpnResources, GetXpnResourcesPagedResponse>
getXpnResourcesSettings()136       getXpnResourcesSettings() {
137     return ((ProjectsStubSettings) getStubSettings()).getXpnResourcesSettings();
138   }
139 
140   /** Returns the object with the settings used for calls to listXpnHosts. */
141   public PagedCallSettings<ListXpnHostsProjectsRequest, XpnHostList, ListXpnHostsPagedResponse>
listXpnHostsSettings()142       listXpnHostsSettings() {
143     return ((ProjectsStubSettings) getStubSettings()).listXpnHostsSettings();
144   }
145 
146   /** Returns the object with the settings used for calls to moveDisk. */
moveDiskSettings()147   public UnaryCallSettings<MoveDiskProjectRequest, Operation> moveDiskSettings() {
148     return ((ProjectsStubSettings) getStubSettings()).moveDiskSettings();
149   }
150 
151   /** Returns the object with the settings used for calls to moveDisk. */
152   public OperationCallSettings<MoveDiskProjectRequest, Operation, Operation>
moveDiskOperationSettings()153       moveDiskOperationSettings() {
154     return ((ProjectsStubSettings) getStubSettings()).moveDiskOperationSettings();
155   }
156 
157   /** Returns the object with the settings used for calls to moveInstance. */
moveInstanceSettings()158   public UnaryCallSettings<MoveInstanceProjectRequest, Operation> moveInstanceSettings() {
159     return ((ProjectsStubSettings) getStubSettings()).moveInstanceSettings();
160   }
161 
162   /** Returns the object with the settings used for calls to moveInstance. */
163   public OperationCallSettings<MoveInstanceProjectRequest, Operation, Operation>
moveInstanceOperationSettings()164       moveInstanceOperationSettings() {
165     return ((ProjectsStubSettings) getStubSettings()).moveInstanceOperationSettings();
166   }
167 
168   /** Returns the object with the settings used for calls to setCommonInstanceMetadata. */
169   public UnaryCallSettings<SetCommonInstanceMetadataProjectRequest, Operation>
setCommonInstanceMetadataSettings()170       setCommonInstanceMetadataSettings() {
171     return ((ProjectsStubSettings) getStubSettings()).setCommonInstanceMetadataSettings();
172   }
173 
174   /** Returns the object with the settings used for calls to setCommonInstanceMetadata. */
175   public OperationCallSettings<SetCommonInstanceMetadataProjectRequest, Operation, Operation>
setCommonInstanceMetadataOperationSettings()176       setCommonInstanceMetadataOperationSettings() {
177     return ((ProjectsStubSettings) getStubSettings()).setCommonInstanceMetadataOperationSettings();
178   }
179 
180   /** Returns the object with the settings used for calls to setDefaultNetworkTier. */
181   public UnaryCallSettings<SetDefaultNetworkTierProjectRequest, Operation>
setDefaultNetworkTierSettings()182       setDefaultNetworkTierSettings() {
183     return ((ProjectsStubSettings) getStubSettings()).setDefaultNetworkTierSettings();
184   }
185 
186   /** Returns the object with the settings used for calls to setDefaultNetworkTier. */
187   public OperationCallSettings<SetDefaultNetworkTierProjectRequest, Operation, Operation>
setDefaultNetworkTierOperationSettings()188       setDefaultNetworkTierOperationSettings() {
189     return ((ProjectsStubSettings) getStubSettings()).setDefaultNetworkTierOperationSettings();
190   }
191 
192   /** Returns the object with the settings used for calls to setUsageExportBucket. */
193   public UnaryCallSettings<SetUsageExportBucketProjectRequest, Operation>
setUsageExportBucketSettings()194       setUsageExportBucketSettings() {
195     return ((ProjectsStubSettings) getStubSettings()).setUsageExportBucketSettings();
196   }
197 
198   /** Returns the object with the settings used for calls to setUsageExportBucket. */
199   public OperationCallSettings<SetUsageExportBucketProjectRequest, Operation, Operation>
setUsageExportBucketOperationSettings()200       setUsageExportBucketOperationSettings() {
201     return ((ProjectsStubSettings) getStubSettings()).setUsageExportBucketOperationSettings();
202   }
203 
create(ProjectsStubSettings stub)204   public static final ProjectsSettings create(ProjectsStubSettings stub) throws IOException {
205     return new ProjectsSettings.Builder(stub.toBuilder()).build();
206   }
207 
208   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()209   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
210     return ProjectsStubSettings.defaultExecutorProviderBuilder();
211   }
212 
213   /** Returns the default service endpoint. */
getDefaultEndpoint()214   public static String getDefaultEndpoint() {
215     return ProjectsStubSettings.getDefaultEndpoint();
216   }
217 
218   /** Returns the default service scopes. */
getDefaultServiceScopes()219   public static List<String> getDefaultServiceScopes() {
220     return ProjectsStubSettings.getDefaultServiceScopes();
221   }
222 
223   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()224   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
225     return ProjectsStubSettings.defaultCredentialsProviderBuilder();
226   }
227 
228   /** Returns a builder for the default ChannelProvider for this service. */
229   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()230       defaultHttpJsonTransportProviderBuilder() {
231     return ProjectsStubSettings.defaultHttpJsonTransportProviderBuilder();
232   }
233 
defaultTransportChannelProvider()234   public static TransportChannelProvider defaultTransportChannelProvider() {
235     return ProjectsStubSettings.defaultTransportChannelProvider();
236   }
237 
238   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()239   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
240     return ProjectsStubSettings.defaultApiClientHeaderProviderBuilder();
241   }
242 
243   /** Returns a new builder for this class. */
newBuilder()244   public static Builder newBuilder() {
245     return Builder.createDefault();
246   }
247 
248   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)249   public static Builder newBuilder(ClientContext clientContext) {
250     return new Builder(clientContext);
251   }
252 
253   /** Returns a builder containing all the values of this settings class. */
toBuilder()254   public Builder toBuilder() {
255     return new Builder(this);
256   }
257 
ProjectsSettings(Builder settingsBuilder)258   protected ProjectsSettings(Builder settingsBuilder) throws IOException {
259     super(settingsBuilder);
260   }
261 
262   /** Builder for ProjectsSettings. */
263   public static class Builder extends ClientSettings.Builder<ProjectsSettings, Builder> {
264 
Builder()265     protected Builder() throws IOException {
266       this(((ClientContext) null));
267     }
268 
Builder(ClientContext clientContext)269     protected Builder(ClientContext clientContext) {
270       super(ProjectsStubSettings.newBuilder(clientContext));
271     }
272 
Builder(ProjectsSettings settings)273     protected Builder(ProjectsSettings settings) {
274       super(settings.getStubSettings().toBuilder());
275     }
276 
Builder(ProjectsStubSettings.Builder stubSettings)277     protected Builder(ProjectsStubSettings.Builder stubSettings) {
278       super(stubSettings);
279     }
280 
createDefault()281     private static Builder createDefault() {
282       return new Builder(ProjectsStubSettings.newBuilder());
283     }
284 
getStubSettingsBuilder()285     public ProjectsStubSettings.Builder getStubSettingsBuilder() {
286       return ((ProjectsStubSettings.Builder) getStubSettings());
287     }
288 
289     /**
290      * Applies the given settings updater function to all of the unary API methods in this service.
291      *
292      * <p>Note: This method does not support applying settings to streaming methods.
293      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)294     public Builder applyToAllUnaryMethods(
295         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
296       super.applyToAllUnaryMethods(
297           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
298       return this;
299     }
300 
301     /** Returns the builder for the settings used for calls to disableXpnHost. */
302     public UnaryCallSettings.Builder<DisableXpnHostProjectRequest, Operation>
disableXpnHostSettings()303         disableXpnHostSettings() {
304       return getStubSettingsBuilder().disableXpnHostSettings();
305     }
306 
307     /** Returns the builder for the settings used for calls to disableXpnHost. */
308     public OperationCallSettings.Builder<DisableXpnHostProjectRequest, Operation, Operation>
disableXpnHostOperationSettings()309         disableXpnHostOperationSettings() {
310       return getStubSettingsBuilder().disableXpnHostOperationSettings();
311     }
312 
313     /** Returns the builder for the settings used for calls to disableXpnResource. */
314     public UnaryCallSettings.Builder<DisableXpnResourceProjectRequest, Operation>
disableXpnResourceSettings()315         disableXpnResourceSettings() {
316       return getStubSettingsBuilder().disableXpnResourceSettings();
317     }
318 
319     /** Returns the builder for the settings used for calls to disableXpnResource. */
320     public OperationCallSettings.Builder<DisableXpnResourceProjectRequest, Operation, Operation>
disableXpnResourceOperationSettings()321         disableXpnResourceOperationSettings() {
322       return getStubSettingsBuilder().disableXpnResourceOperationSettings();
323     }
324 
325     /** Returns the builder for the settings used for calls to enableXpnHost. */
326     public UnaryCallSettings.Builder<EnableXpnHostProjectRequest, Operation>
enableXpnHostSettings()327         enableXpnHostSettings() {
328       return getStubSettingsBuilder().enableXpnHostSettings();
329     }
330 
331     /** Returns the builder for the settings used for calls to enableXpnHost. */
332     public OperationCallSettings.Builder<EnableXpnHostProjectRequest, Operation, Operation>
enableXpnHostOperationSettings()333         enableXpnHostOperationSettings() {
334       return getStubSettingsBuilder().enableXpnHostOperationSettings();
335     }
336 
337     /** Returns the builder for the settings used for calls to enableXpnResource. */
338     public UnaryCallSettings.Builder<EnableXpnResourceProjectRequest, Operation>
enableXpnResourceSettings()339         enableXpnResourceSettings() {
340       return getStubSettingsBuilder().enableXpnResourceSettings();
341     }
342 
343     /** Returns the builder for the settings used for calls to enableXpnResource. */
344     public OperationCallSettings.Builder<EnableXpnResourceProjectRequest, Operation, Operation>
enableXpnResourceOperationSettings()345         enableXpnResourceOperationSettings() {
346       return getStubSettingsBuilder().enableXpnResourceOperationSettings();
347     }
348 
349     /** Returns the builder for the settings used for calls to get. */
getSettings()350     public UnaryCallSettings.Builder<GetProjectRequest, Project> getSettings() {
351       return getStubSettingsBuilder().getSettings();
352     }
353 
354     /** Returns the builder for the settings used for calls to getXpnHost. */
getXpnHostSettings()355     public UnaryCallSettings.Builder<GetXpnHostProjectRequest, Project> getXpnHostSettings() {
356       return getStubSettingsBuilder().getXpnHostSettings();
357     }
358 
359     /** Returns the builder for the settings used for calls to getXpnResources. */
360     public PagedCallSettings.Builder<
361             GetXpnResourcesProjectsRequest, ProjectsGetXpnResources, GetXpnResourcesPagedResponse>
getXpnResourcesSettings()362         getXpnResourcesSettings() {
363       return getStubSettingsBuilder().getXpnResourcesSettings();
364     }
365 
366     /** Returns the builder for the settings used for calls to listXpnHosts. */
367     public PagedCallSettings.Builder<
368             ListXpnHostsProjectsRequest, XpnHostList, ListXpnHostsPagedResponse>
listXpnHostsSettings()369         listXpnHostsSettings() {
370       return getStubSettingsBuilder().listXpnHostsSettings();
371     }
372 
373     /** Returns the builder for the settings used for calls to moveDisk. */
moveDiskSettings()374     public UnaryCallSettings.Builder<MoveDiskProjectRequest, Operation> moveDiskSettings() {
375       return getStubSettingsBuilder().moveDiskSettings();
376     }
377 
378     /** Returns the builder for the settings used for calls to moveDisk. */
379     public OperationCallSettings.Builder<MoveDiskProjectRequest, Operation, Operation>
moveDiskOperationSettings()380         moveDiskOperationSettings() {
381       return getStubSettingsBuilder().moveDiskOperationSettings();
382     }
383 
384     /** Returns the builder for the settings used for calls to moveInstance. */
moveInstanceSettings()385     public UnaryCallSettings.Builder<MoveInstanceProjectRequest, Operation> moveInstanceSettings() {
386       return getStubSettingsBuilder().moveInstanceSettings();
387     }
388 
389     /** Returns the builder for the settings used for calls to moveInstance. */
390     public OperationCallSettings.Builder<MoveInstanceProjectRequest, Operation, Operation>
moveInstanceOperationSettings()391         moveInstanceOperationSettings() {
392       return getStubSettingsBuilder().moveInstanceOperationSettings();
393     }
394 
395     /** Returns the builder for the settings used for calls to setCommonInstanceMetadata. */
396     public UnaryCallSettings.Builder<SetCommonInstanceMetadataProjectRequest, Operation>
setCommonInstanceMetadataSettings()397         setCommonInstanceMetadataSettings() {
398       return getStubSettingsBuilder().setCommonInstanceMetadataSettings();
399     }
400 
401     /** Returns the builder for the settings used for calls to setCommonInstanceMetadata. */
402     public OperationCallSettings.Builder<
403             SetCommonInstanceMetadataProjectRequest, Operation, Operation>
setCommonInstanceMetadataOperationSettings()404         setCommonInstanceMetadataOperationSettings() {
405       return getStubSettingsBuilder().setCommonInstanceMetadataOperationSettings();
406     }
407 
408     /** Returns the builder for the settings used for calls to setDefaultNetworkTier. */
409     public UnaryCallSettings.Builder<SetDefaultNetworkTierProjectRequest, Operation>
setDefaultNetworkTierSettings()410         setDefaultNetworkTierSettings() {
411       return getStubSettingsBuilder().setDefaultNetworkTierSettings();
412     }
413 
414     /** Returns the builder for the settings used for calls to setDefaultNetworkTier. */
415     public OperationCallSettings.Builder<SetDefaultNetworkTierProjectRequest, Operation, Operation>
setDefaultNetworkTierOperationSettings()416         setDefaultNetworkTierOperationSettings() {
417       return getStubSettingsBuilder().setDefaultNetworkTierOperationSettings();
418     }
419 
420     /** Returns the builder for the settings used for calls to setUsageExportBucket. */
421     public UnaryCallSettings.Builder<SetUsageExportBucketProjectRequest, Operation>
setUsageExportBucketSettings()422         setUsageExportBucketSettings() {
423       return getStubSettingsBuilder().setUsageExportBucketSettings();
424     }
425 
426     /** Returns the builder for the settings used for calls to setUsageExportBucket. */
427     public OperationCallSettings.Builder<SetUsageExportBucketProjectRequest, Operation, Operation>
setUsageExportBucketOperationSettings()428         setUsageExportBucketOperationSettings() {
429       return getStubSettingsBuilder().setUsageExportBucketOperationSettings();
430     }
431 
432     @Override
build()433     public ProjectsSettings build() throws IOException {
434       return new ProjectsSettings(this);
435     }
436   }
437 }
438