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