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.ImagesClient.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.ImagesStubSettings; 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 ImagesClient}. 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 * ImagesSettings.Builder imagesSettingsBuilder = ImagesSettings.newBuilder(); 62 * imagesSettingsBuilder 63 * .getSettings() 64 * .setRetrySettings( 65 * imagesSettingsBuilder 66 * .getSettings() 67 * .getRetrySettings() 68 * .toBuilder() 69 * .setTotalTimeout(Duration.ofSeconds(30)) 70 * .build()); 71 * ImagesSettings imagesSettings = imagesSettingsBuilder.build(); 72 * }</pre> 73 */ 74 @Generated("by gapic-generator-java") 75 public class ImagesSettings extends ClientSettings<ImagesSettings> { 76 77 /** Returns the object with the settings used for calls to delete. */ deleteSettings()78 public UnaryCallSettings<DeleteImageRequest, Operation> deleteSettings() { 79 return ((ImagesStubSettings) getStubSettings()).deleteSettings(); 80 } 81 82 /** Returns the object with the settings used for calls to delete. */ deleteOperationSettings()83 public OperationCallSettings<DeleteImageRequest, Operation, Operation> deleteOperationSettings() { 84 return ((ImagesStubSettings) getStubSettings()).deleteOperationSettings(); 85 } 86 87 /** Returns the object with the settings used for calls to deprecate. */ deprecateSettings()88 public UnaryCallSettings<DeprecateImageRequest, Operation> deprecateSettings() { 89 return ((ImagesStubSettings) getStubSettings()).deprecateSettings(); 90 } 91 92 /** Returns the object with the settings used for calls to deprecate. */ 93 public OperationCallSettings<DeprecateImageRequest, Operation, Operation> deprecateOperationSettings()94 deprecateOperationSettings() { 95 return ((ImagesStubSettings) getStubSettings()).deprecateOperationSettings(); 96 } 97 98 /** Returns the object with the settings used for calls to get. */ getSettings()99 public UnaryCallSettings<GetImageRequest, Image> getSettings() { 100 return ((ImagesStubSettings) getStubSettings()).getSettings(); 101 } 102 103 /** Returns the object with the settings used for calls to getFromFamily. */ getFromFamilySettings()104 public UnaryCallSettings<GetFromFamilyImageRequest, Image> getFromFamilySettings() { 105 return ((ImagesStubSettings) getStubSettings()).getFromFamilySettings(); 106 } 107 108 /** Returns the object with the settings used for calls to getIamPolicy. */ getIamPolicySettings()109 public UnaryCallSettings<GetIamPolicyImageRequest, Policy> getIamPolicySettings() { 110 return ((ImagesStubSettings) getStubSettings()).getIamPolicySettings(); 111 } 112 113 /** Returns the object with the settings used for calls to insert. */ insertSettings()114 public UnaryCallSettings<InsertImageRequest, Operation> insertSettings() { 115 return ((ImagesStubSettings) getStubSettings()).insertSettings(); 116 } 117 118 /** Returns the object with the settings used for calls to insert. */ insertOperationSettings()119 public OperationCallSettings<InsertImageRequest, Operation, Operation> insertOperationSettings() { 120 return ((ImagesStubSettings) getStubSettings()).insertOperationSettings(); 121 } 122 123 /** Returns the object with the settings used for calls to list. */ listSettings()124 public PagedCallSettings<ListImagesRequest, ImageList, ListPagedResponse> listSettings() { 125 return ((ImagesStubSettings) getStubSettings()).listSettings(); 126 } 127 128 /** Returns the object with the settings used for calls to patch. */ patchSettings()129 public UnaryCallSettings<PatchImageRequest, Operation> patchSettings() { 130 return ((ImagesStubSettings) getStubSettings()).patchSettings(); 131 } 132 133 /** Returns the object with the settings used for calls to patch. */ patchOperationSettings()134 public OperationCallSettings<PatchImageRequest, Operation, Operation> patchOperationSettings() { 135 return ((ImagesStubSettings) getStubSettings()).patchOperationSettings(); 136 } 137 138 /** Returns the object with the settings used for calls to setIamPolicy. */ setIamPolicySettings()139 public UnaryCallSettings<SetIamPolicyImageRequest, Policy> setIamPolicySettings() { 140 return ((ImagesStubSettings) getStubSettings()).setIamPolicySettings(); 141 } 142 143 /** Returns the object with the settings used for calls to setLabels. */ setLabelsSettings()144 public UnaryCallSettings<SetLabelsImageRequest, Operation> setLabelsSettings() { 145 return ((ImagesStubSettings) getStubSettings()).setLabelsSettings(); 146 } 147 148 /** Returns the object with the settings used for calls to setLabels. */ 149 public OperationCallSettings<SetLabelsImageRequest, Operation, Operation> setLabelsOperationSettings()150 setLabelsOperationSettings() { 151 return ((ImagesStubSettings) getStubSettings()).setLabelsOperationSettings(); 152 } 153 154 /** Returns the object with the settings used for calls to testIamPermissions. */ 155 public UnaryCallSettings<TestIamPermissionsImageRequest, TestPermissionsResponse> testIamPermissionsSettings()156 testIamPermissionsSettings() { 157 return ((ImagesStubSettings) getStubSettings()).testIamPermissionsSettings(); 158 } 159 create(ImagesStubSettings stub)160 public static final ImagesSettings create(ImagesStubSettings stub) throws IOException { 161 return new ImagesSettings.Builder(stub.toBuilder()).build(); 162 } 163 164 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()165 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 166 return ImagesStubSettings.defaultExecutorProviderBuilder(); 167 } 168 169 /** Returns the default service endpoint. */ getDefaultEndpoint()170 public static String getDefaultEndpoint() { 171 return ImagesStubSettings.getDefaultEndpoint(); 172 } 173 174 /** Returns the default service scopes. */ getDefaultServiceScopes()175 public static List<String> getDefaultServiceScopes() { 176 return ImagesStubSettings.getDefaultServiceScopes(); 177 } 178 179 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()180 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 181 return ImagesStubSettings.defaultCredentialsProviderBuilder(); 182 } 183 184 /** Returns a builder for the default ChannelProvider for this service. */ 185 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()186 defaultHttpJsonTransportProviderBuilder() { 187 return ImagesStubSettings.defaultHttpJsonTransportProviderBuilder(); 188 } 189 defaultTransportChannelProvider()190 public static TransportChannelProvider defaultTransportChannelProvider() { 191 return ImagesStubSettings.defaultTransportChannelProvider(); 192 } 193 194 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()195 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 196 return ImagesStubSettings.defaultApiClientHeaderProviderBuilder(); 197 } 198 199 /** Returns a new builder for this class. */ newBuilder()200 public static Builder newBuilder() { 201 return Builder.createDefault(); 202 } 203 204 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)205 public static Builder newBuilder(ClientContext clientContext) { 206 return new Builder(clientContext); 207 } 208 209 /** Returns a builder containing all the values of this settings class. */ toBuilder()210 public Builder toBuilder() { 211 return new Builder(this); 212 } 213 ImagesSettings(Builder settingsBuilder)214 protected ImagesSettings(Builder settingsBuilder) throws IOException { 215 super(settingsBuilder); 216 } 217 218 /** Builder for ImagesSettings. */ 219 public static class Builder extends ClientSettings.Builder<ImagesSettings, Builder> { 220 Builder()221 protected Builder() throws IOException { 222 this(((ClientContext) null)); 223 } 224 Builder(ClientContext clientContext)225 protected Builder(ClientContext clientContext) { 226 super(ImagesStubSettings.newBuilder(clientContext)); 227 } 228 Builder(ImagesSettings settings)229 protected Builder(ImagesSettings settings) { 230 super(settings.getStubSettings().toBuilder()); 231 } 232 Builder(ImagesStubSettings.Builder stubSettings)233 protected Builder(ImagesStubSettings.Builder stubSettings) { 234 super(stubSettings); 235 } 236 createDefault()237 private static Builder createDefault() { 238 return new Builder(ImagesStubSettings.newBuilder()); 239 } 240 getStubSettingsBuilder()241 public ImagesStubSettings.Builder getStubSettingsBuilder() { 242 return ((ImagesStubSettings.Builder) getStubSettings()); 243 } 244 245 /** 246 * Applies the given settings updater function to all of the unary API methods in this service. 247 * 248 * <p>Note: This method does not support applying settings to streaming methods. 249 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)250 public Builder applyToAllUnaryMethods( 251 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 252 super.applyToAllUnaryMethods( 253 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 254 return this; 255 } 256 257 /** Returns the builder for the settings used for calls to delete. */ deleteSettings()258 public UnaryCallSettings.Builder<DeleteImageRequest, Operation> deleteSettings() { 259 return getStubSettingsBuilder().deleteSettings(); 260 } 261 262 /** Returns the builder for the settings used for calls to delete. */ 263 public OperationCallSettings.Builder<DeleteImageRequest, Operation, Operation> deleteOperationSettings()264 deleteOperationSettings() { 265 return getStubSettingsBuilder().deleteOperationSettings(); 266 } 267 268 /** Returns the builder for the settings used for calls to deprecate. */ deprecateSettings()269 public UnaryCallSettings.Builder<DeprecateImageRequest, Operation> deprecateSettings() { 270 return getStubSettingsBuilder().deprecateSettings(); 271 } 272 273 /** Returns the builder for the settings used for calls to deprecate. */ 274 public OperationCallSettings.Builder<DeprecateImageRequest, Operation, Operation> deprecateOperationSettings()275 deprecateOperationSettings() { 276 return getStubSettingsBuilder().deprecateOperationSettings(); 277 } 278 279 /** Returns the builder for the settings used for calls to get. */ getSettings()280 public UnaryCallSettings.Builder<GetImageRequest, Image> getSettings() { 281 return getStubSettingsBuilder().getSettings(); 282 } 283 284 /** Returns the builder for the settings used for calls to getFromFamily. */ getFromFamilySettings()285 public UnaryCallSettings.Builder<GetFromFamilyImageRequest, Image> getFromFamilySettings() { 286 return getStubSettingsBuilder().getFromFamilySettings(); 287 } 288 289 /** Returns the builder for the settings used for calls to getIamPolicy. */ getIamPolicySettings()290 public UnaryCallSettings.Builder<GetIamPolicyImageRequest, Policy> getIamPolicySettings() { 291 return getStubSettingsBuilder().getIamPolicySettings(); 292 } 293 294 /** Returns the builder for the settings used for calls to insert. */ insertSettings()295 public UnaryCallSettings.Builder<InsertImageRequest, Operation> insertSettings() { 296 return getStubSettingsBuilder().insertSettings(); 297 } 298 299 /** Returns the builder for the settings used for calls to insert. */ 300 public OperationCallSettings.Builder<InsertImageRequest, Operation, Operation> insertOperationSettings()301 insertOperationSettings() { 302 return getStubSettingsBuilder().insertOperationSettings(); 303 } 304 305 /** Returns the builder for the settings used for calls to list. */ 306 public PagedCallSettings.Builder<ListImagesRequest, ImageList, ListPagedResponse> listSettings()307 listSettings() { 308 return getStubSettingsBuilder().listSettings(); 309 } 310 311 /** Returns the builder for the settings used for calls to patch. */ patchSettings()312 public UnaryCallSettings.Builder<PatchImageRequest, Operation> patchSettings() { 313 return getStubSettingsBuilder().patchSettings(); 314 } 315 316 /** Returns the builder for the settings used for calls to patch. */ 317 public OperationCallSettings.Builder<PatchImageRequest, Operation, Operation> patchOperationSettings()318 patchOperationSettings() { 319 return getStubSettingsBuilder().patchOperationSettings(); 320 } 321 322 /** Returns the builder for the settings used for calls to setIamPolicy. */ setIamPolicySettings()323 public UnaryCallSettings.Builder<SetIamPolicyImageRequest, Policy> setIamPolicySettings() { 324 return getStubSettingsBuilder().setIamPolicySettings(); 325 } 326 327 /** Returns the builder for the settings used for calls to setLabels. */ setLabelsSettings()328 public UnaryCallSettings.Builder<SetLabelsImageRequest, Operation> setLabelsSettings() { 329 return getStubSettingsBuilder().setLabelsSettings(); 330 } 331 332 /** Returns the builder for the settings used for calls to setLabels. */ 333 public OperationCallSettings.Builder<SetLabelsImageRequest, Operation, Operation> setLabelsOperationSettings()334 setLabelsOperationSettings() { 335 return getStubSettingsBuilder().setLabelsOperationSettings(); 336 } 337 338 /** Returns the builder for the settings used for calls to testIamPermissions. */ 339 public UnaryCallSettings.Builder<TestIamPermissionsImageRequest, TestPermissionsResponse> testIamPermissionsSettings()340 testIamPermissionsSettings() { 341 return getStubSettingsBuilder().testIamPermissionsSettings(); 342 } 343 344 @Override build()345 public ImagesSettings build() throws IOException { 346 return new ImagesSettings(this); 347 } 348 } 349 } 350