|
| 1 | +/* |
| 2 | +* Copyright 2021 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.kms.v1; |
| 18 | + |
| 19 | +import static com.google.cloud.kms.v1.EkmServiceClient.ListEkmConnectionsPagedResponse; |
| 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.grpc.InstantiatingGrpcChannelProvider; |
| 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.kms.v1.stub.EkmServiceStubSettings; |
| 33 | +import com.google.iam.v1.GetIamPolicyRequest; |
| 34 | +import com.google.iam.v1.Policy; |
| 35 | +import com.google.iam.v1.SetIamPolicyRequest; |
| 36 | +import com.google.iam.v1.TestIamPermissionsRequest; |
| 37 | +import com.google.iam.v1.TestIamPermissionsResponse; |
| 38 | +import java.io.IOException; |
| 39 | +import java.util.List; |
| 40 | +import javax.annotation.Generated; |
| 41 | + |
| 42 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 43 | +/** |
| 44 | +* Settings class to configure an instance of {@link EkmServiceClient}. |
| 45 | +* |
| 46 | +* <p>The default instance has everything set to sensible defaults: |
| 47 | +* |
| 48 | +* <ul> |
| 49 | +* <li>The default service address (cloudkms.googleapis.com) and default port (443) are used. |
| 50 | +* <li>Credentials are acquired automatically through Application Default Credentials. |
| 51 | +* <li>Retries are configured for idempotent methods but not for non-idempotent methods. |
| 52 | +* </ul> |
| 53 | +* |
| 54 | +* <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 55 | +* build() is called, the tree of builders is called to create the complete settings object. |
| 56 | +* |
| 57 | +* <p>For example, to set the total timeout of getEkmConnection to 30 seconds: |
| 58 | +* |
| 59 | +* <pre>{@code |
| 60 | +* EkmServiceSettings.Builder ekmServiceSettingsBuilder = EkmServiceSettings.newBuilder(); |
| 61 | +* ekmServiceSettingsBuilder |
| 62 | +* .getEkmConnectionSettings() |
| 63 | +* .setRetrySettings( |
| 64 | +* ekmServiceSettingsBuilder |
| 65 | +* .getEkmConnectionSettings() |
| 66 | +* .getRetrySettings() |
| 67 | +* .toBuilder() |
| 68 | +* .setTotalTimeout(Duration.ofSeconds(30)) |
| 69 | +* .build()); |
| 70 | +* EkmServiceSettings ekmServiceSettings = ekmServiceSettingsBuilder.build(); |
| 71 | +* }</pre> |
| 72 | +*/ |
| 73 | +@Generated("by gapic-generator-java") |
| 74 | +public class EkmServiceSettings extends ClientSettings<EkmServiceSettings> { |
| 75 | + |
| 76 | +/** Returns the object with the settings used for calls to listEkmConnections. */ |
| 77 | +public PagedCallSettings< |
| 78 | +ListEkmConnectionsRequest, ListEkmConnectionsResponse, ListEkmConnectionsPagedResponse> |
| 79 | +listEkmConnectionsSettings() { |
| 80 | +return ((EkmServiceStubSettings) getStubSettings()).listEkmConnectionsSettings(); |
| 81 | +} |
| 82 | + |
| 83 | +/** Returns the object with the settings used for calls to getEkmConnection. */ |
| 84 | +public UnaryCallSettings<GetEkmConnectionRequest, EkmConnection> getEkmConnectionSettings() { |
| 85 | +return ((EkmServiceStubSettings) getStubSettings()).getEkmConnectionSettings(); |
| 86 | +} |
| 87 | + |
| 88 | +/** Returns the object with the settings used for calls to createEkmConnection. */ |
| 89 | +public UnaryCallSettings<CreateEkmConnectionRequest, EkmConnection> |
| 90 | +createEkmConnectionSettings() { |
| 91 | +return ((EkmServiceStubSettings) getStubSettings()).createEkmConnectionSettings(); |
| 92 | +} |
| 93 | + |
| 94 | +/** Returns the object with the settings used for calls to updateEkmConnection. */ |
| 95 | +public UnaryCallSettings<UpdateEkmConnectionRequest, EkmConnection> |
| 96 | +updateEkmConnectionSettings() { |
| 97 | +return ((EkmServiceStubSettings) getStubSettings()).updateEkmConnectionSettings(); |
| 98 | +} |
| 99 | + |
| 100 | +/** Returns the object with the settings used for calls to setIamPolicy. */ |
| 101 | +public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() { |
| 102 | +return ((EkmServiceStubSettings) getStubSettings()).setIamPolicySettings(); |
| 103 | +} |
| 104 | + |
| 105 | +/** Returns the object with the settings used for calls to getIamPolicy. */ |
| 106 | +public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() { |
| 107 | +return ((EkmServiceStubSettings) getStubSettings()).getIamPolicySettings(); |
| 108 | +} |
| 109 | + |
| 110 | +/** Returns the object with the settings used for calls to testIamPermissions. */ |
| 111 | +public UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse> |
| 112 | +testIamPermissionsSettings() { |
| 113 | +return ((EkmServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); |
| 114 | +} |
| 115 | + |
| 116 | +public static final EkmServiceSettings create(EkmServiceStubSettings stub) throws IOException { |
| 117 | +return new EkmServiceSettings.Builder(stub.toBuilder()).build(); |
| 118 | +} |
| 119 | + |
| 120 | +/** Returns a builder for the default ExecutorProvider for this service. */ |
| 121 | +public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 122 | +return EkmServiceStubSettings.defaultExecutorProviderBuilder(); |
| 123 | +} |
| 124 | + |
| 125 | +/** Returns the default service endpoint. */ |
| 126 | +public static String getDefaultEndpoint() { |
| 127 | +return EkmServiceStubSettings.getDefaultEndpoint(); |
| 128 | +} |
| 129 | + |
| 130 | +/** Returns the default service scopes. */ |
| 131 | +public static List<String> getDefaultServiceScopes() { |
| 132 | +return EkmServiceStubSettings.getDefaultServiceScopes(); |
| 133 | +} |
| 134 | + |
| 135 | +/** Returns a builder for the default credentials for this service. */ |
| 136 | +public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 137 | +return EkmServiceStubSettings.defaultCredentialsProviderBuilder(); |
| 138 | +} |
| 139 | + |
| 140 | +/** Returns a builder for the default ChannelProvider for this service. */ |
| 141 | +public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 142 | +return EkmServiceStubSettings.defaultGrpcTransportProviderBuilder(); |
| 143 | +} |
| 144 | + |
| 145 | +public static TransportChannelProvider defaultTransportChannelProvider() { |
| 146 | +return EkmServiceStubSettings.defaultTransportChannelProvider(); |
| 147 | +} |
| 148 | + |
| 149 | +@BetaApi("The surface for customizing headers is not stable yet and may change in the future.") |
| 150 | +public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 151 | +return EkmServiceStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 152 | +} |
| 153 | + |
| 154 | +/** Returns a new builder for this class. */ |
| 155 | +public static Builder newBuilder() { |
| 156 | +return Builder.createDefault(); |
| 157 | +} |
| 158 | + |
| 159 | +/** Returns a new builder for this class. */ |
| 160 | +public static Builder newBuilder(ClientContext clientContext) { |
| 161 | +return new Builder(clientContext); |
| 162 | +} |
| 163 | + |
| 164 | +/** Returns a builder containing all the values of this settings class. */ |
| 165 | +public Builder toBuilder() { |
| 166 | +return new Builder(this); |
| 167 | +} |
| 168 | + |
| 169 | +protected EkmServiceSettings(Builder settingsBuilder) throws IOException { |
| 170 | +super(settingsBuilder); |
| 171 | +} |
| 172 | + |
| 173 | +/** Builder for EkmServiceSettings. */ |
| 174 | +public static class Builder extends ClientSettings.Builder<EkmServiceSettings, Builder> { |
| 175 | + |
| 176 | +protected Builder() throws IOException { |
| 177 | +this(((ClientContext) null)); |
| 178 | +} |
| 179 | + |
| 180 | +protected Builder(ClientContext clientContext) { |
| 181 | +super(EkmServiceStubSettings.newBuilder(clientContext)); |
| 182 | +} |
| 183 | + |
| 184 | +protected Builder(EkmServiceSettings settings) { |
| 185 | +super(settings.getStubSettings().toBuilder()); |
| 186 | +} |
| 187 | + |
| 188 | +protected Builder(EkmServiceStubSettings.Builder stubSettings) { |
| 189 | +super(stubSettings); |
| 190 | +} |
| 191 | + |
| 192 | +private static Builder createDefault() { |
| 193 | +return new Builder(EkmServiceStubSettings.newBuilder()); |
| 194 | +} |
| 195 | + |
| 196 | +public EkmServiceStubSettings.Builder getStubSettingsBuilder() { |
| 197 | +return ((EkmServiceStubSettings.Builder) getStubSettings()); |
| 198 | +} |
| 199 | + |
| 200 | +/** |
| 201 | +* Applies the given settings updater function to all of the unary API methods in this service. |
| 202 | +* |
| 203 | +* <p>Note: This method does not support applying settings to methods. |
| 204 | +*/ |
| 205 | +public Builder applyToAllUnaryMethods( |
| 206 | +ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 207 | +super.applyToAllUnaryMethods( |
| 208 | +getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 209 | +return this; |
| 210 | +} |
| 211 | + |
| 212 | +/** Returns the builder for the settings used for calls to listEkmConnections. */ |
| 213 | +public PagedCallSettings.Builder< |
| 214 | +ListEkmConnectionsRequest, ListEkmConnectionsResponse, ListEkmConnectionsPagedResponse> |
| 215 | +listEkmConnectionsSettings() { |
| 216 | +return getStubSettingsBuilder().listEkmConnectionsSettings(); |
| 217 | +} |
| 218 | + |
| 219 | +/** Returns the builder for the settings used for calls to getEkmConnection. */ |
| 220 | +public UnaryCallSettings.Builder<GetEkmConnectionRequest, EkmConnection> |
| 221 | +getEkmConnectionSettings() { |
| 222 | +return getStubSettingsBuilder().getEkmConnectionSettings(); |
| 223 | +} |
| 224 | + |
| 225 | +/** Returns the builder for the settings used for calls to createEkmConnection. */ |
| 226 | +public UnaryCallSettings.Builder<CreateEkmConnectionRequest, EkmConnection> |
| 227 | +createEkmConnectionSettings() { |
| 228 | +return getStubSettingsBuilder().createEkmConnectionSettings(); |
| 229 | +} |
| 230 | + |
| 231 | +/** Returns the builder for the settings used for calls to updateEkmConnection. */ |
| 232 | +public UnaryCallSettings.Builder<UpdateEkmConnectionRequest, EkmConnection> |
| 233 | +updateEkmConnectionSettings() { |
| 234 | +return getStubSettingsBuilder().updateEkmConnectionSettings(); |
| 235 | +} |
| 236 | + |
| 237 | +/** Returns the builder for the settings used for calls to setIamPolicy. */ |
| 238 | +public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings() { |
| 239 | +return getStubSettingsBuilder().setIamPolicySettings(); |
| 240 | +} |
| 241 | + |
| 242 | +/** Returns the builder for the settings used for calls to getIamPolicy. */ |
| 243 | +public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() { |
| 244 | +return getStubSettingsBuilder().getIamPolicySettings(); |
| 245 | +} |
| 246 | + |
| 247 | +/** Returns the builder for the settings used for calls to testIamPermissions. */ |
| 248 | +public UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse> |
| 249 | +testIamPermissionsSettings() { |
| 250 | +return getStubSettingsBuilder().testIamPermissionsSettings(); |
| 251 | +} |
| 252 | + |
| 253 | +@Override |
| 254 | +public EkmServiceSettings build() throws IOException { |
| 255 | +return new EkmServiceSettings(this); |
| 256 | +} |
| 257 | +} |
| 258 | +} |
0 commit comments