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.billing.v1; 18 19 import static com.google.cloud.billing.v1.CloudCatalogClient.ListServicesPagedResponse; 20 import static com.google.cloud.billing.v1.CloudCatalogClient.ListSkusPagedResponse; 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.grpc.InstantiatingGrpcChannelProvider; 27 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; 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.cloud.billing.v1.stub.CloudCatalogStubSettings; 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 CloudCatalogClient}. 42 * 43 * <p>The default instance has everything set to sensible defaults: 44 * 45 * <ul> 46 * <li>The default service address (cloudbilling.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 listServices 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 * CloudCatalogSettings.Builder cloudCatalogSettingsBuilder = CloudCatalogSettings.newBuilder(); 63 * cloudCatalogSettingsBuilder 64 * .listServicesSettings() 65 * .setRetrySettings( 66 * cloudCatalogSettingsBuilder 67 * .listServicesSettings() 68 * .getRetrySettings() 69 * .toBuilder() 70 * .setTotalTimeout(Duration.ofSeconds(30)) 71 * .build()); 72 * CloudCatalogSettings cloudCatalogSettings = cloudCatalogSettingsBuilder.build(); 73 * }</pre> 74 */ 75 @Generated("by gapic-generator-java") 76 public class CloudCatalogSettings extends ClientSettings<CloudCatalogSettings> { 77 78 /** Returns the object with the settings used for calls to listServices. */ 79 public PagedCallSettings<ListServicesRequest, ListServicesResponse, ListServicesPagedResponse> listServicesSettings()80 listServicesSettings() { 81 return ((CloudCatalogStubSettings) getStubSettings()).listServicesSettings(); 82 } 83 84 /** Returns the object with the settings used for calls to listSkus. */ 85 public PagedCallSettings<ListSkusRequest, ListSkusResponse, ListSkusPagedResponse> listSkusSettings()86 listSkusSettings() { 87 return ((CloudCatalogStubSettings) getStubSettings()).listSkusSettings(); 88 } 89 create(CloudCatalogStubSettings stub)90 public static final CloudCatalogSettings create(CloudCatalogStubSettings stub) 91 throws IOException { 92 return new CloudCatalogSettings.Builder(stub.toBuilder()).build(); 93 } 94 95 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()96 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 97 return CloudCatalogStubSettings.defaultExecutorProviderBuilder(); 98 } 99 100 /** Returns the default service endpoint. */ getDefaultEndpoint()101 public static String getDefaultEndpoint() { 102 return CloudCatalogStubSettings.getDefaultEndpoint(); 103 } 104 105 /** Returns the default service scopes. */ getDefaultServiceScopes()106 public static List<String> getDefaultServiceScopes() { 107 return CloudCatalogStubSettings.getDefaultServiceScopes(); 108 } 109 110 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()111 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 112 return CloudCatalogStubSettings.defaultCredentialsProviderBuilder(); 113 } 114 115 /** Returns a builder for the default gRPC ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()116 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 117 return CloudCatalogStubSettings.defaultGrpcTransportProviderBuilder(); 118 } 119 120 /** Returns a builder for the default REST ChannelProvider for this service. */ 121 @BetaApi 122 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()123 defaultHttpJsonTransportProviderBuilder() { 124 return CloudCatalogStubSettings.defaultHttpJsonTransportProviderBuilder(); 125 } 126 defaultTransportChannelProvider()127 public static TransportChannelProvider defaultTransportChannelProvider() { 128 return CloudCatalogStubSettings.defaultTransportChannelProvider(); 129 } 130 131 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()132 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 133 return CloudCatalogStubSettings.defaultApiClientHeaderProviderBuilder(); 134 } 135 136 /** Returns a new gRPC builder for this class. */ newBuilder()137 public static Builder newBuilder() { 138 return Builder.createDefault(); 139 } 140 141 /** Returns a new REST builder for this class. */ 142 @BetaApi newHttpJsonBuilder()143 public static Builder newHttpJsonBuilder() { 144 return Builder.createHttpJsonDefault(); 145 } 146 147 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)148 public static Builder newBuilder(ClientContext clientContext) { 149 return new Builder(clientContext); 150 } 151 152 /** Returns a builder containing all the values of this settings class. */ toBuilder()153 public Builder toBuilder() { 154 return new Builder(this); 155 } 156 CloudCatalogSettings(Builder settingsBuilder)157 protected CloudCatalogSettings(Builder settingsBuilder) throws IOException { 158 super(settingsBuilder); 159 } 160 161 /** Builder for CloudCatalogSettings. */ 162 public static class Builder extends ClientSettings.Builder<CloudCatalogSettings, Builder> { 163 Builder()164 protected Builder() throws IOException { 165 this(((ClientContext) null)); 166 } 167 Builder(ClientContext clientContext)168 protected Builder(ClientContext clientContext) { 169 super(CloudCatalogStubSettings.newBuilder(clientContext)); 170 } 171 Builder(CloudCatalogSettings settings)172 protected Builder(CloudCatalogSettings settings) { 173 super(settings.getStubSettings().toBuilder()); 174 } 175 Builder(CloudCatalogStubSettings.Builder stubSettings)176 protected Builder(CloudCatalogStubSettings.Builder stubSettings) { 177 super(stubSettings); 178 } 179 createDefault()180 private static Builder createDefault() { 181 return new Builder(CloudCatalogStubSettings.newBuilder()); 182 } 183 184 @BetaApi createHttpJsonDefault()185 private static Builder createHttpJsonDefault() { 186 return new Builder(CloudCatalogStubSettings.newHttpJsonBuilder()); 187 } 188 getStubSettingsBuilder()189 public CloudCatalogStubSettings.Builder getStubSettingsBuilder() { 190 return ((CloudCatalogStubSettings.Builder) getStubSettings()); 191 } 192 193 /** 194 * Applies the given settings updater function to all of the unary API methods in this service. 195 * 196 * <p>Note: This method does not support applying settings to streaming methods. 197 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)198 public Builder applyToAllUnaryMethods( 199 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 200 super.applyToAllUnaryMethods( 201 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 202 return this; 203 } 204 205 /** Returns the builder for the settings used for calls to listServices. */ 206 public PagedCallSettings.Builder< 207 ListServicesRequest, ListServicesResponse, ListServicesPagedResponse> listServicesSettings()208 listServicesSettings() { 209 return getStubSettingsBuilder().listServicesSettings(); 210 } 211 212 /** Returns the builder for the settings used for calls to listSkus. */ 213 public PagedCallSettings.Builder<ListSkusRequest, ListSkusResponse, ListSkusPagedResponse> listSkusSettings()214 listSkusSettings() { 215 return getStubSettingsBuilder().listSkusSettings(); 216 } 217 218 @Override build()219 public CloudCatalogSettings build() throws IOException { 220 return new CloudCatalogSettings(this); 221 } 222 } 223 } 224