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 io.grafeas.v1; 18 19 import static io.grafeas.v1.GrafeasClient.ListNoteOccurrencesPagedResponse; 20 import static io.grafeas.v1.GrafeasClient.ListNotesPagedResponse; 21 import static io.grafeas.v1.GrafeasClient.ListOccurrencesPagedResponse; 22 23 import com.google.api.core.ApiFunction; 24 import com.google.api.core.BetaApi; 25 import com.google.api.gax.core.GoogleCredentialsProvider; 26 import com.google.api.gax.core.InstantiatingExecutorProvider; 27 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; 28 import com.google.api.gax.rpc.ApiClientHeaderProvider; 29 import com.google.api.gax.rpc.ClientContext; 30 import com.google.api.gax.rpc.ClientSettings; 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.protobuf.Empty; 35 import io.grafeas.v1.stub.GrafeasStubSettings; 36 import java.io.IOException; 37 import java.util.List; 38 import javax.annotation.Generated; 39 40 // AUTO-GENERATED DOCUMENTATION AND CLASS. 41 /** 42 * Settings class to configure an instance of {@link GrafeasClient}. 43 * 44 * <p>The default instance has everything set to sensible defaults: 45 * 46 * <ul> 47 * <li>The default service address (containeranalysis.googleapis.com) and default port (443) are 48 * used. 49 * <li>Credentials are acquired automatically through Application Default Credentials. 50 * <li>Retries are configured for idempotent methods but not for non-idempotent methods. 51 * </ul> 52 * 53 * <p>The builder of this class is recursive, so contained classes are themselves builders. When 54 * build() is called, the tree of builders is called to create the complete settings object. 55 * 56 * <p>For example, to set the total timeout of getOccurrence to 30 seconds: 57 * 58 * <pre>{@code 59 * // This snippet has been automatically generated and should be regarded as a code template only. 60 * // It will require modifications to work: 61 * // - It may require correct/in-range values for request initialization. 62 * // - It may require specifying regional endpoints when creating the service client as shown in 63 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 64 * GrafeasSettings.Builder grafeasSettingsBuilder = GrafeasSettings.newBuilder(); 65 * grafeasSettingsBuilder 66 * .getOccurrenceSettings() 67 * .setRetrySettings( 68 * grafeasSettingsBuilder 69 * .getOccurrenceSettings() 70 * .getRetrySettings() 71 * .toBuilder() 72 * .setTotalTimeout(Duration.ofSeconds(30)) 73 * .build()); 74 * GrafeasSettings grafeasSettings = grafeasSettingsBuilder.build(); 75 * }</pre> 76 */ 77 @Generated("by gapic-generator-java") 78 public class GrafeasSettings extends ClientSettings<GrafeasSettings> { 79 80 /** Returns the object with the settings used for calls to getOccurrence. */ getOccurrenceSettings()81 public UnaryCallSettings<GetOccurrenceRequest, Occurrence> getOccurrenceSettings() { 82 return ((GrafeasStubSettings) getStubSettings()).getOccurrenceSettings(); 83 } 84 85 /** Returns the object with the settings used for calls to listOccurrences. */ 86 public PagedCallSettings< 87 ListOccurrencesRequest, ListOccurrencesResponse, ListOccurrencesPagedResponse> listOccurrencesSettings()88 listOccurrencesSettings() { 89 return ((GrafeasStubSettings) getStubSettings()).listOccurrencesSettings(); 90 } 91 92 /** Returns the object with the settings used for calls to deleteOccurrence. */ deleteOccurrenceSettings()93 public UnaryCallSettings<DeleteOccurrenceRequest, Empty> deleteOccurrenceSettings() { 94 return ((GrafeasStubSettings) getStubSettings()).deleteOccurrenceSettings(); 95 } 96 97 /** Returns the object with the settings used for calls to createOccurrence. */ createOccurrenceSettings()98 public UnaryCallSettings<CreateOccurrenceRequest, Occurrence> createOccurrenceSettings() { 99 return ((GrafeasStubSettings) getStubSettings()).createOccurrenceSettings(); 100 } 101 102 /** Returns the object with the settings used for calls to batchCreateOccurrences. */ 103 public UnaryCallSettings<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse> batchCreateOccurrencesSettings()104 batchCreateOccurrencesSettings() { 105 return ((GrafeasStubSettings) getStubSettings()).batchCreateOccurrencesSettings(); 106 } 107 108 /** Returns the object with the settings used for calls to updateOccurrence. */ updateOccurrenceSettings()109 public UnaryCallSettings<UpdateOccurrenceRequest, Occurrence> updateOccurrenceSettings() { 110 return ((GrafeasStubSettings) getStubSettings()).updateOccurrenceSettings(); 111 } 112 113 /** Returns the object with the settings used for calls to getOccurrenceNote. */ getOccurrenceNoteSettings()114 public UnaryCallSettings<GetOccurrenceNoteRequest, Note> getOccurrenceNoteSettings() { 115 return ((GrafeasStubSettings) getStubSettings()).getOccurrenceNoteSettings(); 116 } 117 118 /** Returns the object with the settings used for calls to getNote. */ getNoteSettings()119 public UnaryCallSettings<GetNoteRequest, Note> getNoteSettings() { 120 return ((GrafeasStubSettings) getStubSettings()).getNoteSettings(); 121 } 122 123 /** Returns the object with the settings used for calls to listNotes. */ 124 public PagedCallSettings<ListNotesRequest, ListNotesResponse, ListNotesPagedResponse> listNotesSettings()125 listNotesSettings() { 126 return ((GrafeasStubSettings) getStubSettings()).listNotesSettings(); 127 } 128 129 /** Returns the object with the settings used for calls to deleteNote. */ deleteNoteSettings()130 public UnaryCallSettings<DeleteNoteRequest, Empty> deleteNoteSettings() { 131 return ((GrafeasStubSettings) getStubSettings()).deleteNoteSettings(); 132 } 133 134 /** Returns the object with the settings used for calls to createNote. */ createNoteSettings()135 public UnaryCallSettings<CreateNoteRequest, Note> createNoteSettings() { 136 return ((GrafeasStubSettings) getStubSettings()).createNoteSettings(); 137 } 138 139 /** Returns the object with the settings used for calls to batchCreateNotes. */ 140 public UnaryCallSettings<BatchCreateNotesRequest, BatchCreateNotesResponse> batchCreateNotesSettings()141 batchCreateNotesSettings() { 142 return ((GrafeasStubSettings) getStubSettings()).batchCreateNotesSettings(); 143 } 144 145 /** Returns the object with the settings used for calls to updateNote. */ updateNoteSettings()146 public UnaryCallSettings<UpdateNoteRequest, Note> updateNoteSettings() { 147 return ((GrafeasStubSettings) getStubSettings()).updateNoteSettings(); 148 } 149 150 /** Returns the object with the settings used for calls to listNoteOccurrences. */ 151 public PagedCallSettings< 152 ListNoteOccurrencesRequest, ListNoteOccurrencesResponse, ListNoteOccurrencesPagedResponse> listNoteOccurrencesSettings()153 listNoteOccurrencesSettings() { 154 return ((GrafeasStubSettings) getStubSettings()).listNoteOccurrencesSettings(); 155 } 156 create(GrafeasStubSettings stub)157 public static final GrafeasSettings create(GrafeasStubSettings stub) throws IOException { 158 return new GrafeasSettings.Builder(stub.toBuilder()).build(); 159 } 160 161 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()162 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 163 return GrafeasStubSettings.defaultExecutorProviderBuilder(); 164 } 165 166 /** Returns the default service endpoint. */ getDefaultEndpoint()167 public static String getDefaultEndpoint() { 168 return GrafeasStubSettings.getDefaultEndpoint(); 169 } 170 171 /** Returns the default service scopes. */ getDefaultServiceScopes()172 public static List<String> getDefaultServiceScopes() { 173 return GrafeasStubSettings.getDefaultServiceScopes(); 174 } 175 176 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()177 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 178 return GrafeasStubSettings.defaultCredentialsProviderBuilder(); 179 } 180 181 /** Returns a builder for the default ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()182 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 183 return GrafeasStubSettings.defaultGrpcTransportProviderBuilder(); 184 } 185 defaultTransportChannelProvider()186 public static TransportChannelProvider defaultTransportChannelProvider() { 187 return GrafeasStubSettings.defaultTransportChannelProvider(); 188 } 189 190 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()191 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 192 return GrafeasStubSettings.defaultApiClientHeaderProviderBuilder(); 193 } 194 195 /** Returns a new builder for this class. */ newBuilder()196 public static Builder newBuilder() { 197 return Builder.createDefault(); 198 } 199 200 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)201 public static Builder newBuilder(ClientContext clientContext) { 202 return new Builder(clientContext); 203 } 204 205 /** Returns a builder containing all the values of this settings class. */ toBuilder()206 public Builder toBuilder() { 207 return new Builder(this); 208 } 209 GrafeasSettings(Builder settingsBuilder)210 protected GrafeasSettings(Builder settingsBuilder) throws IOException { 211 super(settingsBuilder); 212 } 213 214 /** Builder for GrafeasSettings. */ 215 public static class Builder extends ClientSettings.Builder<GrafeasSettings, Builder> { 216 Builder()217 protected Builder() throws IOException { 218 this(((ClientContext) null)); 219 } 220 Builder(ClientContext clientContext)221 protected Builder(ClientContext clientContext) { 222 super(GrafeasStubSettings.newBuilder(clientContext)); 223 } 224 Builder(GrafeasSettings settings)225 protected Builder(GrafeasSettings settings) { 226 super(settings.getStubSettings().toBuilder()); 227 } 228 Builder(GrafeasStubSettings.Builder stubSettings)229 protected Builder(GrafeasStubSettings.Builder stubSettings) { 230 super(stubSettings); 231 } 232 createDefault()233 private static Builder createDefault() { 234 return new Builder(GrafeasStubSettings.newBuilder()); 235 } 236 getStubSettingsBuilder()237 public GrafeasStubSettings.Builder getStubSettingsBuilder() { 238 return ((GrafeasStubSettings.Builder) getStubSettings()); 239 } 240 241 /** 242 * Applies the given settings updater function to all of the unary API methods in this service. 243 * 244 * <p>Note: This method does not support applying settings to streaming methods. 245 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)246 public Builder applyToAllUnaryMethods( 247 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 248 super.applyToAllUnaryMethods( 249 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 250 return this; 251 } 252 253 /** Returns the builder for the settings used for calls to getOccurrence. */ getOccurrenceSettings()254 public UnaryCallSettings.Builder<GetOccurrenceRequest, Occurrence> getOccurrenceSettings() { 255 return getStubSettingsBuilder().getOccurrenceSettings(); 256 } 257 258 /** Returns the builder for the settings used for calls to listOccurrences. */ 259 public PagedCallSettings.Builder< 260 ListOccurrencesRequest, ListOccurrencesResponse, ListOccurrencesPagedResponse> listOccurrencesSettings()261 listOccurrencesSettings() { 262 return getStubSettingsBuilder().listOccurrencesSettings(); 263 } 264 265 /** Returns the builder for the settings used for calls to deleteOccurrence. */ deleteOccurrenceSettings()266 public UnaryCallSettings.Builder<DeleteOccurrenceRequest, Empty> deleteOccurrenceSettings() { 267 return getStubSettingsBuilder().deleteOccurrenceSettings(); 268 } 269 270 /** Returns the builder for the settings used for calls to createOccurrence. */ 271 public UnaryCallSettings.Builder<CreateOccurrenceRequest, Occurrence> createOccurrenceSettings()272 createOccurrenceSettings() { 273 return getStubSettingsBuilder().createOccurrenceSettings(); 274 } 275 276 /** Returns the builder for the settings used for calls to batchCreateOccurrences. */ 277 public UnaryCallSettings.Builder<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse> batchCreateOccurrencesSettings()278 batchCreateOccurrencesSettings() { 279 return getStubSettingsBuilder().batchCreateOccurrencesSettings(); 280 } 281 282 /** Returns the builder for the settings used for calls to updateOccurrence. */ 283 public UnaryCallSettings.Builder<UpdateOccurrenceRequest, Occurrence> updateOccurrenceSettings()284 updateOccurrenceSettings() { 285 return getStubSettingsBuilder().updateOccurrenceSettings(); 286 } 287 288 /** Returns the builder for the settings used for calls to getOccurrenceNote. */ getOccurrenceNoteSettings()289 public UnaryCallSettings.Builder<GetOccurrenceNoteRequest, Note> getOccurrenceNoteSettings() { 290 return getStubSettingsBuilder().getOccurrenceNoteSettings(); 291 } 292 293 /** Returns the builder for the settings used for calls to getNote. */ getNoteSettings()294 public UnaryCallSettings.Builder<GetNoteRequest, Note> getNoteSettings() { 295 return getStubSettingsBuilder().getNoteSettings(); 296 } 297 298 /** Returns the builder for the settings used for calls to listNotes. */ 299 public PagedCallSettings.Builder<ListNotesRequest, ListNotesResponse, ListNotesPagedResponse> listNotesSettings()300 listNotesSettings() { 301 return getStubSettingsBuilder().listNotesSettings(); 302 } 303 304 /** Returns the builder for the settings used for calls to deleteNote. */ deleteNoteSettings()305 public UnaryCallSettings.Builder<DeleteNoteRequest, Empty> deleteNoteSettings() { 306 return getStubSettingsBuilder().deleteNoteSettings(); 307 } 308 309 /** Returns the builder for the settings used for calls to createNote. */ createNoteSettings()310 public UnaryCallSettings.Builder<CreateNoteRequest, Note> createNoteSettings() { 311 return getStubSettingsBuilder().createNoteSettings(); 312 } 313 314 /** Returns the builder for the settings used for calls to batchCreateNotes. */ 315 public UnaryCallSettings.Builder<BatchCreateNotesRequest, BatchCreateNotesResponse> batchCreateNotesSettings()316 batchCreateNotesSettings() { 317 return getStubSettingsBuilder().batchCreateNotesSettings(); 318 } 319 320 /** Returns the builder for the settings used for calls to updateNote. */ updateNoteSettings()321 public UnaryCallSettings.Builder<UpdateNoteRequest, Note> updateNoteSettings() { 322 return getStubSettingsBuilder().updateNoteSettings(); 323 } 324 325 /** Returns the builder for the settings used for calls to listNoteOccurrences. */ 326 public PagedCallSettings.Builder< 327 ListNoteOccurrencesRequest, 328 ListNoteOccurrencesResponse, 329 ListNoteOccurrencesPagedResponse> listNoteOccurrencesSettings()330 listNoteOccurrencesSettings() { 331 return getStubSettingsBuilder().listNoteOccurrencesSettings(); 332 } 333 334 @Override build()335 public GrafeasSettings build() throws IOException { 336 return new GrafeasSettings(this); 337 } 338 } 339 } 340