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.InterconnectLocationsClient.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.PagedCallSettings; 30 import com.google.api.gax.rpc.TransportChannelProvider; 31 import com.google.api.gax.rpc.UnaryCallSettings; 32 import com.google.cloud.compute.v1.stub.InterconnectLocationsStubSettings; 33 import java.io.IOException; 34 import java.util.List; 35 import javax.annotation.Generated; 36 37 // AUTO-GENERATED DOCUMENTATION AND CLASS. 38 /** 39 * Settings class to configure an instance of {@link InterconnectLocationsClient}. 40 * 41 * <p>The default instance has everything set to sensible defaults: 42 * 43 * <ul> 44 * <li>The default service address (compute.googleapis.com) and default port (443) are used. 45 * <li>Credentials are acquired automatically through Application Default Credentials. 46 * <li>Retries are configured for idempotent methods but not for non-idempotent methods. 47 * </ul> 48 * 49 * <p>The builder of this class is recursive, so contained classes are themselves builders. When 50 * build() is called, the tree of builders is called to create the complete settings object. 51 * 52 * <p>For example, to set the total timeout of get to 30 seconds: 53 * 54 * <pre>{@code 55 * // This snippet has been automatically generated and should be regarded as a code template only. 56 * // It will require modifications to work: 57 * // - It may require correct/in-range values for request initialization. 58 * // - It may require specifying regional endpoints when creating the service client as shown in 59 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 60 * InterconnectLocationsSettings.Builder interconnectLocationsSettingsBuilder = 61 * InterconnectLocationsSettings.newBuilder(); 62 * interconnectLocationsSettingsBuilder 63 * .getSettings() 64 * .setRetrySettings( 65 * interconnectLocationsSettingsBuilder 66 * .getSettings() 67 * .getRetrySettings() 68 * .toBuilder() 69 * .setTotalTimeout(Duration.ofSeconds(30)) 70 * .build()); 71 * InterconnectLocationsSettings interconnectLocationsSettings = 72 * interconnectLocationsSettingsBuilder.build(); 73 * }</pre> 74 */ 75 @Generated("by gapic-generator-java") 76 public class InterconnectLocationsSettings extends ClientSettings<InterconnectLocationsSettings> { 77 78 /** Returns the object with the settings used for calls to get. */ getSettings()79 public UnaryCallSettings<GetInterconnectLocationRequest, InterconnectLocation> getSettings() { 80 return ((InterconnectLocationsStubSettings) getStubSettings()).getSettings(); 81 } 82 83 /** Returns the object with the settings used for calls to list. */ 84 public PagedCallSettings< 85 ListInterconnectLocationsRequest, InterconnectLocationList, ListPagedResponse> listSettings()86 listSettings() { 87 return ((InterconnectLocationsStubSettings) getStubSettings()).listSettings(); 88 } 89 create(InterconnectLocationsStubSettings stub)90 public static final InterconnectLocationsSettings create(InterconnectLocationsStubSettings stub) 91 throws IOException { 92 return new InterconnectLocationsSettings.Builder(stub.toBuilder()).build(); 93 } 94 95 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()96 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 97 return InterconnectLocationsStubSettings.defaultExecutorProviderBuilder(); 98 } 99 100 /** Returns the default service endpoint. */ getDefaultEndpoint()101 public static String getDefaultEndpoint() { 102 return InterconnectLocationsStubSettings.getDefaultEndpoint(); 103 } 104 105 /** Returns the default service scopes. */ getDefaultServiceScopes()106 public static List<String> getDefaultServiceScopes() { 107 return InterconnectLocationsStubSettings.getDefaultServiceScopes(); 108 } 109 110 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()111 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 112 return InterconnectLocationsStubSettings.defaultCredentialsProviderBuilder(); 113 } 114 115 /** Returns a builder for the default ChannelProvider for this service. */ 116 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()117 defaultHttpJsonTransportProviderBuilder() { 118 return InterconnectLocationsStubSettings.defaultHttpJsonTransportProviderBuilder(); 119 } 120 defaultTransportChannelProvider()121 public static TransportChannelProvider defaultTransportChannelProvider() { 122 return InterconnectLocationsStubSettings.defaultTransportChannelProvider(); 123 } 124 125 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()126 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 127 return InterconnectLocationsStubSettings.defaultApiClientHeaderProviderBuilder(); 128 } 129 130 /** Returns a new builder for this class. */ newBuilder()131 public static Builder newBuilder() { 132 return Builder.createDefault(); 133 } 134 135 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)136 public static Builder newBuilder(ClientContext clientContext) { 137 return new Builder(clientContext); 138 } 139 140 /** Returns a builder containing all the values of this settings class. */ toBuilder()141 public Builder toBuilder() { 142 return new Builder(this); 143 } 144 InterconnectLocationsSettings(Builder settingsBuilder)145 protected InterconnectLocationsSettings(Builder settingsBuilder) throws IOException { 146 super(settingsBuilder); 147 } 148 149 /** Builder for InterconnectLocationsSettings. */ 150 public static class Builder 151 extends ClientSettings.Builder<InterconnectLocationsSettings, Builder> { 152 Builder()153 protected Builder() throws IOException { 154 this(((ClientContext) null)); 155 } 156 Builder(ClientContext clientContext)157 protected Builder(ClientContext clientContext) { 158 super(InterconnectLocationsStubSettings.newBuilder(clientContext)); 159 } 160 Builder(InterconnectLocationsSettings settings)161 protected Builder(InterconnectLocationsSettings settings) { 162 super(settings.getStubSettings().toBuilder()); 163 } 164 Builder(InterconnectLocationsStubSettings.Builder stubSettings)165 protected Builder(InterconnectLocationsStubSettings.Builder stubSettings) { 166 super(stubSettings); 167 } 168 createDefault()169 private static Builder createDefault() { 170 return new Builder(InterconnectLocationsStubSettings.newBuilder()); 171 } 172 getStubSettingsBuilder()173 public InterconnectLocationsStubSettings.Builder getStubSettingsBuilder() { 174 return ((InterconnectLocationsStubSettings.Builder) getStubSettings()); 175 } 176 177 /** 178 * Applies the given settings updater function to all of the unary API methods in this service. 179 * 180 * <p>Note: This method does not support applying settings to streaming methods. 181 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)182 public Builder applyToAllUnaryMethods( 183 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 184 super.applyToAllUnaryMethods( 185 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 186 return this; 187 } 188 189 /** Returns the builder for the settings used for calls to get. */ 190 public UnaryCallSettings.Builder<GetInterconnectLocationRequest, InterconnectLocation> getSettings()191 getSettings() { 192 return getStubSettingsBuilder().getSettings(); 193 } 194 195 /** Returns the builder for the settings used for calls to list. */ 196 public PagedCallSettings.Builder< 197 ListInterconnectLocationsRequest, InterconnectLocationList, ListPagedResponse> listSettings()198 listSettings() { 199 return getStubSettingsBuilder().listSettings(); 200 } 201 202 @Override build()203 public InterconnectLocationsSettings build() throws IOException { 204 return new InterconnectLocationsSettings(this); 205 } 206 } 207 } 208