All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.tpu.v2alpha1.TpuSettings Maven / Gradle / Ivy

Go to download

Cloud TPU are Google's custom-developed application-specific integrated circuits (ASICs) used to accelerate machine learning workloads.

There is a newer version: 2.55.0
Show newest version
/*
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.tpu.v2alpha1;

import static com.google.cloud.tpu.v2alpha1.TpuClient.ListAcceleratorTypesPagedResponse;
import static com.google.cloud.tpu.v2alpha1.TpuClient.ListLocationsPagedResponse;
import static com.google.cloud.tpu.v2alpha1.TpuClient.ListNodesPagedResponse;
import static com.google.cloud.tpu.v2alpha1.TpuClient.ListQueuedResourcesPagedResponse;
import static com.google.cloud.tpu.v2alpha1.TpuClient.ListRuntimeVersionsPagedResponse;

import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.cloud.tpu.v2alpha1.stub.TpuStubSettings;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.List;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * Settings class to configure an instance of {@link TpuClient}.
 *
 * 

The default instance has everything set to sensible defaults: * *

    *
  • The default service address (tpu.googleapis.com) and default port (443) are used. *
  • Credentials are acquired automatically through Application Default Credentials. *
  • Retries are configured for idempotent methods but not for non-idempotent methods. *
* *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * *

For example, to set the * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) * of getNode: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * TpuSettings.Builder tpuSettingsBuilder = TpuSettings.newBuilder();
 * tpuSettingsBuilder
 *     .getNodeSettings()
 *     .setRetrySettings(
 *         tpuSettingsBuilder
 *             .getNodeSettings()
 *             .getRetrySettings()
 *             .toBuilder()
 *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
 *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
 *             .setMaxAttempts(5)
 *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
 *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
 *             .setRetryDelayMultiplier(1.3)
 *             .setRpcTimeoutMultiplier(1.5)
 *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
 *             .build());
 * TpuSettings tpuSettings = tpuSettingsBuilder.build();
 * }
* * Please refer to the [Client Side Retry * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for * additional support in setting retries. * *

To configure the RetrySettings of a Long Running Operation method, create an * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to * configure the RetrySettings for createNode: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * TpuSettings.Builder tpuSettingsBuilder = TpuSettings.newBuilder();
 * TimedRetryAlgorithm timedRetryAlgorithm =
 *     OperationalTimedPollAlgorithm.create(
 *         RetrySettings.newBuilder()
 *             .setInitialRetryDelayDuration(Duration.ofMillis(500))
 *             .setRetryDelayMultiplier(1.5)
 *             .setMaxRetryDelay(Duration.ofMillis(5000))
 *             .setTotalTimeoutDuration(Duration.ofHours(24))
 *             .build());
 * tpuSettingsBuilder
 *     .createClusterOperationSettings()
 *     .setPollingAlgorithm(timedRetryAlgorithm)
 *     .build();
 * }
*/ @BetaApi @Generated("by gapic-generator-java") public class TpuSettings extends ClientSettings { /** Returns the object with the settings used for calls to listNodes. */ public PagedCallSettings listNodesSettings() { return ((TpuStubSettings) getStubSettings()).listNodesSettings(); } /** Returns the object with the settings used for calls to getNode. */ public UnaryCallSettings getNodeSettings() { return ((TpuStubSettings) getStubSettings()).getNodeSettings(); } /** Returns the object with the settings used for calls to createNode. */ public UnaryCallSettings createNodeSettings() { return ((TpuStubSettings) getStubSettings()).createNodeSettings(); } /** Returns the object with the settings used for calls to createNode. */ public OperationCallSettings createNodeOperationSettings() { return ((TpuStubSettings) getStubSettings()).createNodeOperationSettings(); } /** Returns the object with the settings used for calls to deleteNode. */ public UnaryCallSettings deleteNodeSettings() { return ((TpuStubSettings) getStubSettings()).deleteNodeSettings(); } /** Returns the object with the settings used for calls to deleteNode. */ public OperationCallSettings deleteNodeOperationSettings() { return ((TpuStubSettings) getStubSettings()).deleteNodeOperationSettings(); } /** Returns the object with the settings used for calls to stopNode. */ public UnaryCallSettings stopNodeSettings() { return ((TpuStubSettings) getStubSettings()).stopNodeSettings(); } /** Returns the object with the settings used for calls to stopNode. */ public OperationCallSettings stopNodeOperationSettings() { return ((TpuStubSettings) getStubSettings()).stopNodeOperationSettings(); } /** Returns the object with the settings used for calls to startNode. */ public UnaryCallSettings startNodeSettings() { return ((TpuStubSettings) getStubSettings()).startNodeSettings(); } /** Returns the object with the settings used for calls to startNode. */ public OperationCallSettings startNodeOperationSettings() { return ((TpuStubSettings) getStubSettings()).startNodeOperationSettings(); } /** Returns the object with the settings used for calls to updateNode. */ public UnaryCallSettings updateNodeSettings() { return ((TpuStubSettings) getStubSettings()).updateNodeSettings(); } /** Returns the object with the settings used for calls to updateNode. */ public OperationCallSettings updateNodeOperationSettings() { return ((TpuStubSettings) getStubSettings()).updateNodeOperationSettings(); } /** Returns the object with the settings used for calls to listQueuedResources. */ public PagedCallSettings< ListQueuedResourcesRequest, ListQueuedResourcesResponse, ListQueuedResourcesPagedResponse> listQueuedResourcesSettings() { return ((TpuStubSettings) getStubSettings()).listQueuedResourcesSettings(); } /** Returns the object with the settings used for calls to getQueuedResource. */ public UnaryCallSettings getQueuedResourceSettings() { return ((TpuStubSettings) getStubSettings()).getQueuedResourceSettings(); } /** Returns the object with the settings used for calls to createQueuedResource. */ public UnaryCallSettings createQueuedResourceSettings() { return ((TpuStubSettings) getStubSettings()).createQueuedResourceSettings(); } /** Returns the object with the settings used for calls to createQueuedResource. */ public OperationCallSettings createQueuedResourceOperationSettings() { return ((TpuStubSettings) getStubSettings()).createQueuedResourceOperationSettings(); } /** Returns the object with the settings used for calls to deleteQueuedResource. */ public UnaryCallSettings deleteQueuedResourceSettings() { return ((TpuStubSettings) getStubSettings()).deleteQueuedResourceSettings(); } /** Returns the object with the settings used for calls to deleteQueuedResource. */ public OperationCallSettings deleteQueuedResourceOperationSettings() { return ((TpuStubSettings) getStubSettings()).deleteQueuedResourceOperationSettings(); } /** Returns the object with the settings used for calls to resetQueuedResource. */ public UnaryCallSettings resetQueuedResourceSettings() { return ((TpuStubSettings) getStubSettings()).resetQueuedResourceSettings(); } /** Returns the object with the settings used for calls to resetQueuedResource. */ public OperationCallSettings resetQueuedResourceOperationSettings() { return ((TpuStubSettings) getStubSettings()).resetQueuedResourceOperationSettings(); } /** Returns the object with the settings used for calls to generateServiceIdentity. */ public UnaryCallSettings generateServiceIdentitySettings() { return ((TpuStubSettings) getStubSettings()).generateServiceIdentitySettings(); } /** Returns the object with the settings used for calls to listAcceleratorTypes. */ public PagedCallSettings< ListAcceleratorTypesRequest, ListAcceleratorTypesResponse, ListAcceleratorTypesPagedResponse> listAcceleratorTypesSettings() { return ((TpuStubSettings) getStubSettings()).listAcceleratorTypesSettings(); } /** Returns the object with the settings used for calls to getAcceleratorType. */ public UnaryCallSettings getAcceleratorTypeSettings() { return ((TpuStubSettings) getStubSettings()).getAcceleratorTypeSettings(); } /** Returns the object with the settings used for calls to listRuntimeVersions. */ public PagedCallSettings< ListRuntimeVersionsRequest, ListRuntimeVersionsResponse, ListRuntimeVersionsPagedResponse> listRuntimeVersionsSettings() { return ((TpuStubSettings) getStubSettings()).listRuntimeVersionsSettings(); } /** Returns the object with the settings used for calls to getRuntimeVersion. */ public UnaryCallSettings getRuntimeVersionSettings() { return ((TpuStubSettings) getStubSettings()).getRuntimeVersionSettings(); } /** Returns the object with the settings used for calls to getGuestAttributes. */ public UnaryCallSettings getGuestAttributesSettings() { return ((TpuStubSettings) getStubSettings()).getGuestAttributesSettings(); } /** Returns the object with the settings used for calls to simulateMaintenanceEvent. */ public UnaryCallSettings simulateMaintenanceEventSettings() { return ((TpuStubSettings) getStubSettings()).simulateMaintenanceEventSettings(); } /** Returns the object with the settings used for calls to simulateMaintenanceEvent. */ public OperationCallSettings simulateMaintenanceEventOperationSettings() { return ((TpuStubSettings) getStubSettings()).simulateMaintenanceEventOperationSettings(); } /** Returns the object with the settings used for calls to listLocations. */ public PagedCallSettings listLocationsSettings() { return ((TpuStubSettings) getStubSettings()).listLocationsSettings(); } /** Returns the object with the settings used for calls to getLocation. */ public UnaryCallSettings getLocationSettings() { return ((TpuStubSettings) getStubSettings()).getLocationSettings(); } public static final TpuSettings create(TpuStubSettings stub) throws IOException { return new TpuSettings.Builder(stub.toBuilder()).build(); } /** Returns a builder for the default ExecutorProvider for this service. */ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { return TpuStubSettings.defaultExecutorProviderBuilder(); } /** Returns the default service endpoint. */ public static String getDefaultEndpoint() { return TpuStubSettings.getDefaultEndpoint(); } /** Returns the default service scopes. */ public static List getDefaultServiceScopes() { return TpuStubSettings.getDefaultServiceScopes(); } /** Returns a builder for the default credentials for this service. */ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { return TpuStubSettings.defaultCredentialsProviderBuilder(); } /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return TpuStubSettings.defaultGrpcTransportProviderBuilder(); } public static TransportChannelProvider defaultTransportChannelProvider() { return TpuStubSettings.defaultTransportChannelProvider(); } public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { return TpuStubSettings.defaultApiClientHeaderProviderBuilder(); } /** Returns a new builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); } /** Returns a builder containing all the values of this settings class. */ public Builder toBuilder() { return new Builder(this); } protected TpuSettings(Builder settingsBuilder) throws IOException { super(settingsBuilder); } /** Builder for TpuSettings. */ public static class Builder extends ClientSettings.Builder { protected Builder() throws IOException { this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(TpuStubSettings.newBuilder(clientContext)); } protected Builder(TpuSettings settings) { super(settings.getStubSettings().toBuilder()); } protected Builder(TpuStubSettings.Builder stubSettings) { super(stubSettings); } private static Builder createDefault() { return new Builder(TpuStubSettings.newBuilder()); } public TpuStubSettings.Builder getStubSettingsBuilder() { return ((TpuStubSettings.Builder) getStubSettings()); } /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; } /** Returns the builder for the settings used for calls to listNodes. */ public PagedCallSettings.Builder listNodesSettings() { return getStubSettingsBuilder().listNodesSettings(); } /** Returns the builder for the settings used for calls to getNode. */ public UnaryCallSettings.Builder getNodeSettings() { return getStubSettingsBuilder().getNodeSettings(); } /** Returns the builder for the settings used for calls to createNode. */ public UnaryCallSettings.Builder createNodeSettings() { return getStubSettingsBuilder().createNodeSettings(); } /** Returns the builder for the settings used for calls to createNode. */ public OperationCallSettings.Builder createNodeOperationSettings() { return getStubSettingsBuilder().createNodeOperationSettings(); } /** Returns the builder for the settings used for calls to deleteNode. */ public UnaryCallSettings.Builder deleteNodeSettings() { return getStubSettingsBuilder().deleteNodeSettings(); } /** Returns the builder for the settings used for calls to deleteNode. */ public OperationCallSettings.Builder deleteNodeOperationSettings() { return getStubSettingsBuilder().deleteNodeOperationSettings(); } /** Returns the builder for the settings used for calls to stopNode. */ public UnaryCallSettings.Builder stopNodeSettings() { return getStubSettingsBuilder().stopNodeSettings(); } /** Returns the builder for the settings used for calls to stopNode. */ public OperationCallSettings.Builder stopNodeOperationSettings() { return getStubSettingsBuilder().stopNodeOperationSettings(); } /** Returns the builder for the settings used for calls to startNode. */ public UnaryCallSettings.Builder startNodeSettings() { return getStubSettingsBuilder().startNodeSettings(); } /** Returns the builder for the settings used for calls to startNode. */ public OperationCallSettings.Builder startNodeOperationSettings() { return getStubSettingsBuilder().startNodeOperationSettings(); } /** Returns the builder for the settings used for calls to updateNode. */ public UnaryCallSettings.Builder updateNodeSettings() { return getStubSettingsBuilder().updateNodeSettings(); } /** Returns the builder for the settings used for calls to updateNode. */ public OperationCallSettings.Builder updateNodeOperationSettings() { return getStubSettingsBuilder().updateNodeOperationSettings(); } /** Returns the builder for the settings used for calls to listQueuedResources. */ public PagedCallSettings.Builder< ListQueuedResourcesRequest, ListQueuedResourcesResponse, ListQueuedResourcesPagedResponse> listQueuedResourcesSettings() { return getStubSettingsBuilder().listQueuedResourcesSettings(); } /** Returns the builder for the settings used for calls to getQueuedResource. */ public UnaryCallSettings.Builder getQueuedResourceSettings() { return getStubSettingsBuilder().getQueuedResourceSettings(); } /** Returns the builder for the settings used for calls to createQueuedResource. */ public UnaryCallSettings.Builder createQueuedResourceSettings() { return getStubSettingsBuilder().createQueuedResourceSettings(); } /** Returns the builder for the settings used for calls to createQueuedResource. */ public OperationCallSettings.Builder< CreateQueuedResourceRequest, QueuedResource, OperationMetadata> createQueuedResourceOperationSettings() { return getStubSettingsBuilder().createQueuedResourceOperationSettings(); } /** Returns the builder for the settings used for calls to deleteQueuedResource. */ public UnaryCallSettings.Builder deleteQueuedResourceSettings() { return getStubSettingsBuilder().deleteQueuedResourceSettings(); } /** Returns the builder for the settings used for calls to deleteQueuedResource. */ public OperationCallSettings.Builder< DeleteQueuedResourceRequest, QueuedResource, OperationMetadata> deleteQueuedResourceOperationSettings() { return getStubSettingsBuilder().deleteQueuedResourceOperationSettings(); } /** Returns the builder for the settings used for calls to resetQueuedResource. */ public UnaryCallSettings.Builder resetQueuedResourceSettings() { return getStubSettingsBuilder().resetQueuedResourceSettings(); } /** Returns the builder for the settings used for calls to resetQueuedResource. */ public OperationCallSettings.Builder< ResetQueuedResourceRequest, QueuedResource, OperationMetadata> resetQueuedResourceOperationSettings() { return getStubSettingsBuilder().resetQueuedResourceOperationSettings(); } /** Returns the builder for the settings used for calls to generateServiceIdentity. */ public UnaryCallSettings.Builder< GenerateServiceIdentityRequest, GenerateServiceIdentityResponse> generateServiceIdentitySettings() { return getStubSettingsBuilder().generateServiceIdentitySettings(); } /** Returns the builder for the settings used for calls to listAcceleratorTypes. */ public PagedCallSettings.Builder< ListAcceleratorTypesRequest, ListAcceleratorTypesResponse, ListAcceleratorTypesPagedResponse> listAcceleratorTypesSettings() { return getStubSettingsBuilder().listAcceleratorTypesSettings(); } /** Returns the builder for the settings used for calls to getAcceleratorType. */ public UnaryCallSettings.Builder getAcceleratorTypeSettings() { return getStubSettingsBuilder().getAcceleratorTypeSettings(); } /** Returns the builder for the settings used for calls to listRuntimeVersions. */ public PagedCallSettings.Builder< ListRuntimeVersionsRequest, ListRuntimeVersionsResponse, ListRuntimeVersionsPagedResponse> listRuntimeVersionsSettings() { return getStubSettingsBuilder().listRuntimeVersionsSettings(); } /** Returns the builder for the settings used for calls to getRuntimeVersion. */ public UnaryCallSettings.Builder getRuntimeVersionSettings() { return getStubSettingsBuilder().getRuntimeVersionSettings(); } /** Returns the builder for the settings used for calls to getGuestAttributes. */ public UnaryCallSettings.Builder getGuestAttributesSettings() { return getStubSettingsBuilder().getGuestAttributesSettings(); } /** Returns the builder for the settings used for calls to simulateMaintenanceEvent. */ public UnaryCallSettings.Builder simulateMaintenanceEventSettings() { return getStubSettingsBuilder().simulateMaintenanceEventSettings(); } /** Returns the builder for the settings used for calls to simulateMaintenanceEvent. */ public OperationCallSettings.Builder simulateMaintenanceEventOperationSettings() { return getStubSettingsBuilder().simulateMaintenanceEventOperationSettings(); } /** Returns the builder for the settings used for calls to listLocations. */ public PagedCallSettings.Builder< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings() { return getStubSettingsBuilder().listLocationsSettings(); } /** Returns the builder for the settings used for calls to getLocation. */ public UnaryCallSettings.Builder getLocationSettings() { return getStubSettingsBuilder().getLocationSettings(); } @Override public TpuSettings build() throws IOException { return new TpuSettings(this); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy