com.google.cloud.datalabeling.v1beta1.stub.DataLabelingServiceStubSettings Maven / Gradle / Ivy
Show all versions of google-cloud-datalabeling Show documentation
/*
* 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.datalabeling.v1beta1.stub;
import static com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListAnnotatedDatasetsPagedResponse;
import static com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListAnnotationSpecSetsPagedResponse;
import static com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListDataItemsPagedResponse;
import static com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListDatasetsPagedResponse;
import static com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListEvaluationJobsPagedResponse;
import static com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListExamplesPagedResponse;
import static com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListInstructionsPagedResponse;
import static com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.SearchEvaluationsPagedResponse;
import static com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.SearchExampleComparisonsPagedResponse;
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.core.ObsoleteApi;
import com.google.api.gax.core.GaxProperties;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.grpc.ProtoOperationTransformers;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiCallContext;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.PagedListDescriptor;
import com.google.api.gax.rpc.PagedListResponseFactory;
import com.google.api.gax.rpc.StatusCode;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.datalabeling.v1beta1.AnnotatedDataset;
import com.google.cloud.datalabeling.v1beta1.AnnotationSpecSet;
import com.google.cloud.datalabeling.v1beta1.CreateAnnotationSpecSetRequest;
import com.google.cloud.datalabeling.v1beta1.CreateDatasetRequest;
import com.google.cloud.datalabeling.v1beta1.CreateEvaluationJobRequest;
import com.google.cloud.datalabeling.v1beta1.CreateInstructionMetadata;
import com.google.cloud.datalabeling.v1beta1.CreateInstructionRequest;
import com.google.cloud.datalabeling.v1beta1.DataItem;
import com.google.cloud.datalabeling.v1beta1.Dataset;
import com.google.cloud.datalabeling.v1beta1.DeleteAnnotatedDatasetRequest;
import com.google.cloud.datalabeling.v1beta1.DeleteAnnotationSpecSetRequest;
import com.google.cloud.datalabeling.v1beta1.DeleteDatasetRequest;
import com.google.cloud.datalabeling.v1beta1.DeleteEvaluationJobRequest;
import com.google.cloud.datalabeling.v1beta1.DeleteInstructionRequest;
import com.google.cloud.datalabeling.v1beta1.Evaluation;
import com.google.cloud.datalabeling.v1beta1.EvaluationJob;
import com.google.cloud.datalabeling.v1beta1.Example;
import com.google.cloud.datalabeling.v1beta1.ExportDataOperationMetadata;
import com.google.cloud.datalabeling.v1beta1.ExportDataOperationResponse;
import com.google.cloud.datalabeling.v1beta1.ExportDataRequest;
import com.google.cloud.datalabeling.v1beta1.GetAnnotatedDatasetRequest;
import com.google.cloud.datalabeling.v1beta1.GetAnnotationSpecSetRequest;
import com.google.cloud.datalabeling.v1beta1.GetDataItemRequest;
import com.google.cloud.datalabeling.v1beta1.GetDatasetRequest;
import com.google.cloud.datalabeling.v1beta1.GetEvaluationJobRequest;
import com.google.cloud.datalabeling.v1beta1.GetEvaluationRequest;
import com.google.cloud.datalabeling.v1beta1.GetExampleRequest;
import com.google.cloud.datalabeling.v1beta1.GetInstructionRequest;
import com.google.cloud.datalabeling.v1beta1.ImportDataOperationMetadata;
import com.google.cloud.datalabeling.v1beta1.ImportDataOperationResponse;
import com.google.cloud.datalabeling.v1beta1.ImportDataRequest;
import com.google.cloud.datalabeling.v1beta1.Instruction;
import com.google.cloud.datalabeling.v1beta1.LabelImageRequest;
import com.google.cloud.datalabeling.v1beta1.LabelOperationMetadata;
import com.google.cloud.datalabeling.v1beta1.LabelTextRequest;
import com.google.cloud.datalabeling.v1beta1.LabelVideoRequest;
import com.google.cloud.datalabeling.v1beta1.ListAnnotatedDatasetsRequest;
import com.google.cloud.datalabeling.v1beta1.ListAnnotatedDatasetsResponse;
import com.google.cloud.datalabeling.v1beta1.ListAnnotationSpecSetsRequest;
import com.google.cloud.datalabeling.v1beta1.ListAnnotationSpecSetsResponse;
import com.google.cloud.datalabeling.v1beta1.ListDataItemsRequest;
import com.google.cloud.datalabeling.v1beta1.ListDataItemsResponse;
import com.google.cloud.datalabeling.v1beta1.ListDatasetsRequest;
import com.google.cloud.datalabeling.v1beta1.ListDatasetsResponse;
import com.google.cloud.datalabeling.v1beta1.ListEvaluationJobsRequest;
import com.google.cloud.datalabeling.v1beta1.ListEvaluationJobsResponse;
import com.google.cloud.datalabeling.v1beta1.ListExamplesRequest;
import com.google.cloud.datalabeling.v1beta1.ListExamplesResponse;
import com.google.cloud.datalabeling.v1beta1.ListInstructionsRequest;
import com.google.cloud.datalabeling.v1beta1.ListInstructionsResponse;
import com.google.cloud.datalabeling.v1beta1.PauseEvaluationJobRequest;
import com.google.cloud.datalabeling.v1beta1.ResumeEvaluationJobRequest;
import com.google.cloud.datalabeling.v1beta1.SearchEvaluationsRequest;
import com.google.cloud.datalabeling.v1beta1.SearchEvaluationsResponse;
import com.google.cloud.datalabeling.v1beta1.SearchExampleComparisonsRequest;
import com.google.cloud.datalabeling.v1beta1.SearchExampleComparisonsResponse;
import com.google.cloud.datalabeling.v1beta1.UpdateEvaluationJobRequest;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.List;
import javax.annotation.Generated;
import org.threeten.bp.Duration;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link DataLabelingServiceStub}.
*
* The default instance has everything set to sensible defaults:
*
*
* - The default service address (datalabeling.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 createDataset:
*
*
{@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
* DataLabelingServiceStubSettings.Builder dataLabelingServiceSettingsBuilder =
* DataLabelingServiceStubSettings.newBuilder();
* dataLabelingServiceSettingsBuilder
* .createDatasetSettings()
* .setRetrySettings(
* dataLabelingServiceSettingsBuilder
* .createDatasetSettings()
* .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());
* DataLabelingServiceStubSettings dataLabelingServiceSettings =
* dataLabelingServiceSettingsBuilder.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 importData:
*
*
{@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
* DataLabelingServiceStubSettings.Builder dataLabelingServiceSettingsBuilder =
* DataLabelingServiceStubSettings.newBuilder();
* TimedRetryAlgorithm timedRetryAlgorithm =
* OperationalTimedPollAlgorithm.create(
* RetrySettings.newBuilder()
* .setInitialRetryDelayDuration(Duration.ofMillis(500))
* .setRetryDelayMultiplier(1.5)
* .setMaxRetryDelay(Duration.ofMillis(5000))
* .setTotalTimeoutDuration(Duration.ofHours(24))
* .build());
* dataLabelingServiceSettingsBuilder
* .createClusterOperationSettings()
* .setPollingAlgorithm(timedRetryAlgorithm)
* .build();
* }
*/
@BetaApi
@Generated("by gapic-generator-java")
public class DataLabelingServiceStubSettings extends StubSettings {
/** The default scopes of the service. */
private static final ImmutableList DEFAULT_SERVICE_SCOPES =
ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build();
private final UnaryCallSettings createDatasetSettings;
private final UnaryCallSettings getDatasetSettings;
private final PagedCallSettings<
ListDatasetsRequest, ListDatasetsResponse, ListDatasetsPagedResponse>
listDatasetsSettings;
private final UnaryCallSettings deleteDatasetSettings;
private final UnaryCallSettings importDataSettings;
private final OperationCallSettings<
ImportDataRequest, ImportDataOperationResponse, ImportDataOperationMetadata>
importDataOperationSettings;
private final UnaryCallSettings exportDataSettings;
private final OperationCallSettings<
ExportDataRequest, ExportDataOperationResponse, ExportDataOperationMetadata>
exportDataOperationSettings;
private final UnaryCallSettings getDataItemSettings;
private final PagedCallSettings<
ListDataItemsRequest, ListDataItemsResponse, ListDataItemsPagedResponse>
listDataItemsSettings;
private final UnaryCallSettings
getAnnotatedDatasetSettings;
private final PagedCallSettings<
ListAnnotatedDatasetsRequest,
ListAnnotatedDatasetsResponse,
ListAnnotatedDatasetsPagedResponse>
listAnnotatedDatasetsSettings;
private final UnaryCallSettings
deleteAnnotatedDatasetSettings;
private final UnaryCallSettings labelImageSettings;
private final OperationCallSettings
labelImageOperationSettings;
private final UnaryCallSettings labelVideoSettings;
private final OperationCallSettings
labelVideoOperationSettings;
private final UnaryCallSettings labelTextSettings;
private final OperationCallSettings
labelTextOperationSettings;
private final UnaryCallSettings getExampleSettings;
private final PagedCallSettings<
ListExamplesRequest, ListExamplesResponse, ListExamplesPagedResponse>
listExamplesSettings;
private final UnaryCallSettings
createAnnotationSpecSetSettings;
private final UnaryCallSettings
getAnnotationSpecSetSettings;
private final PagedCallSettings<
ListAnnotationSpecSetsRequest,
ListAnnotationSpecSetsResponse,
ListAnnotationSpecSetsPagedResponse>
listAnnotationSpecSetsSettings;
private final UnaryCallSettings
deleteAnnotationSpecSetSettings;
private final UnaryCallSettings createInstructionSettings;
private final OperationCallSettings<
CreateInstructionRequest, Instruction, CreateInstructionMetadata>
createInstructionOperationSettings;
private final UnaryCallSettings getInstructionSettings;
private final PagedCallSettings<
ListInstructionsRequest, ListInstructionsResponse, ListInstructionsPagedResponse>
listInstructionsSettings;
private final UnaryCallSettings deleteInstructionSettings;
private final UnaryCallSettings getEvaluationSettings;
private final PagedCallSettings<
SearchEvaluationsRequest, SearchEvaluationsResponse, SearchEvaluationsPagedResponse>
searchEvaluationsSettings;
private final PagedCallSettings<
SearchExampleComparisonsRequest,
SearchExampleComparisonsResponse,
SearchExampleComparisonsPagedResponse>
searchExampleComparisonsSettings;
private final UnaryCallSettings
createEvaluationJobSettings;
private final UnaryCallSettings
updateEvaluationJobSettings;
private final UnaryCallSettings getEvaluationJobSettings;
private final UnaryCallSettings pauseEvaluationJobSettings;
private final UnaryCallSettings resumeEvaluationJobSettings;
private final UnaryCallSettings deleteEvaluationJobSettings;
private final PagedCallSettings<
ListEvaluationJobsRequest, ListEvaluationJobsResponse, ListEvaluationJobsPagedResponse>
listEvaluationJobsSettings;
private static final PagedListDescriptor
LIST_DATASETS_PAGE_STR_DESC =
new PagedListDescriptor() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListDatasetsRequest injectToken(ListDatasetsRequest payload, String token) {
return ListDatasetsRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListDatasetsRequest injectPageSize(ListDatasetsRequest payload, int pageSize) {
return ListDatasetsRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(ListDatasetsRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListDatasetsResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable extractResources(ListDatasetsResponse payload) {
return payload.getDatasetsList();
}
};
private static final PagedListDescriptor
LIST_DATA_ITEMS_PAGE_STR_DESC =
new PagedListDescriptor() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListDataItemsRequest injectToken(ListDataItemsRequest payload, String token) {
return ListDataItemsRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListDataItemsRequest injectPageSize(ListDataItemsRequest payload, int pageSize) {
return ListDataItemsRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(ListDataItemsRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListDataItemsResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable extractResources(ListDataItemsResponse payload) {
return payload.getDataItemsList();
}
};
private static final PagedListDescriptor<
ListAnnotatedDatasetsRequest, ListAnnotatedDatasetsResponse, AnnotatedDataset>
LIST_ANNOTATED_DATASETS_PAGE_STR_DESC =
new PagedListDescriptor<
ListAnnotatedDatasetsRequest, ListAnnotatedDatasetsResponse, AnnotatedDataset>() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListAnnotatedDatasetsRequest injectToken(
ListAnnotatedDatasetsRequest payload, String token) {
return ListAnnotatedDatasetsRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListAnnotatedDatasetsRequest injectPageSize(
ListAnnotatedDatasetsRequest payload, int pageSize) {
return ListAnnotatedDatasetsRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(ListAnnotatedDatasetsRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListAnnotatedDatasetsResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable extractResources(
ListAnnotatedDatasetsResponse payload) {
return payload.getAnnotatedDatasetsList();
}
};
private static final PagedListDescriptor
LIST_EXAMPLES_PAGE_STR_DESC =
new PagedListDescriptor() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListExamplesRequest injectToken(ListExamplesRequest payload, String token) {
return ListExamplesRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListExamplesRequest injectPageSize(ListExamplesRequest payload, int pageSize) {
return ListExamplesRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(ListExamplesRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListExamplesResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable extractResources(ListExamplesResponse payload) {
return payload.getExamplesList();
}
};
private static final PagedListDescriptor<
ListAnnotationSpecSetsRequest, ListAnnotationSpecSetsResponse, AnnotationSpecSet>
LIST_ANNOTATION_SPEC_SETS_PAGE_STR_DESC =
new PagedListDescriptor<
ListAnnotationSpecSetsRequest, ListAnnotationSpecSetsResponse, AnnotationSpecSet>() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListAnnotationSpecSetsRequest injectToken(
ListAnnotationSpecSetsRequest payload, String token) {
return ListAnnotationSpecSetsRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListAnnotationSpecSetsRequest injectPageSize(
ListAnnotationSpecSetsRequest payload, int pageSize) {
return ListAnnotationSpecSetsRequest.newBuilder(payload)
.setPageSize(pageSize)
.build();
}
@Override
public Integer extractPageSize(ListAnnotationSpecSetsRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListAnnotationSpecSetsResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable extractResources(
ListAnnotationSpecSetsResponse payload) {
return payload.getAnnotationSpecSetsList();
}
};
private static final PagedListDescriptor<
ListInstructionsRequest, ListInstructionsResponse, Instruction>
LIST_INSTRUCTIONS_PAGE_STR_DESC =
new PagedListDescriptor<
ListInstructionsRequest, ListInstructionsResponse, Instruction>() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListInstructionsRequest injectToken(
ListInstructionsRequest payload, String token) {
return ListInstructionsRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListInstructionsRequest injectPageSize(
ListInstructionsRequest payload, int pageSize) {
return ListInstructionsRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(ListInstructionsRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListInstructionsResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable extractResources(ListInstructionsResponse payload) {
return payload.getInstructionsList();
}
};
private static final PagedListDescriptor<
SearchEvaluationsRequest, SearchEvaluationsResponse, Evaluation>
SEARCH_EVALUATIONS_PAGE_STR_DESC =
new PagedListDescriptor<
SearchEvaluationsRequest, SearchEvaluationsResponse, Evaluation>() {
@Override
public String emptyToken() {
return "";
}
@Override
public SearchEvaluationsRequest injectToken(
SearchEvaluationsRequest payload, String token) {
return SearchEvaluationsRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public SearchEvaluationsRequest injectPageSize(
SearchEvaluationsRequest payload, int pageSize) {
return SearchEvaluationsRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(SearchEvaluationsRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(SearchEvaluationsResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable extractResources(SearchEvaluationsResponse payload) {
return payload.getEvaluationsList();
}
};
private static final PagedListDescriptor<
SearchExampleComparisonsRequest,
SearchExampleComparisonsResponse,
SearchExampleComparisonsResponse.ExampleComparison>
SEARCH_EXAMPLE_COMPARISONS_PAGE_STR_DESC =
new PagedListDescriptor<
SearchExampleComparisonsRequest,
SearchExampleComparisonsResponse,
SearchExampleComparisonsResponse.ExampleComparison>() {
@Override
public String emptyToken() {
return "";
}
@Override
public SearchExampleComparisonsRequest injectToken(
SearchExampleComparisonsRequest payload, String token) {
return SearchExampleComparisonsRequest.newBuilder(payload)
.setPageToken(token)
.build();
}
@Override
public SearchExampleComparisonsRequest injectPageSize(
SearchExampleComparisonsRequest payload, int pageSize) {
return SearchExampleComparisonsRequest.newBuilder(payload)
.setPageSize(pageSize)
.build();
}
@Override
public Integer extractPageSize(SearchExampleComparisonsRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(SearchExampleComparisonsResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable extractResources(
SearchExampleComparisonsResponse payload) {
return payload.getExampleComparisonsList();
}
};
private static final PagedListDescriptor<
ListEvaluationJobsRequest, ListEvaluationJobsResponse, EvaluationJob>
LIST_EVALUATION_JOBS_PAGE_STR_DESC =
new PagedListDescriptor<
ListEvaluationJobsRequest, ListEvaluationJobsResponse, EvaluationJob>() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListEvaluationJobsRequest injectToken(
ListEvaluationJobsRequest payload, String token) {
return ListEvaluationJobsRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListEvaluationJobsRequest injectPageSize(
ListEvaluationJobsRequest payload, int pageSize) {
return ListEvaluationJobsRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(ListEvaluationJobsRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListEvaluationJobsResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable extractResources(ListEvaluationJobsResponse payload) {
return payload.getEvaluationJobsList();
}
};
private static final PagedListResponseFactory<
ListDatasetsRequest, ListDatasetsResponse, ListDatasetsPagedResponse>
LIST_DATASETS_PAGE_STR_FACT =
new PagedListResponseFactory<
ListDatasetsRequest, ListDatasetsResponse, ListDatasetsPagedResponse>() {
@Override
public ApiFuture getFuturePagedResponse(
UnaryCallable callable,
ListDatasetsRequest request,
ApiCallContext context,
ApiFuture futureResponse) {
PageContext pageContext =
PageContext.create(callable, LIST_DATASETS_PAGE_STR_DESC, request, context);
return ListDatasetsPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
ListDataItemsRequest, ListDataItemsResponse, ListDataItemsPagedResponse>
LIST_DATA_ITEMS_PAGE_STR_FACT =
new PagedListResponseFactory<
ListDataItemsRequest, ListDataItemsResponse, ListDataItemsPagedResponse>() {
@Override
public ApiFuture getFuturePagedResponse(
UnaryCallable callable,
ListDataItemsRequest request,
ApiCallContext context,
ApiFuture futureResponse) {
PageContext pageContext =
PageContext.create(callable, LIST_DATA_ITEMS_PAGE_STR_DESC, request, context);
return ListDataItemsPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
ListAnnotatedDatasetsRequest,
ListAnnotatedDatasetsResponse,
ListAnnotatedDatasetsPagedResponse>
LIST_ANNOTATED_DATASETS_PAGE_STR_FACT =
new PagedListResponseFactory<
ListAnnotatedDatasetsRequest,
ListAnnotatedDatasetsResponse,
ListAnnotatedDatasetsPagedResponse>() {
@Override
public ApiFuture getFuturePagedResponse(
UnaryCallable callable,
ListAnnotatedDatasetsRequest request,
ApiCallContext context,
ApiFuture futureResponse) {
PageContext<
ListAnnotatedDatasetsRequest, ListAnnotatedDatasetsResponse, AnnotatedDataset>
pageContext =
PageContext.create(
callable, LIST_ANNOTATED_DATASETS_PAGE_STR_DESC, request, context);
return ListAnnotatedDatasetsPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
ListExamplesRequest, ListExamplesResponse, ListExamplesPagedResponse>
LIST_EXAMPLES_PAGE_STR_FACT =
new PagedListResponseFactory<
ListExamplesRequest, ListExamplesResponse, ListExamplesPagedResponse>() {
@Override
public ApiFuture getFuturePagedResponse(
UnaryCallable callable,
ListExamplesRequest request,
ApiCallContext context,
ApiFuture futureResponse) {
PageContext pageContext =
PageContext.create(callable, LIST_EXAMPLES_PAGE_STR_DESC, request, context);
return ListExamplesPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
ListAnnotationSpecSetsRequest,
ListAnnotationSpecSetsResponse,
ListAnnotationSpecSetsPagedResponse>
LIST_ANNOTATION_SPEC_SETS_PAGE_STR_FACT =
new PagedListResponseFactory<
ListAnnotationSpecSetsRequest,
ListAnnotationSpecSetsResponse,
ListAnnotationSpecSetsPagedResponse>() {
@Override
public ApiFuture getFuturePagedResponse(
UnaryCallable
callable,
ListAnnotationSpecSetsRequest request,
ApiCallContext context,
ApiFuture futureResponse) {
PageContext<
ListAnnotationSpecSetsRequest,
ListAnnotationSpecSetsResponse,
AnnotationSpecSet>
pageContext =
PageContext.create(
callable, LIST_ANNOTATION_SPEC_SETS_PAGE_STR_DESC, request, context);
return ListAnnotationSpecSetsPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
ListInstructionsRequest, ListInstructionsResponse, ListInstructionsPagedResponse>
LIST_INSTRUCTIONS_PAGE_STR_FACT =
new PagedListResponseFactory<
ListInstructionsRequest, ListInstructionsResponse, ListInstructionsPagedResponse>() {
@Override
public ApiFuture getFuturePagedResponse(
UnaryCallable callable,
ListInstructionsRequest request,
ApiCallContext context,
ApiFuture futureResponse) {
PageContext
pageContext =
PageContext.create(
callable, LIST_INSTRUCTIONS_PAGE_STR_DESC, request, context);
return ListInstructionsPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
SearchEvaluationsRequest, SearchEvaluationsResponse, SearchEvaluationsPagedResponse>
SEARCH_EVALUATIONS_PAGE_STR_FACT =
new PagedListResponseFactory<
SearchEvaluationsRequest,
SearchEvaluationsResponse,
SearchEvaluationsPagedResponse>() {
@Override
public ApiFuture getFuturePagedResponse(
UnaryCallable callable,
SearchEvaluationsRequest request,
ApiCallContext context,
ApiFuture futureResponse) {
PageContext
pageContext =
PageContext.create(
callable, SEARCH_EVALUATIONS_PAGE_STR_DESC, request, context);
return SearchEvaluationsPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
SearchExampleComparisonsRequest,
SearchExampleComparisonsResponse,
SearchExampleComparisonsPagedResponse>
SEARCH_EXAMPLE_COMPARISONS_PAGE_STR_FACT =
new PagedListResponseFactory<
SearchExampleComparisonsRequest,
SearchExampleComparisonsResponse,
SearchExampleComparisonsPagedResponse>() {
@Override
public ApiFuture getFuturePagedResponse(
UnaryCallable
callable,
SearchExampleComparisonsRequest request,
ApiCallContext context,
ApiFuture futureResponse) {
PageContext<
SearchExampleComparisonsRequest,
SearchExampleComparisonsResponse,
SearchExampleComparisonsResponse.ExampleComparison>
pageContext =
PageContext.create(
callable, SEARCH_EXAMPLE_COMPARISONS_PAGE_STR_DESC, request, context);
return SearchExampleComparisonsPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
ListEvaluationJobsRequest, ListEvaluationJobsResponse, ListEvaluationJobsPagedResponse>
LIST_EVALUATION_JOBS_PAGE_STR_FACT =
new PagedListResponseFactory<
ListEvaluationJobsRequest,
ListEvaluationJobsResponse,
ListEvaluationJobsPagedResponse>() {
@Override
public ApiFuture getFuturePagedResponse(
UnaryCallable callable,
ListEvaluationJobsRequest request,
ApiCallContext context,
ApiFuture futureResponse) {
PageContext
pageContext =
PageContext.create(
callable, LIST_EVALUATION_JOBS_PAGE_STR_DESC, request, context);
return ListEvaluationJobsPagedResponse.createAsync(pageContext, futureResponse);
}
};
/** Returns the object with the settings used for calls to createDataset. */
public UnaryCallSettings createDatasetSettings() {
return createDatasetSettings;
}
/** Returns the object with the settings used for calls to getDataset. */
public UnaryCallSettings getDatasetSettings() {
return getDatasetSettings;
}
/** Returns the object with the settings used for calls to listDatasets. */
public PagedCallSettings
listDatasetsSettings() {
return listDatasetsSettings;
}
/** Returns the object with the settings used for calls to deleteDataset. */
public UnaryCallSettings deleteDatasetSettings() {
return deleteDatasetSettings;
}
/** Returns the object with the settings used for calls to importData. */
public UnaryCallSettings importDataSettings() {
return importDataSettings;
}
/** Returns the object with the settings used for calls to importData. */
public OperationCallSettings<
ImportDataRequest, ImportDataOperationResponse, ImportDataOperationMetadata>
importDataOperationSettings() {
return importDataOperationSettings;
}
/** Returns the object with the settings used for calls to exportData. */
public UnaryCallSettings exportDataSettings() {
return exportDataSettings;
}
/** Returns the object with the settings used for calls to exportData. */
public OperationCallSettings<
ExportDataRequest, ExportDataOperationResponse, ExportDataOperationMetadata>
exportDataOperationSettings() {
return exportDataOperationSettings;
}
/** Returns the object with the settings used for calls to getDataItem. */
public UnaryCallSettings getDataItemSettings() {
return getDataItemSettings;
}
/** Returns the object with the settings used for calls to listDataItems. */
public PagedCallSettings
listDataItemsSettings() {
return listDataItemsSettings;
}
/** Returns the object with the settings used for calls to getAnnotatedDataset. */
public UnaryCallSettings
getAnnotatedDatasetSettings() {
return getAnnotatedDatasetSettings;
}
/** Returns the object with the settings used for calls to listAnnotatedDatasets. */
public PagedCallSettings<
ListAnnotatedDatasetsRequest,
ListAnnotatedDatasetsResponse,
ListAnnotatedDatasetsPagedResponse>
listAnnotatedDatasetsSettings() {
return listAnnotatedDatasetsSettings;
}
/** Returns the object with the settings used for calls to deleteAnnotatedDataset. */
public UnaryCallSettings deleteAnnotatedDatasetSettings() {
return deleteAnnotatedDatasetSettings;
}
/** Returns the object with the settings used for calls to labelImage. */
public UnaryCallSettings labelImageSettings() {
return labelImageSettings;
}
/** Returns the object with the settings used for calls to labelImage. */
public OperationCallSettings
labelImageOperationSettings() {
return labelImageOperationSettings;
}
/** Returns the object with the settings used for calls to labelVideo. */
public UnaryCallSettings labelVideoSettings() {
return labelVideoSettings;
}
/** Returns the object with the settings used for calls to labelVideo. */
public OperationCallSettings
labelVideoOperationSettings() {
return labelVideoOperationSettings;
}
/** Returns the object with the settings used for calls to labelText. */
public UnaryCallSettings labelTextSettings() {
return labelTextSettings;
}
/** Returns the object with the settings used for calls to labelText. */
public OperationCallSettings
labelTextOperationSettings() {
return labelTextOperationSettings;
}
/** Returns the object with the settings used for calls to getExample. */
public UnaryCallSettings getExampleSettings() {
return getExampleSettings;
}
/** Returns the object with the settings used for calls to listExamples. */
public PagedCallSettings
listExamplesSettings() {
return listExamplesSettings;
}
/** Returns the object with the settings used for calls to createAnnotationSpecSet. */
public UnaryCallSettings
createAnnotationSpecSetSettings() {
return createAnnotationSpecSetSettings;
}
/** Returns the object with the settings used for calls to getAnnotationSpecSet. */
public UnaryCallSettings
getAnnotationSpecSetSettings() {
return getAnnotationSpecSetSettings;
}
/** Returns the object with the settings used for calls to listAnnotationSpecSets. */
public PagedCallSettings<
ListAnnotationSpecSetsRequest,
ListAnnotationSpecSetsResponse,
ListAnnotationSpecSetsPagedResponse>
listAnnotationSpecSetsSettings() {
return listAnnotationSpecSetsSettings;
}
/** Returns the object with the settings used for calls to deleteAnnotationSpecSet. */
public UnaryCallSettings
deleteAnnotationSpecSetSettings() {
return deleteAnnotationSpecSetSettings;
}
/** Returns the object with the settings used for calls to createInstruction. */
public UnaryCallSettings createInstructionSettings() {
return createInstructionSettings;
}
/** Returns the object with the settings used for calls to createInstruction. */
public OperationCallSettings
createInstructionOperationSettings() {
return createInstructionOperationSettings;
}
/** Returns the object with the settings used for calls to getInstruction. */
public UnaryCallSettings getInstructionSettings() {
return getInstructionSettings;
}
/** Returns the object with the settings used for calls to listInstructions. */
public PagedCallSettings<
ListInstructionsRequest, ListInstructionsResponse, ListInstructionsPagedResponse>
listInstructionsSettings() {
return listInstructionsSettings;
}
/** Returns the object with the settings used for calls to deleteInstruction. */
public UnaryCallSettings deleteInstructionSettings() {
return deleteInstructionSettings;
}
/** Returns the object with the settings used for calls to getEvaluation. */
public UnaryCallSettings getEvaluationSettings() {
return getEvaluationSettings;
}
/** Returns the object with the settings used for calls to searchEvaluations. */
public PagedCallSettings<
SearchEvaluationsRequest, SearchEvaluationsResponse, SearchEvaluationsPagedResponse>
searchEvaluationsSettings() {
return searchEvaluationsSettings;
}
/** Returns the object with the settings used for calls to searchExampleComparisons. */
public PagedCallSettings<
SearchExampleComparisonsRequest,
SearchExampleComparisonsResponse,
SearchExampleComparisonsPagedResponse>
searchExampleComparisonsSettings() {
return searchExampleComparisonsSettings;
}
/** Returns the object with the settings used for calls to createEvaluationJob. */
public UnaryCallSettings
createEvaluationJobSettings() {
return createEvaluationJobSettings;
}
/** Returns the object with the settings used for calls to updateEvaluationJob. */
public UnaryCallSettings
updateEvaluationJobSettings() {
return updateEvaluationJobSettings;
}
/** Returns the object with the settings used for calls to getEvaluationJob. */
public UnaryCallSettings getEvaluationJobSettings() {
return getEvaluationJobSettings;
}
/** Returns the object with the settings used for calls to pauseEvaluationJob. */
public UnaryCallSettings pauseEvaluationJobSettings() {
return pauseEvaluationJobSettings;
}
/** Returns the object with the settings used for calls to resumeEvaluationJob. */
public UnaryCallSettings resumeEvaluationJobSettings() {
return resumeEvaluationJobSettings;
}
/** Returns the object with the settings used for calls to deleteEvaluationJob. */
public UnaryCallSettings deleteEvaluationJobSettings() {
return deleteEvaluationJobSettings;
}
/** Returns the object with the settings used for calls to listEvaluationJobs. */
public PagedCallSettings<
ListEvaluationJobsRequest, ListEvaluationJobsResponse, ListEvaluationJobsPagedResponse>
listEvaluationJobsSettings() {
return listEvaluationJobsSettings;
}
public DataLabelingServiceStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcDataLabelingServiceStub.create(this);
}
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
}
/** Returns the default service name. */
@Override
public String getServiceName() {
return "datalabeling";
}
/** Returns a builder for the default ExecutorProvider for this service. */
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
return InstantiatingExecutorProvider.newBuilder();
}
/** Returns the default service endpoint. */
@ObsoleteApi("Use getEndpoint() instead")
public static String getDefaultEndpoint() {
return "datalabeling.googleapis.com:443";
}
/** Returns the default mTLS service endpoint. */
public static String getDefaultMtlsEndpoint() {
return "datalabeling.mtls.googleapis.com:443";
}
/** Returns the default service scopes. */
public static List getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
}
/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return GoogleCredentialsProvider.newBuilder()
.setScopesToApply(DEFAULT_SERVICE_SCOPES)
.setUseJwtAccessWithScope(true);
}
/** Returns a builder for the default ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(DataLabelingServiceStubSettings.class))
.setTransportToken(
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
/** 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 DataLabelingServiceStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
createDatasetSettings = settingsBuilder.createDatasetSettings().build();
getDatasetSettings = settingsBuilder.getDatasetSettings().build();
listDatasetsSettings = settingsBuilder.listDatasetsSettings().build();
deleteDatasetSettings = settingsBuilder.deleteDatasetSettings().build();
importDataSettings = settingsBuilder.importDataSettings().build();
importDataOperationSettings = settingsBuilder.importDataOperationSettings().build();
exportDataSettings = settingsBuilder.exportDataSettings().build();
exportDataOperationSettings = settingsBuilder.exportDataOperationSettings().build();
getDataItemSettings = settingsBuilder.getDataItemSettings().build();
listDataItemsSettings = settingsBuilder.listDataItemsSettings().build();
getAnnotatedDatasetSettings = settingsBuilder.getAnnotatedDatasetSettings().build();
listAnnotatedDatasetsSettings = settingsBuilder.listAnnotatedDatasetsSettings().build();
deleteAnnotatedDatasetSettings = settingsBuilder.deleteAnnotatedDatasetSettings().build();
labelImageSettings = settingsBuilder.labelImageSettings().build();
labelImageOperationSettings = settingsBuilder.labelImageOperationSettings().build();
labelVideoSettings = settingsBuilder.labelVideoSettings().build();
labelVideoOperationSettings = settingsBuilder.labelVideoOperationSettings().build();
labelTextSettings = settingsBuilder.labelTextSettings().build();
labelTextOperationSettings = settingsBuilder.labelTextOperationSettings().build();
getExampleSettings = settingsBuilder.getExampleSettings().build();
listExamplesSettings = settingsBuilder.listExamplesSettings().build();
createAnnotationSpecSetSettings = settingsBuilder.createAnnotationSpecSetSettings().build();
getAnnotationSpecSetSettings = settingsBuilder.getAnnotationSpecSetSettings().build();
listAnnotationSpecSetsSettings = settingsBuilder.listAnnotationSpecSetsSettings().build();
deleteAnnotationSpecSetSettings = settingsBuilder.deleteAnnotationSpecSetSettings().build();
createInstructionSettings = settingsBuilder.createInstructionSettings().build();
createInstructionOperationSettings =
settingsBuilder.createInstructionOperationSettings().build();
getInstructionSettings = settingsBuilder.getInstructionSettings().build();
listInstructionsSettings = settingsBuilder.listInstructionsSettings().build();
deleteInstructionSettings = settingsBuilder.deleteInstructionSettings().build();
getEvaluationSettings = settingsBuilder.getEvaluationSettings().build();
searchEvaluationsSettings = settingsBuilder.searchEvaluationsSettings().build();
searchExampleComparisonsSettings = settingsBuilder.searchExampleComparisonsSettings().build();
createEvaluationJobSettings = settingsBuilder.createEvaluationJobSettings().build();
updateEvaluationJobSettings = settingsBuilder.updateEvaluationJobSettings().build();
getEvaluationJobSettings = settingsBuilder.getEvaluationJobSettings().build();
pauseEvaluationJobSettings = settingsBuilder.pauseEvaluationJobSettings().build();
resumeEvaluationJobSettings = settingsBuilder.resumeEvaluationJobSettings().build();
deleteEvaluationJobSettings = settingsBuilder.deleteEvaluationJobSettings().build();
listEvaluationJobsSettings = settingsBuilder.listEvaluationJobsSettings().build();
}
/** Builder for DataLabelingServiceStubSettings. */
public static class Builder
extends StubSettings.Builder {
private final ImmutableList> unaryMethodSettingsBuilders;
private final UnaryCallSettings.Builder createDatasetSettings;
private final UnaryCallSettings.Builder getDatasetSettings;
private final PagedCallSettings.Builder<
ListDatasetsRequest, ListDatasetsResponse, ListDatasetsPagedResponse>
listDatasetsSettings;
private final UnaryCallSettings.Builder deleteDatasetSettings;
private final UnaryCallSettings.Builder importDataSettings;
private final OperationCallSettings.Builder<
ImportDataRequest, ImportDataOperationResponse, ImportDataOperationMetadata>
importDataOperationSettings;
private final UnaryCallSettings.Builder exportDataSettings;
private final OperationCallSettings.Builder<
ExportDataRequest, ExportDataOperationResponse, ExportDataOperationMetadata>
exportDataOperationSettings;
private final UnaryCallSettings.Builder getDataItemSettings;
private final PagedCallSettings.Builder<
ListDataItemsRequest, ListDataItemsResponse, ListDataItemsPagedResponse>
listDataItemsSettings;
private final UnaryCallSettings.Builder
getAnnotatedDatasetSettings;
private final PagedCallSettings.Builder<
ListAnnotatedDatasetsRequest,
ListAnnotatedDatasetsResponse,
ListAnnotatedDatasetsPagedResponse>
listAnnotatedDatasetsSettings;
private final UnaryCallSettings.Builder
deleteAnnotatedDatasetSettings;
private final UnaryCallSettings.Builder labelImageSettings;
private final OperationCallSettings.Builder<
LabelImageRequest, AnnotatedDataset, LabelOperationMetadata>
labelImageOperationSettings;
private final UnaryCallSettings.Builder labelVideoSettings;
private final OperationCallSettings.Builder<
LabelVideoRequest, AnnotatedDataset, LabelOperationMetadata>
labelVideoOperationSettings;
private final UnaryCallSettings.Builder labelTextSettings;
private final OperationCallSettings.Builder<
LabelTextRequest, AnnotatedDataset, LabelOperationMetadata>
labelTextOperationSettings;
private final UnaryCallSettings.Builder getExampleSettings;
private final PagedCallSettings.Builder<
ListExamplesRequest, ListExamplesResponse, ListExamplesPagedResponse>
listExamplesSettings;
private final UnaryCallSettings.Builder
createAnnotationSpecSetSettings;
private final UnaryCallSettings.Builder
getAnnotationSpecSetSettings;
private final PagedCallSettings.Builder<
ListAnnotationSpecSetsRequest,
ListAnnotationSpecSetsResponse,
ListAnnotationSpecSetsPagedResponse>
listAnnotationSpecSetsSettings;
private final UnaryCallSettings.Builder
deleteAnnotationSpecSetSettings;
private final UnaryCallSettings.Builder
createInstructionSettings;
private final OperationCallSettings.Builder<
CreateInstructionRequest, Instruction, CreateInstructionMetadata>
createInstructionOperationSettings;
private final UnaryCallSettings.Builder
getInstructionSettings;
private final PagedCallSettings.Builder<
ListInstructionsRequest, ListInstructionsResponse, ListInstructionsPagedResponse>
listInstructionsSettings;
private final UnaryCallSettings.Builder
deleteInstructionSettings;
private final UnaryCallSettings.Builder getEvaluationSettings;
private final PagedCallSettings.Builder<
SearchEvaluationsRequest, SearchEvaluationsResponse, SearchEvaluationsPagedResponse>
searchEvaluationsSettings;
private final PagedCallSettings.Builder<
SearchExampleComparisonsRequest,
SearchExampleComparisonsResponse,
SearchExampleComparisonsPagedResponse>
searchExampleComparisonsSettings;
private final UnaryCallSettings.Builder
createEvaluationJobSettings;
private final UnaryCallSettings.Builder
updateEvaluationJobSettings;
private final UnaryCallSettings.Builder
getEvaluationJobSettings;
private final UnaryCallSettings.Builder
pauseEvaluationJobSettings;
private final UnaryCallSettings.Builder
resumeEvaluationJobSettings;
private final UnaryCallSettings.Builder
deleteEvaluationJobSettings;
private final PagedCallSettings.Builder<
ListEvaluationJobsRequest, ListEvaluationJobsResponse, ListEvaluationJobsPagedResponse>
listEvaluationJobsSettings;
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
static {
ImmutableMap.Builder> definitions =
ImmutableMap.builder();
definitions.put(
"no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList()));
definitions.put(
"retry_policy_1_codes",
ImmutableSet.copyOf(
Lists.newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
private static final ImmutableMap RETRY_PARAM_DEFINITIONS;
static {
ImmutableMap.Builder definitions = ImmutableMap.builder();
RetrySettings settings = null;
settings =
RetrySettings.newBuilder()
.setInitialRpcTimeout(Duration.ofMillis(30000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(30000L))
.setTotalTimeout(Duration.ofMillis(30000L))
.build();
definitions.put("no_retry_0_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(30000L))
.setInitialRpcTimeout(Duration.ofMillis(30000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(30000L))
.setTotalTimeout(Duration.ofMillis(30000L))
.build();
definitions.put("retry_policy_1_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}
protected Builder() {
this(((ClientContext) null));
}
protected Builder(ClientContext clientContext) {
super(clientContext);
createDatasetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getDatasetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listDatasetsSettings = PagedCallSettings.newBuilder(LIST_DATASETS_PAGE_STR_FACT);
deleteDatasetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
importDataSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
importDataOperationSettings = OperationCallSettings.newBuilder();
exportDataSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
exportDataOperationSettings = OperationCallSettings.newBuilder();
getDataItemSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listDataItemsSettings = PagedCallSettings.newBuilder(LIST_DATA_ITEMS_PAGE_STR_FACT);
getAnnotatedDatasetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listAnnotatedDatasetsSettings =
PagedCallSettings.newBuilder(LIST_ANNOTATED_DATASETS_PAGE_STR_FACT);
deleteAnnotatedDatasetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
labelImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
labelImageOperationSettings = OperationCallSettings.newBuilder();
labelVideoSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
labelVideoOperationSettings = OperationCallSettings.newBuilder();
labelTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
labelTextOperationSettings = OperationCallSettings.newBuilder();
getExampleSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listExamplesSettings = PagedCallSettings.newBuilder(LIST_EXAMPLES_PAGE_STR_FACT);
createAnnotationSpecSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getAnnotationSpecSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listAnnotationSpecSetsSettings =
PagedCallSettings.newBuilder(LIST_ANNOTATION_SPEC_SETS_PAGE_STR_FACT);
deleteAnnotationSpecSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
createInstructionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
createInstructionOperationSettings = OperationCallSettings.newBuilder();
getInstructionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listInstructionsSettings = PagedCallSettings.newBuilder(LIST_INSTRUCTIONS_PAGE_STR_FACT);
deleteInstructionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getEvaluationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
searchEvaluationsSettings = PagedCallSettings.newBuilder(SEARCH_EVALUATIONS_PAGE_STR_FACT);
searchExampleComparisonsSettings =
PagedCallSettings.newBuilder(SEARCH_EXAMPLE_COMPARISONS_PAGE_STR_FACT);
createEvaluationJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
updateEvaluationJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getEvaluationJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
pauseEvaluationJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
resumeEvaluationJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
deleteEvaluationJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listEvaluationJobsSettings = PagedCallSettings.newBuilder(LIST_EVALUATION_JOBS_PAGE_STR_FACT);
unaryMethodSettingsBuilders =
ImmutableList.>of(
createDatasetSettings,
getDatasetSettings,
listDatasetsSettings,
deleteDatasetSettings,
importDataSettings,
exportDataSettings,
getDataItemSettings,
listDataItemsSettings,
getAnnotatedDatasetSettings,
listAnnotatedDatasetsSettings,
deleteAnnotatedDatasetSettings,
labelImageSettings,
labelVideoSettings,
labelTextSettings,
getExampleSettings,
listExamplesSettings,
createAnnotationSpecSetSettings,
getAnnotationSpecSetSettings,
listAnnotationSpecSetsSettings,
deleteAnnotationSpecSetSettings,
createInstructionSettings,
getInstructionSettings,
listInstructionsSettings,
deleteInstructionSettings,
getEvaluationSettings,
searchEvaluationsSettings,
searchExampleComparisonsSettings,
createEvaluationJobSettings,
updateEvaluationJobSettings,
getEvaluationJobSettings,
pauseEvaluationJobSettings,
resumeEvaluationJobSettings,
deleteEvaluationJobSettings,
listEvaluationJobsSettings);
initDefaults(this);
}
protected Builder(DataLabelingServiceStubSettings settings) {
super(settings);
createDatasetSettings = settings.createDatasetSettings.toBuilder();
getDatasetSettings = settings.getDatasetSettings.toBuilder();
listDatasetsSettings = settings.listDatasetsSettings.toBuilder();
deleteDatasetSettings = settings.deleteDatasetSettings.toBuilder();
importDataSettings = settings.importDataSettings.toBuilder();
importDataOperationSettings = settings.importDataOperationSettings.toBuilder();
exportDataSettings = settings.exportDataSettings.toBuilder();
exportDataOperationSettings = settings.exportDataOperationSettings.toBuilder();
getDataItemSettings = settings.getDataItemSettings.toBuilder();
listDataItemsSettings = settings.listDataItemsSettings.toBuilder();
getAnnotatedDatasetSettings = settings.getAnnotatedDatasetSettings.toBuilder();
listAnnotatedDatasetsSettings = settings.listAnnotatedDatasetsSettings.toBuilder();
deleteAnnotatedDatasetSettings = settings.deleteAnnotatedDatasetSettings.toBuilder();
labelImageSettings = settings.labelImageSettings.toBuilder();
labelImageOperationSettings = settings.labelImageOperationSettings.toBuilder();
labelVideoSettings = settings.labelVideoSettings.toBuilder();
labelVideoOperationSettings = settings.labelVideoOperationSettings.toBuilder();
labelTextSettings = settings.labelTextSettings.toBuilder();
labelTextOperationSettings = settings.labelTextOperationSettings.toBuilder();
getExampleSettings = settings.getExampleSettings.toBuilder();
listExamplesSettings = settings.listExamplesSettings.toBuilder();
createAnnotationSpecSetSettings = settings.createAnnotationSpecSetSettings.toBuilder();
getAnnotationSpecSetSettings = settings.getAnnotationSpecSetSettings.toBuilder();
listAnnotationSpecSetsSettings = settings.listAnnotationSpecSetsSettings.toBuilder();
deleteAnnotationSpecSetSettings = settings.deleteAnnotationSpecSetSettings.toBuilder();
createInstructionSettings = settings.createInstructionSettings.toBuilder();
createInstructionOperationSettings = settings.createInstructionOperationSettings.toBuilder();
getInstructionSettings = settings.getInstructionSettings.toBuilder();
listInstructionsSettings = settings.listInstructionsSettings.toBuilder();
deleteInstructionSettings = settings.deleteInstructionSettings.toBuilder();
getEvaluationSettings = settings.getEvaluationSettings.toBuilder();
searchEvaluationsSettings = settings.searchEvaluationsSettings.toBuilder();
searchExampleComparisonsSettings = settings.searchExampleComparisonsSettings.toBuilder();
createEvaluationJobSettings = settings.createEvaluationJobSettings.toBuilder();
updateEvaluationJobSettings = settings.updateEvaluationJobSettings.toBuilder();
getEvaluationJobSettings = settings.getEvaluationJobSettings.toBuilder();
pauseEvaluationJobSettings = settings.pauseEvaluationJobSettings.toBuilder();
resumeEvaluationJobSettings = settings.resumeEvaluationJobSettings.toBuilder();
deleteEvaluationJobSettings = settings.deleteEvaluationJobSettings.toBuilder();
listEvaluationJobsSettings = settings.listEvaluationJobsSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
createDatasetSettings,
getDatasetSettings,
listDatasetsSettings,
deleteDatasetSettings,
importDataSettings,
exportDataSettings,
getDataItemSettings,
listDataItemsSettings,
getAnnotatedDatasetSettings,
listAnnotatedDatasetsSettings,
deleteAnnotatedDatasetSettings,
labelImageSettings,
labelVideoSettings,
labelTextSettings,
getExampleSettings,
listExamplesSettings,
createAnnotationSpecSetSettings,
getAnnotationSpecSetSettings,
listAnnotationSpecSetsSettings,
deleteAnnotationSpecSetSettings,
createInstructionSettings,
getInstructionSettings,
listInstructionsSettings,
deleteInstructionSettings,
getEvaluationSettings,
searchEvaluationsSettings,
searchExampleComparisonsSettings,
createEvaluationJobSettings,
updateEvaluationJobSettings,
getEvaluationJobSettings,
pauseEvaluationJobSettings,
resumeEvaluationJobSettings,
deleteEvaluationJobSettings,
listEvaluationJobsSettings);
}
private static Builder createDefault() {
Builder builder = new Builder(((ClientContext) null));
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);
return initDefaults(builder);
}
private static Builder initDefaults(Builder builder) {
builder
.createDatasetSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.getDatasetSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listDatasetsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.deleteDatasetSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.importDataSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.exportDataSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.getDataItemSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listDataItemsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.getAnnotatedDatasetSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listAnnotatedDatasetsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.deleteAnnotatedDatasetSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
builder
.labelImageSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.labelVideoSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.labelTextSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.getExampleSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listExamplesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.createAnnotationSpecSetSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.getAnnotationSpecSetSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listAnnotationSpecSetsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.deleteAnnotationSpecSetSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.createInstructionSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.getInstructionSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listInstructionsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.deleteInstructionSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.getEvaluationSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.searchEvaluationsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.searchExampleComparisonsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.createEvaluationJobSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.updateEvaluationJobSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.getEvaluationJobSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.pauseEvaluationJobSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.resumeEvaluationJobSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.deleteEvaluationJobSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listEvaluationJobsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.importDataOperationSettings()
.setInitialCallSettings(
UnaryCallSettings.newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(
ImportDataOperationResponse.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(
ImportDataOperationMetadata.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(45000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
builder
.exportDataOperationSettings()
.setInitialCallSettings(
UnaryCallSettings.newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(
ExportDataOperationResponse.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(
ExportDataOperationMetadata.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(45000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
builder
.labelImageOperationSettings()
.setInitialCallSettings(
UnaryCallSettings.newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(AnnotatedDataset.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(LabelOperationMetadata.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(45000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
builder
.labelVideoOperationSettings()
.setInitialCallSettings(
UnaryCallSettings.newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(AnnotatedDataset.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(LabelOperationMetadata.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(45000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
builder
.labelTextOperationSettings()
.setInitialCallSettings(
UnaryCallSettings.newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(AnnotatedDataset.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(LabelOperationMetadata.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(45000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
builder
.createInstructionOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Instruction.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(
CreateInstructionMetadata.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(45000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
return builder;
}
/**
* 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(unaryMethodSettingsBuilders, settingsUpdater);
return this;
}
public ImmutableList> unaryMethodSettingsBuilders() {
return unaryMethodSettingsBuilders;
}
/** Returns the builder for the settings used for calls to createDataset. */
public UnaryCallSettings.Builder createDatasetSettings() {
return createDatasetSettings;
}
/** Returns the builder for the settings used for calls to getDataset. */
public UnaryCallSettings.Builder getDatasetSettings() {
return getDatasetSettings;
}
/** Returns the builder for the settings used for calls to listDatasets. */
public PagedCallSettings.Builder<
ListDatasetsRequest, ListDatasetsResponse, ListDatasetsPagedResponse>
listDatasetsSettings() {
return listDatasetsSettings;
}
/** Returns the builder for the settings used for calls to deleteDataset. */
public UnaryCallSettings.Builder deleteDatasetSettings() {
return deleteDatasetSettings;
}
/** Returns the builder for the settings used for calls to importData. */
public UnaryCallSettings.Builder importDataSettings() {
return importDataSettings;
}
/** Returns the builder for the settings used for calls to importData. */
public OperationCallSettings.Builder<
ImportDataRequest, ImportDataOperationResponse, ImportDataOperationMetadata>
importDataOperationSettings() {
return importDataOperationSettings;
}
/** Returns the builder for the settings used for calls to exportData. */
public UnaryCallSettings.Builder exportDataSettings() {
return exportDataSettings;
}
/** Returns the builder for the settings used for calls to exportData. */
public OperationCallSettings.Builder<
ExportDataRequest, ExportDataOperationResponse, ExportDataOperationMetadata>
exportDataOperationSettings() {
return exportDataOperationSettings;
}
/** Returns the builder for the settings used for calls to getDataItem. */
public UnaryCallSettings.Builder getDataItemSettings() {
return getDataItemSettings;
}
/** Returns the builder for the settings used for calls to listDataItems. */
public PagedCallSettings.Builder<
ListDataItemsRequest, ListDataItemsResponse, ListDataItemsPagedResponse>
listDataItemsSettings() {
return listDataItemsSettings;
}
/** Returns the builder for the settings used for calls to getAnnotatedDataset. */
public UnaryCallSettings.Builder
getAnnotatedDatasetSettings() {
return getAnnotatedDatasetSettings;
}
/** Returns the builder for the settings used for calls to listAnnotatedDatasets. */
public PagedCallSettings.Builder<
ListAnnotatedDatasetsRequest,
ListAnnotatedDatasetsResponse,
ListAnnotatedDatasetsPagedResponse>
listAnnotatedDatasetsSettings() {
return listAnnotatedDatasetsSettings;
}
/** Returns the builder for the settings used for calls to deleteAnnotatedDataset. */
public UnaryCallSettings.Builder
deleteAnnotatedDatasetSettings() {
return deleteAnnotatedDatasetSettings;
}
/** Returns the builder for the settings used for calls to labelImage. */
public UnaryCallSettings.Builder labelImageSettings() {
return labelImageSettings;
}
/** Returns the builder for the settings used for calls to labelImage. */
public OperationCallSettings.Builder<
LabelImageRequest, AnnotatedDataset, LabelOperationMetadata>
labelImageOperationSettings() {
return labelImageOperationSettings;
}
/** Returns the builder for the settings used for calls to labelVideo. */
public UnaryCallSettings.Builder labelVideoSettings() {
return labelVideoSettings;
}
/** Returns the builder for the settings used for calls to labelVideo. */
public OperationCallSettings.Builder<
LabelVideoRequest, AnnotatedDataset, LabelOperationMetadata>
labelVideoOperationSettings() {
return labelVideoOperationSettings;
}
/** Returns the builder for the settings used for calls to labelText. */
public UnaryCallSettings.Builder labelTextSettings() {
return labelTextSettings;
}
/** Returns the builder for the settings used for calls to labelText. */
public OperationCallSettings.Builder
labelTextOperationSettings() {
return labelTextOperationSettings;
}
/** Returns the builder for the settings used for calls to getExample. */
public UnaryCallSettings.Builder getExampleSettings() {
return getExampleSettings;
}
/** Returns the builder for the settings used for calls to listExamples. */
public PagedCallSettings.Builder<
ListExamplesRequest, ListExamplesResponse, ListExamplesPagedResponse>
listExamplesSettings() {
return listExamplesSettings;
}
/** Returns the builder for the settings used for calls to createAnnotationSpecSet. */
public UnaryCallSettings.Builder
createAnnotationSpecSetSettings() {
return createAnnotationSpecSetSettings;
}
/** Returns the builder for the settings used for calls to getAnnotationSpecSet. */
public UnaryCallSettings.Builder
getAnnotationSpecSetSettings() {
return getAnnotationSpecSetSettings;
}
/** Returns the builder for the settings used for calls to listAnnotationSpecSets. */
public PagedCallSettings.Builder<
ListAnnotationSpecSetsRequest,
ListAnnotationSpecSetsResponse,
ListAnnotationSpecSetsPagedResponse>
listAnnotationSpecSetsSettings() {
return listAnnotationSpecSetsSettings;
}
/** Returns the builder for the settings used for calls to deleteAnnotationSpecSet. */
public UnaryCallSettings.Builder
deleteAnnotationSpecSetSettings() {
return deleteAnnotationSpecSetSettings;
}
/** Returns the builder for the settings used for calls to createInstruction. */
public UnaryCallSettings.Builder
createInstructionSettings() {
return createInstructionSettings;
}
/** Returns the builder for the settings used for calls to createInstruction. */
public OperationCallSettings.Builder<
CreateInstructionRequest, Instruction, CreateInstructionMetadata>
createInstructionOperationSettings() {
return createInstructionOperationSettings;
}
/** Returns the builder for the settings used for calls to getInstruction. */
public UnaryCallSettings.Builder getInstructionSettings() {
return getInstructionSettings;
}
/** Returns the builder for the settings used for calls to listInstructions. */
public PagedCallSettings.Builder<
ListInstructionsRequest, ListInstructionsResponse, ListInstructionsPagedResponse>
listInstructionsSettings() {
return listInstructionsSettings;
}
/** Returns the builder for the settings used for calls to deleteInstruction. */
public UnaryCallSettings.Builder deleteInstructionSettings() {
return deleteInstructionSettings;
}
/** Returns the builder for the settings used for calls to getEvaluation. */
public UnaryCallSettings.Builder getEvaluationSettings() {
return getEvaluationSettings;
}
/** Returns the builder for the settings used for calls to searchEvaluations. */
public PagedCallSettings.Builder<
SearchEvaluationsRequest, SearchEvaluationsResponse, SearchEvaluationsPagedResponse>
searchEvaluationsSettings() {
return searchEvaluationsSettings;
}
/** Returns the builder for the settings used for calls to searchExampleComparisons. */
public PagedCallSettings.Builder<
SearchExampleComparisonsRequest,
SearchExampleComparisonsResponse,
SearchExampleComparisonsPagedResponse>
searchExampleComparisonsSettings() {
return searchExampleComparisonsSettings;
}
/** Returns the builder for the settings used for calls to createEvaluationJob. */
public UnaryCallSettings.Builder
createEvaluationJobSettings() {
return createEvaluationJobSettings;
}
/** Returns the builder for the settings used for calls to updateEvaluationJob. */
public UnaryCallSettings.Builder
updateEvaluationJobSettings() {
return updateEvaluationJobSettings;
}
/** Returns the builder for the settings used for calls to getEvaluationJob. */
public UnaryCallSettings.Builder
getEvaluationJobSettings() {
return getEvaluationJobSettings;
}
/** Returns the builder for the settings used for calls to pauseEvaluationJob. */
public UnaryCallSettings.Builder
pauseEvaluationJobSettings() {
return pauseEvaluationJobSettings;
}
/** Returns the builder for the settings used for calls to resumeEvaluationJob. */
public UnaryCallSettings.Builder
resumeEvaluationJobSettings() {
return resumeEvaluationJobSettings;
}
/** Returns the builder for the settings used for calls to deleteEvaluationJob. */
public UnaryCallSettings.Builder
deleteEvaluationJobSettings() {
return deleteEvaluationJobSettings;
}
/** Returns the builder for the settings used for calls to listEvaluationJobs. */
public PagedCallSettings.Builder<
ListEvaluationJobsRequest, ListEvaluationJobsResponse, ListEvaluationJobsPagedResponse>
listEvaluationJobsSettings() {
return listEvaluationJobsSettings;
}
@Override
public DataLabelingServiceStubSettings build() throws IOException {
return new DataLabelingServiceStubSettings(this);
}
}
}