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