• 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.InterconnectsClient.ListPagedResponse;
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.httpjson.InstantiatingHttpJsonChannelProvider;
26 import com.google.api.gax.rpc.ApiClientHeaderProvider;
27 import com.google.api.gax.rpc.ClientContext;
28 import com.google.api.gax.rpc.ClientSettings;
29 import com.google.api.gax.rpc.OperationCallSettings;
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.cloud.compute.v1.stub.InterconnectsStubSettings;
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 InterconnectsClient}.
41  *
42  * <p>The default instance has everything set to sensible defaults:
43  *
44  * <ul>
45  *   <li>The default service address (compute.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 get 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  * InterconnectsSettings.Builder interconnectsSettingsBuilder = InterconnectsSettings.newBuilder();
62  * interconnectsSettingsBuilder
63  *     .getSettings()
64  *     .setRetrySettings(
65  *         interconnectsSettingsBuilder
66  *             .getSettings()
67  *             .getRetrySettings()
68  *             .toBuilder()
69  *             .setTotalTimeout(Duration.ofSeconds(30))
70  *             .build());
71  * InterconnectsSettings interconnectsSettings = interconnectsSettingsBuilder.build();
72  * }</pre>
73  */
74 @Generated("by gapic-generator-java")
75 public class InterconnectsSettings extends ClientSettings<InterconnectsSettings> {
76 
77   /** Returns the object with the settings used for calls to delete. */
deleteSettings()78   public UnaryCallSettings<DeleteInterconnectRequest, Operation> deleteSettings() {
79     return ((InterconnectsStubSettings) getStubSettings()).deleteSettings();
80   }
81 
82   /** Returns the object with the settings used for calls to delete. */
83   public OperationCallSettings<DeleteInterconnectRequest, Operation, Operation>
deleteOperationSettings()84       deleteOperationSettings() {
85     return ((InterconnectsStubSettings) getStubSettings()).deleteOperationSettings();
86   }
87 
88   /** Returns the object with the settings used for calls to get. */
getSettings()89   public UnaryCallSettings<GetInterconnectRequest, Interconnect> getSettings() {
90     return ((InterconnectsStubSettings) getStubSettings()).getSettings();
91   }
92 
93   /** Returns the object with the settings used for calls to getDiagnostics. */
94   public UnaryCallSettings<GetDiagnosticsInterconnectRequest, InterconnectsGetDiagnosticsResponse>
getDiagnosticsSettings()95       getDiagnosticsSettings() {
96     return ((InterconnectsStubSettings) getStubSettings()).getDiagnosticsSettings();
97   }
98 
99   /** Returns the object with the settings used for calls to insert. */
insertSettings()100   public UnaryCallSettings<InsertInterconnectRequest, Operation> insertSettings() {
101     return ((InterconnectsStubSettings) getStubSettings()).insertSettings();
102   }
103 
104   /** Returns the object with the settings used for calls to insert. */
105   public OperationCallSettings<InsertInterconnectRequest, Operation, Operation>
insertOperationSettings()106       insertOperationSettings() {
107     return ((InterconnectsStubSettings) getStubSettings()).insertOperationSettings();
108   }
109 
110   /** Returns the object with the settings used for calls to list. */
111   public PagedCallSettings<ListInterconnectsRequest, InterconnectList, ListPagedResponse>
listSettings()112       listSettings() {
113     return ((InterconnectsStubSettings) getStubSettings()).listSettings();
114   }
115 
116   /** Returns the object with the settings used for calls to patch. */
patchSettings()117   public UnaryCallSettings<PatchInterconnectRequest, Operation> patchSettings() {
118     return ((InterconnectsStubSettings) getStubSettings()).patchSettings();
119   }
120 
121   /** Returns the object with the settings used for calls to patch. */
122   public OperationCallSettings<PatchInterconnectRequest, Operation, Operation>
patchOperationSettings()123       patchOperationSettings() {
124     return ((InterconnectsStubSettings) getStubSettings()).patchOperationSettings();
125   }
126 
127   /** Returns the object with the settings used for calls to setLabels. */
setLabelsSettings()128   public UnaryCallSettings<SetLabelsInterconnectRequest, Operation> setLabelsSettings() {
129     return ((InterconnectsStubSettings) getStubSettings()).setLabelsSettings();
130   }
131 
132   /** Returns the object with the settings used for calls to setLabels. */
133   public OperationCallSettings<SetLabelsInterconnectRequest, Operation, Operation>
setLabelsOperationSettings()134       setLabelsOperationSettings() {
135     return ((InterconnectsStubSettings) getStubSettings()).setLabelsOperationSettings();
136   }
137 
create(InterconnectsStubSettings stub)138   public static final InterconnectsSettings create(InterconnectsStubSettings stub)
139       throws IOException {
140     return new InterconnectsSettings.Builder(stub.toBuilder()).build();
141   }
142 
143   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()144   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
145     return InterconnectsStubSettings.defaultExecutorProviderBuilder();
146   }
147 
148   /** Returns the default service endpoint. */
getDefaultEndpoint()149   public static String getDefaultEndpoint() {
150     return InterconnectsStubSettings.getDefaultEndpoint();
151   }
152 
153   /** Returns the default service scopes. */
getDefaultServiceScopes()154   public static List<String> getDefaultServiceScopes() {
155     return InterconnectsStubSettings.getDefaultServiceScopes();
156   }
157 
158   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()159   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
160     return InterconnectsStubSettings.defaultCredentialsProviderBuilder();
161   }
162 
163   /** Returns a builder for the default ChannelProvider for this service. */
164   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()165       defaultHttpJsonTransportProviderBuilder() {
166     return InterconnectsStubSettings.defaultHttpJsonTransportProviderBuilder();
167   }
168 
defaultTransportChannelProvider()169   public static TransportChannelProvider defaultTransportChannelProvider() {
170     return InterconnectsStubSettings.defaultTransportChannelProvider();
171   }
172 
173   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()174   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
175     return InterconnectsStubSettings.defaultApiClientHeaderProviderBuilder();
176   }
177 
178   /** Returns a new builder for this class. */
newBuilder()179   public static Builder newBuilder() {
180     return Builder.createDefault();
181   }
182 
183   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)184   public static Builder newBuilder(ClientContext clientContext) {
185     return new Builder(clientContext);
186   }
187 
188   /** Returns a builder containing all the values of this settings class. */
toBuilder()189   public Builder toBuilder() {
190     return new Builder(this);
191   }
192 
InterconnectsSettings(Builder settingsBuilder)193   protected InterconnectsSettings(Builder settingsBuilder) throws IOException {
194     super(settingsBuilder);
195   }
196 
197   /** Builder for InterconnectsSettings. */
198   public static class Builder extends ClientSettings.Builder<InterconnectsSettings, Builder> {
199 
Builder()200     protected Builder() throws IOException {
201       this(((ClientContext) null));
202     }
203 
Builder(ClientContext clientContext)204     protected Builder(ClientContext clientContext) {
205       super(InterconnectsStubSettings.newBuilder(clientContext));
206     }
207 
Builder(InterconnectsSettings settings)208     protected Builder(InterconnectsSettings settings) {
209       super(settings.getStubSettings().toBuilder());
210     }
211 
Builder(InterconnectsStubSettings.Builder stubSettings)212     protected Builder(InterconnectsStubSettings.Builder stubSettings) {
213       super(stubSettings);
214     }
215 
createDefault()216     private static Builder createDefault() {
217       return new Builder(InterconnectsStubSettings.newBuilder());
218     }
219 
getStubSettingsBuilder()220     public InterconnectsStubSettings.Builder getStubSettingsBuilder() {
221       return ((InterconnectsStubSettings.Builder) getStubSettings());
222     }
223 
224     /**
225      * Applies the given settings updater function to all of the unary API methods in this service.
226      *
227      * <p>Note: This method does not support applying settings to streaming methods.
228      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)229     public Builder applyToAllUnaryMethods(
230         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
231       super.applyToAllUnaryMethods(
232           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
233       return this;
234     }
235 
236     /** Returns the builder for the settings used for calls to delete. */
deleteSettings()237     public UnaryCallSettings.Builder<DeleteInterconnectRequest, Operation> deleteSettings() {
238       return getStubSettingsBuilder().deleteSettings();
239     }
240 
241     /** Returns the builder for the settings used for calls to delete. */
242     public OperationCallSettings.Builder<DeleteInterconnectRequest, Operation, Operation>
deleteOperationSettings()243         deleteOperationSettings() {
244       return getStubSettingsBuilder().deleteOperationSettings();
245     }
246 
247     /** Returns the builder for the settings used for calls to get. */
getSettings()248     public UnaryCallSettings.Builder<GetInterconnectRequest, Interconnect> getSettings() {
249       return getStubSettingsBuilder().getSettings();
250     }
251 
252     /** Returns the builder for the settings used for calls to getDiagnostics. */
253     public UnaryCallSettings.Builder<
254             GetDiagnosticsInterconnectRequest, InterconnectsGetDiagnosticsResponse>
getDiagnosticsSettings()255         getDiagnosticsSettings() {
256       return getStubSettingsBuilder().getDiagnosticsSettings();
257     }
258 
259     /** Returns the builder for the settings used for calls to insert. */
insertSettings()260     public UnaryCallSettings.Builder<InsertInterconnectRequest, Operation> insertSettings() {
261       return getStubSettingsBuilder().insertSettings();
262     }
263 
264     /** Returns the builder for the settings used for calls to insert. */
265     public OperationCallSettings.Builder<InsertInterconnectRequest, Operation, Operation>
insertOperationSettings()266         insertOperationSettings() {
267       return getStubSettingsBuilder().insertOperationSettings();
268     }
269 
270     /** Returns the builder for the settings used for calls to list. */
271     public PagedCallSettings.Builder<ListInterconnectsRequest, InterconnectList, ListPagedResponse>
listSettings()272         listSettings() {
273       return getStubSettingsBuilder().listSettings();
274     }
275 
276     /** Returns the builder for the settings used for calls to patch. */
patchSettings()277     public UnaryCallSettings.Builder<PatchInterconnectRequest, Operation> patchSettings() {
278       return getStubSettingsBuilder().patchSettings();
279     }
280 
281     /** Returns the builder for the settings used for calls to patch. */
282     public OperationCallSettings.Builder<PatchInterconnectRequest, Operation, Operation>
patchOperationSettings()283         patchOperationSettings() {
284       return getStubSettingsBuilder().patchOperationSettings();
285     }
286 
287     /** Returns the builder for the settings used for calls to setLabels. */
setLabelsSettings()288     public UnaryCallSettings.Builder<SetLabelsInterconnectRequest, Operation> setLabelsSettings() {
289       return getStubSettingsBuilder().setLabelsSettings();
290     }
291 
292     /** Returns the builder for the settings used for calls to setLabels. */
293     public OperationCallSettings.Builder<SetLabelsInterconnectRequest, Operation, Operation>
setLabelsOperationSettings()294         setLabelsOperationSettings() {
295       return getStubSettingsBuilder().setLabelsOperationSettings();
296     }
297 
298     @Override
build()299     public InterconnectsSettings build() throws IOException {
300       return new InterconnectsSettings(this);
301     }
302   }
303 }
304