|
| 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.protos.google.cloud.binaryauthorization.v1; |
| 18 | + |
| 19 | +import static com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1Client.ListAttestorsPagedResponse; |
| 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.StubSettings; |
| 31 | +import com.google.api.gax.rpc.TransportChannelProvider; |
| 32 | +import com.google.api.gax.rpc.UnaryCallSettings; |
| 33 | +import com.google.protobuf.Empty; |
| 34 | +import com.google.protos.google.cloud.binaryauthorization.v1.stub.BinauthzManagementServiceV1StubSettings; |
| 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 BinauthzManagementServiceV1Client}. |
| 42 | + * |
| 43 | + * <p>The default instance has everything set to sensible defaults: |
| 44 | + * |
| 45 | + * <ul> |
| 46 | + * <li> The default service address (binaryauthorization.googleapis.com) and default port (443) |
| 47 | + * are used. |
| 48 | + * <li> Credentials are acquired automatically through Application Default Credentials. |
| 49 | + * <li> Retries are configured for idempotent methods but not for non-idempotent methods. |
| 50 | + * </ul> |
| 51 | + * |
| 52 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 53 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 54 | + * |
| 55 | + * <p>For example, to set the total timeout of getPolicy to 30 seconds: |
| 56 | + * |
| 57 | + * <pre>{@code |
| 58 | + * BinauthzManagementServiceV1Settings.Builder binauthzManagementServiceV1SettingsBuilder = |
| 59 | + * BinauthzManagementServiceV1Settings.newBuilder(); |
| 60 | + * binauthzManagementServiceV1SettingsBuilder |
| 61 | + * .getPolicySettings() |
| 62 | + * .setRetrySettings( |
| 63 | + * binauthzManagementServiceV1SettingsBuilder |
| 64 | + * .getPolicySettings() |
| 65 | + * .getRetrySettings() |
| 66 | + * .toBuilder() |
| 67 | + * .setTotalTimeout(Duration.ofSeconds(30)) |
| 68 | + * .build()); |
| 69 | + * BinauthzManagementServiceV1Settings binauthzManagementServiceV1Settings = |
| 70 | + * binauthzManagementServiceV1SettingsBuilder.build(); |
| 71 | + * }</pre> |
| 72 | + */ |
| 73 | +@Generated("by gapic-generator-java") |
| 74 | +public class BinauthzManagementServiceV1Settings |
| 75 | + extends ClientSettings<BinauthzManagementServiceV1Settings> { |
| 76 | + |
| 77 | + /** Returns the object with the settings used for calls to getPolicy. */ |
| 78 | + public UnaryCallSettings<Service.GetPolicyRequest, Resources.Policy> getPolicySettings() { |
| 79 | + return ((BinauthzManagementServiceV1StubSettings) getStubSettings()).getPolicySettings(); |
| 80 | + } |
| 81 | + |
| 82 | + /** Returns the object with the settings used for calls to updatePolicy. */ |
| 83 | + public UnaryCallSettings<Service.UpdatePolicyRequest, Resources.Policy> updatePolicySettings() { |
| 84 | + return ((BinauthzManagementServiceV1StubSettings) getStubSettings()).updatePolicySettings(); |
| 85 | + } |
| 86 | + |
| 87 | + /** Returns the object with the settings used for calls to createAttestor. */ |
| 88 | + public UnaryCallSettings<Service.CreateAttestorRequest, Resources.Attestor> |
| 89 | + createAttestorSettings() { |
| 90 | + return ((BinauthzManagementServiceV1StubSettings) getStubSettings()).createAttestorSettings(); |
| 91 | + } |
| 92 | + |
| 93 | + /** Returns the object with the settings used for calls to getAttestor. */ |
| 94 | + public UnaryCallSettings<Service.GetAttestorRequest, Resources.Attestor> getAttestorSettings() { |
| 95 | + return ((BinauthzManagementServiceV1StubSettings) getStubSettings()).getAttestorSettings(); |
| 96 | + } |
| 97 | + |
| 98 | + /** Returns the object with the settings used for calls to updateAttestor. */ |
| 99 | + public UnaryCallSettings<Service.UpdateAttestorRequest, Resources.Attestor> |
| 100 | + updateAttestorSettings() { |
| 101 | + return ((BinauthzManagementServiceV1StubSettings) getStubSettings()).updateAttestorSettings(); |
| 102 | + } |
| 103 | + |
| 104 | + /** Returns the object with the settings used for calls to listAttestors. */ |
| 105 | + public PagedCallSettings< |
| 106 | + Service.ListAttestorsRequest, Service.ListAttestorsResponse, ListAttestorsPagedResponse> |
| 107 | + listAttestorsSettings() { |
| 108 | + return ((BinauthzManagementServiceV1StubSettings) getStubSettings()).listAttestorsSettings(); |
| 109 | + } |
| 110 | + |
| 111 | + /** Returns the object with the settings used for calls to deleteAttestor. */ |
| 112 | + public UnaryCallSettings<Service.DeleteAttestorRequest, Empty> deleteAttestorSettings() { |
| 113 | + return ((BinauthzManagementServiceV1StubSettings) getStubSettings()).deleteAttestorSettings(); |
| 114 | + } |
| 115 | + |
| 116 | + public static final BinauthzManagementServiceV1Settings create( |
| 117 | + BinauthzManagementServiceV1StubSettings stub) throws IOException { |
| 118 | + return new BinauthzManagementServiceV1Settings.Builder(stub.toBuilder()).build(); |
| 119 | + } |
| 120 | + |
| 121 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 122 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 123 | + return BinauthzManagementServiceV1StubSettings.defaultExecutorProviderBuilder(); |
| 124 | + } |
| 125 | + |
| 126 | + /** Returns the default service endpoint. */ |
| 127 | + public static String getDefaultEndpoint() { |
| 128 | + return BinauthzManagementServiceV1StubSettings.getDefaultEndpoint(); |
| 129 | + } |
| 130 | + |
| 131 | + /** Returns the default service scopes. */ |
| 132 | + public static List<String> getDefaultServiceScopes() { |
| 133 | + return BinauthzManagementServiceV1StubSettings.getDefaultServiceScopes(); |
| 134 | + } |
| 135 | + |
| 136 | + /** Returns a builder for the default credentials for this service. */ |
| 137 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 138 | + return BinauthzManagementServiceV1StubSettings.defaultCredentialsProviderBuilder(); |
| 139 | + } |
| 140 | + |
| 141 | + /** Returns a builder for the default ChannelProvider for this service. */ |
| 142 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 143 | + return BinauthzManagementServiceV1StubSettings.defaultGrpcTransportProviderBuilder(); |
| 144 | + } |
| 145 | + |
| 146 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 147 | + return BinauthzManagementServiceV1StubSettings.defaultTransportChannelProvider(); |
| 148 | + } |
| 149 | + |
| 150 | + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") |
| 151 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 152 | + return BinauthzManagementServiceV1StubSettings.defaultApiClientHeaderProviderBuilder(); |
| 153 | + } |
| 154 | + |
| 155 | + /** Returns a new builder for this class. */ |
| 156 | + public static Builder newBuilder() { |
| 157 | + return Builder.createDefault(); |
| 158 | + } |
| 159 | + |
| 160 | + /** Returns a new builder for this class. */ |
| 161 | + public static Builder newBuilder(ClientContext clientContext) { |
| 162 | + return new Builder(clientContext); |
| 163 | + } |
| 164 | + |
| 165 | + /** Returns a builder containing all the values of this settings class. */ |
| 166 | + public Builder toBuilder() { |
| 167 | + return new Builder(this); |
| 168 | + } |
| 169 | + |
| 170 | + protected BinauthzManagementServiceV1Settings(Builder settingsBuilder) throws IOException { |
| 171 | + super(settingsBuilder); |
| 172 | + } |
| 173 | + |
| 174 | + /** Builder for BinauthzManagementServiceV1Settings. */ |
| 175 | + public static class Builder |
| 176 | + extends ClientSettings.Builder<BinauthzManagementServiceV1Settings, Builder> { |
| 177 | + |
| 178 | + protected Builder() throws IOException { |
| 179 | + this(((ClientContext) null)); |
| 180 | + } |
| 181 | + |
| 182 | + protected Builder(ClientContext clientContext) { |
| 183 | + super(BinauthzManagementServiceV1StubSettings.newBuilder(clientContext)); |
| 184 | + } |
| 185 | + |
| 186 | + protected Builder(BinauthzManagementServiceV1Settings settings) { |
| 187 | + super(settings.getStubSettings().toBuilder()); |
| 188 | + } |
| 189 | + |
| 190 | + protected Builder(BinauthzManagementServiceV1StubSettings.Builder stubSettings) { |
| 191 | + super(stubSettings); |
| 192 | + } |
| 193 | + |
| 194 | + private static Builder createDefault() { |
| 195 | + return new Builder(BinauthzManagementServiceV1StubSettings.newBuilder()); |
| 196 | + } |
| 197 | + |
| 198 | + public BinauthzManagementServiceV1StubSettings.Builder getStubSettingsBuilder() { |
| 199 | + return ((BinauthzManagementServiceV1StubSettings.Builder) getStubSettings()); |
| 200 | + } |
| 201 | + |
| 202 | + /** |
| 203 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 204 | + * |
| 205 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 206 | + */ |
| 207 | + public Builder applyToAllUnaryMethods( |
| 208 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 209 | + super.applyToAllUnaryMethods( |
| 210 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 211 | + return this; |
| 212 | + } |
| 213 | + |
| 214 | + /** Returns the builder for the settings used for calls to getPolicy. */ |
| 215 | + public UnaryCallSettings.Builder<Service.GetPolicyRequest, Resources.Policy> |
| 216 | + getPolicySettings() { |
| 217 | + return getStubSettingsBuilder().getPolicySettings(); |
| 218 | + } |
| 219 | + |
| 220 | + /** Returns the builder for the settings used for calls to updatePolicy. */ |
| 221 | + public UnaryCallSettings.Builder<Service.UpdatePolicyRequest, Resources.Policy> |
| 222 | + updatePolicySettings() { |
| 223 | + return getStubSettingsBuilder().updatePolicySettings(); |
| 224 | + } |
| 225 | + |
| 226 | + /** Returns the builder for the settings used for calls to createAttestor. */ |
| 227 | + public UnaryCallSettings.Builder<Service.CreateAttestorRequest, Resources.Attestor> |
| 228 | + createAttestorSettings() { |
| 229 | + return getStubSettingsBuilder().createAttestorSettings(); |
| 230 | + } |
| 231 | + |
| 232 | + /** Returns the builder for the settings used for calls to getAttestor. */ |
| 233 | + public UnaryCallSettings.Builder<Service.GetAttestorRequest, Resources.Attestor> |
| 234 | + getAttestorSettings() { |
| 235 | + return getStubSettingsBuilder().getAttestorSettings(); |
| 236 | + } |
| 237 | + |
| 238 | + /** Returns the builder for the settings used for calls to updateAttestor. */ |
| 239 | + public UnaryCallSettings.Builder<Service.UpdateAttestorRequest, Resources.Attestor> |
| 240 | + updateAttestorSettings() { |
| 241 | + return getStubSettingsBuilder().updateAttestorSettings(); |
| 242 | + } |
| 243 | + |
| 244 | + /** Returns the builder for the settings used for calls to listAttestors. */ |
| 245 | + public PagedCallSettings.Builder< |
| 246 | + Service.ListAttestorsRequest, Service.ListAttestorsResponse, ListAttestorsPagedResponse> |
| 247 | + listAttestorsSettings() { |
| 248 | + return getStubSettingsBuilder().listAttestorsSettings(); |
| 249 | + } |
| 250 | + |
| 251 | + /** Returns the builder for the settings used for calls to deleteAttestor. */ |
| 252 | + public UnaryCallSettings.Builder<Service.DeleteAttestorRequest, Empty> |
| 253 | + deleteAttestorSettings() { |
| 254 | + return getStubSettingsBuilder().deleteAttestorSettings(); |
| 255 | + } |
| 256 | + |
| 257 | + @Override |
| 258 | + public BinauthzManagementServiceV1Settings build() throws IOException { |
| 259 | + return new BinauthzManagementServiceV1Settings(this); |
| 260 | + } |
| 261 | + } |
| 262 | +} |
0 commit comments