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