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