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