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

com.google.cloud.visionai.v1.stub.HttpJsonAppPlatformStub Maven / Gradle / Ivy

/*
 * 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.visionai.v1.stub;

import static com.google.cloud.visionai.v1.AppPlatformClient.ListApplicationsPagedResponse;
import static com.google.cloud.visionai.v1.AppPlatformClient.ListDraftsPagedResponse;
import static com.google.cloud.visionai.v1.AppPlatformClient.ListInstancesPagedResponse;
import static com.google.cloud.visionai.v1.AppPlatformClient.ListProcessorsPagedResponse;

import com.google.api.HttpRule;
import com.google.api.core.InternalApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.httpjson.ApiMethodDescriptor;
import com.google.api.gax.httpjson.HttpJsonCallSettings;
import com.google.api.gax.httpjson.HttpJsonOperationSnapshot;
import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
import com.google.api.gax.httpjson.ProtoMessageResponseParser;
import com.google.api.gax.httpjson.ProtoRestSerializer;
import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.visionai.v1.AddApplicationStreamInputRequest;
import com.google.cloud.visionai.v1.AddApplicationStreamInputResponse;
import com.google.cloud.visionai.v1.Application;
import com.google.cloud.visionai.v1.CreateApplicationInstancesRequest;
import com.google.cloud.visionai.v1.CreateApplicationInstancesResponse;
import com.google.cloud.visionai.v1.CreateApplicationRequest;
import com.google.cloud.visionai.v1.CreateDraftRequest;
import com.google.cloud.visionai.v1.CreateProcessorRequest;
import com.google.cloud.visionai.v1.DeleteApplicationInstancesRequest;
import com.google.cloud.visionai.v1.DeleteApplicationRequest;
import com.google.cloud.visionai.v1.DeleteDraftRequest;
import com.google.cloud.visionai.v1.DeleteProcessorRequest;
import com.google.cloud.visionai.v1.DeployApplicationRequest;
import com.google.cloud.visionai.v1.DeployApplicationResponse;
import com.google.cloud.visionai.v1.Draft;
import com.google.cloud.visionai.v1.GetApplicationRequest;
import com.google.cloud.visionai.v1.GetDraftRequest;
import com.google.cloud.visionai.v1.GetInstanceRequest;
import com.google.cloud.visionai.v1.GetProcessorRequest;
import com.google.cloud.visionai.v1.Instance;
import com.google.cloud.visionai.v1.ListApplicationsRequest;
import com.google.cloud.visionai.v1.ListApplicationsResponse;
import com.google.cloud.visionai.v1.ListDraftsRequest;
import com.google.cloud.visionai.v1.ListDraftsResponse;
import com.google.cloud.visionai.v1.ListInstancesRequest;
import com.google.cloud.visionai.v1.ListInstancesResponse;
import com.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest;
import com.google.cloud.visionai.v1.ListPrebuiltProcessorsResponse;
import com.google.cloud.visionai.v1.ListProcessorsRequest;
import com.google.cloud.visionai.v1.ListProcessorsResponse;
import com.google.cloud.visionai.v1.OperationMetadata;
import com.google.cloud.visionai.v1.Processor;
import com.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest;
import com.google.cloud.visionai.v1.RemoveApplicationStreamInputResponse;
import com.google.cloud.visionai.v1.UndeployApplicationRequest;
import com.google.cloud.visionai.v1.UndeployApplicationResponse;
import com.google.cloud.visionai.v1.UpdateApplicationInstancesRequest;
import com.google.cloud.visionai.v1.UpdateApplicationInstancesResponse;
import com.google.cloud.visionai.v1.UpdateApplicationRequest;
import com.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest;
import com.google.cloud.visionai.v1.UpdateApplicationStreamInputResponse;
import com.google.cloud.visionai.v1.UpdateDraftRequest;
import com.google.cloud.visionai.v1.UpdateProcessorRequest;
import com.google.common.collect.ImmutableMap;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.protobuf.TypeRegistry;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * REST stub implementation for the AppPlatform service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") public class HttpJsonAppPlatformStub extends AppPlatformStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder() .add(Draft.getDescriptor()) .add(Instance.getDescriptor()) .add(UndeployApplicationResponse.getDescriptor()) .add(AddApplicationStreamInputResponse.getDescriptor()) .add(UpdateApplicationStreamInputResponse.getDescriptor()) .add(OperationMetadata.getDescriptor()) .add(RemoveApplicationStreamInputResponse.getDescriptor()) .add(Empty.getDescriptor()) .add(DeployApplicationResponse.getDescriptor()) .add(CreateApplicationInstancesResponse.getDescriptor()) .add(Processor.getDescriptor()) .add(Application.getDescriptor()) .add(UpdateApplicationInstancesResponse.getDescriptor()) .build(); private static final ApiMethodDescriptor listApplicationsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/ListApplications") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/applications", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListApplicationsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getApplicationMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/GetApplication") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Application.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createApplicationMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/CreateApplication") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/applications", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "applicationId", request.getApplicationId()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("application", request.getApplication(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateApplicationRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateApplicationMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/UpdateApplication") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{application.name=projects/*/locations/*/applications/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "application.name", request.getApplication().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("application", request.getApplication(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateApplicationRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor deleteApplicationMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/DeleteApplication") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "force", request.getForce()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteApplicationRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor deployApplicationMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/DeployApplication") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}:deploy", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeployApplicationRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor undeployApplicationMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/UndeployApplication") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}:undeploy", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UndeployApplicationRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor addApplicationStreamInputMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/AddApplicationStreamInput") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}:addStreamInput", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (AddApplicationStreamInputRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor removeApplicationStreamInputMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.visionai.v1.AppPlatform/RemoveApplicationStreamInput") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}:removeStreamInput", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (RemoveApplicationStreamInputRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateApplicationStreamInputMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.visionai.v1.AppPlatform/UpdateApplicationStreamInput") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}:updateStreamInput", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateApplicationStreamInputRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor listInstancesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/ListInstances") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/applications/*}/instances", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListInstancesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getInstanceMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/GetInstance") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*/instances/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Instance.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createApplicationInstancesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/CreateApplicationInstances") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}:createApplicationInstances", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateApplicationInstancesRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor deleteApplicationInstancesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/DeleteApplicationInstances") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}:deleteApplicationInstances", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteApplicationInstancesRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateApplicationInstancesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/UpdateApplicationInstances") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*}:updateApplicationInstances", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateApplicationInstancesRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor listDraftsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/ListDrafts") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/applications/*}/drafts", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListDraftsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getDraftMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/GetDraft") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*/drafts/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Draft.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createDraftMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/CreateDraft") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/applications/*}/drafts", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "draftId", request.getDraftId()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("draft", request.getDraft(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateDraftRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateDraftMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/UpdateDraft") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{draft.name=projects/*/locations/*/applications/*/drafts/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "draft.name", request.getDraft().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "allowMissing", request.getAllowMissing()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("draft", request.getDraft(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateDraftRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor deleteDraftMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/DeleteDraft") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/applications/*/drafts/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteDraftRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor listProcessorsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/ListProcessors") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/processors", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "filter", request.getFilter()); serializer.putQueryParam(fields, "orderBy", request.getOrderBy()); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListProcessorsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor< ListPrebuiltProcessorsRequest, ListPrebuiltProcessorsResponse> listPrebuiltProcessorsMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/ListPrebuiltProcessors") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/processors:prebuilt", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearParent().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListPrebuiltProcessorsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getProcessorMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/GetProcessor") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/processors/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Processor.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createProcessorMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/CreateProcessor") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/processors", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "parent", request.getParent()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam( fields, "processorId", request.getProcessorId()); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("processor", request.getProcessor(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateProcessorRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateProcessorMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/UpdateProcessor") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{processor.name=projects/*/locations/*/processors/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "processor.name", request.getProcessor().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("processor", request.getProcessor(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateProcessorRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor deleteProcessorMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.visionai.v1.AppPlatform/DeleteProcessor") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/processors/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "name", request.getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "requestId", request.getRequestId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteProcessorRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private final UnaryCallable listApplicationsCallable; private final UnaryCallable listApplicationsPagedCallable; private final UnaryCallable getApplicationCallable; private final UnaryCallable createApplicationCallable; private final OperationCallable createApplicationOperationCallable; private final UnaryCallable updateApplicationCallable; private final OperationCallable updateApplicationOperationCallable; private final UnaryCallable deleteApplicationCallable; private final OperationCallable deleteApplicationOperationCallable; private final UnaryCallable deployApplicationCallable; private final OperationCallable< DeployApplicationRequest, DeployApplicationResponse, OperationMetadata> deployApplicationOperationCallable; private final UnaryCallable undeployApplicationCallable; private final OperationCallable< UndeployApplicationRequest, UndeployApplicationResponse, OperationMetadata> undeployApplicationOperationCallable; private final UnaryCallable addApplicationStreamInputCallable; private final OperationCallable< AddApplicationStreamInputRequest, AddApplicationStreamInputResponse, OperationMetadata> addApplicationStreamInputOperationCallable; private final UnaryCallable removeApplicationStreamInputCallable; private final OperationCallable< RemoveApplicationStreamInputRequest, RemoveApplicationStreamInputResponse, OperationMetadata> removeApplicationStreamInputOperationCallable; private final UnaryCallable updateApplicationStreamInputCallable; private final OperationCallable< UpdateApplicationStreamInputRequest, UpdateApplicationStreamInputResponse, OperationMetadata> updateApplicationStreamInputOperationCallable; private final UnaryCallable listInstancesCallable; private final UnaryCallable listInstancesPagedCallable; private final UnaryCallable getInstanceCallable; private final UnaryCallable createApplicationInstancesCallable; private final OperationCallable< CreateApplicationInstancesRequest, CreateApplicationInstancesResponse, OperationMetadata> createApplicationInstancesOperationCallable; private final UnaryCallable deleteApplicationInstancesCallable; private final OperationCallable deleteApplicationInstancesOperationCallable; private final UnaryCallable updateApplicationInstancesCallable; private final OperationCallable< UpdateApplicationInstancesRequest, UpdateApplicationInstancesResponse, OperationMetadata> updateApplicationInstancesOperationCallable; private final UnaryCallable listDraftsCallable; private final UnaryCallable listDraftsPagedCallable; private final UnaryCallable getDraftCallable; private final UnaryCallable createDraftCallable; private final OperationCallable createDraftOperationCallable; private final UnaryCallable updateDraftCallable; private final OperationCallable updateDraftOperationCallable; private final UnaryCallable deleteDraftCallable; private final OperationCallable deleteDraftOperationCallable; private final UnaryCallable listProcessorsCallable; private final UnaryCallable listProcessorsPagedCallable; private final UnaryCallable listPrebuiltProcessorsCallable; private final UnaryCallable getProcessorCallable; private final UnaryCallable createProcessorCallable; private final OperationCallable createProcessorOperationCallable; private final UnaryCallable updateProcessorCallable; private final OperationCallable updateProcessorOperationCallable; private final UnaryCallable deleteProcessorCallable; private final OperationCallable deleteProcessorOperationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; private final HttpJsonStubCallableFactory callableFactory; public static final HttpJsonAppPlatformStub create(AppPlatformStubSettings settings) throws IOException { return new HttpJsonAppPlatformStub(settings, ClientContext.create(settings)); } public static final HttpJsonAppPlatformStub create(ClientContext clientContext) throws IOException { return new HttpJsonAppPlatformStub( AppPlatformStubSettings.newHttpJsonBuilder().build(), clientContext); } public static final HttpJsonAppPlatformStub create( ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { return new HttpJsonAppPlatformStub( AppPlatformStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of HttpJsonAppPlatformStub, using the given settings. This is protected * so that it is easy to make a subclass, but otherwise, the static factory methods should be * preferred. */ protected HttpJsonAppPlatformStub(AppPlatformStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new HttpJsonAppPlatformCallableFactory()); } /** * Constructs an instance of HttpJsonAppPlatformStub, using the given settings. This is protected * so that it is easy to make a subclass, but otherwise, the static factory methods should be * preferred. */ protected HttpJsonAppPlatformStub( AppPlatformStubSettings settings, ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.httpJsonOperationsStub = HttpJsonOperationsStub.create( clientContext, callableFactory, typeRegistry, ImmutableMap.builder() .put( "google.longrunning.Operations.CancelOperation", HttpRule.newBuilder() .setPost("/v1/{name=projects/*/locations/*/operations/*}:cancel") .build()) .put( "google.longrunning.Operations.DeleteOperation", HttpRule.newBuilder() .setDelete("/v1/{name=projects/*/locations/*/operations/*}") .build()) .put( "google.longrunning.Operations.GetOperation", HttpRule.newBuilder() .setGet("/v1/{name=projects/*/locations/*/operations/*}") .addAdditionalBindings( HttpRule.newBuilder() .setGet("/v1/{name=projects/*/locations/*/warehouseOperations/*}") .build()) .addAdditionalBindings( HttpRule.newBuilder() .setGet( "/v1/{name=projects/*/locations/*/corpora/*/assets/*/operations/*}") .build()) .addAdditionalBindings( HttpRule.newBuilder() .setGet( "/v1/{name=projects/*/locations/*/corpora/*/collections/*/operations/*}") .build()) .addAdditionalBindings( HttpRule.newBuilder() .setGet( "/v1/{name=projects/*/locations/*/corpora/*/imageIndexes/*/operations/*}") .build()) .addAdditionalBindings( HttpRule.newBuilder() .setGet( "/v1/{name=projects/*/locations/*/corpora/*/indexes/*/operations/*}") .build()) .addAdditionalBindings( HttpRule.newBuilder() .setGet("/v1/{name=projects/*/locations/*/corpora/*/operations/*}") .build()) .addAdditionalBindings( HttpRule.newBuilder() .setGet( "/v1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}") .build()) .build()) .put( "google.longrunning.Operations.ListOperations", HttpRule.newBuilder() .setGet("/v1/{name=projects/*/locations/*}/operations") .build()) .build()); HttpJsonCallSettings listApplicationsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listApplicationsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getApplicationTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getApplicationMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createApplicationTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createApplicationMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateApplicationTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateApplicationMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "application.name", String.valueOf(request.getApplication().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteApplicationTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteApplicationMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings deployApplicationTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deployApplicationMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings undeployApplicationTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(undeployApplicationMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings addApplicationStreamInputTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(addApplicationStreamInputMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings removeApplicationStreamInputTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(removeApplicationStreamInputMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings updateApplicationStreamInputTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateApplicationStreamInputMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listInstancesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listInstancesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getInstanceTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getInstanceMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createApplicationInstancesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createApplicationInstancesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteApplicationInstancesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteApplicationInstancesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings updateApplicationInstancesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateApplicationInstancesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listDraftsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listDraftsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getDraftTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getDraftMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createDraftTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createDraftMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateDraftTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateDraftMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("draft.name", String.valueOf(request.getDraft().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteDraftTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteDraftMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listProcessorsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listProcessorsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listPrebuiltProcessorsTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(listPrebuiltProcessorsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getProcessorTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getProcessorMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createProcessorTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createProcessorMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateProcessorTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateProcessorMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("processor.name", String.valueOf(request.getProcessor().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteProcessorTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteProcessorMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); this.listApplicationsCallable = callableFactory.createUnaryCallable( listApplicationsTransportSettings, settings.listApplicationsSettings(), clientContext); this.listApplicationsPagedCallable = callableFactory.createPagedCallable( listApplicationsTransportSettings, settings.listApplicationsSettings(), clientContext); this.getApplicationCallable = callableFactory.createUnaryCallable( getApplicationTransportSettings, settings.getApplicationSettings(), clientContext); this.createApplicationCallable = callableFactory.createUnaryCallable( createApplicationTransportSettings, settings.createApplicationSettings(), clientContext); this.createApplicationOperationCallable = callableFactory.createOperationCallable( createApplicationTransportSettings, settings.createApplicationOperationSettings(), clientContext, httpJsonOperationsStub); this.updateApplicationCallable = callableFactory.createUnaryCallable( updateApplicationTransportSettings, settings.updateApplicationSettings(), clientContext); this.updateApplicationOperationCallable = callableFactory.createOperationCallable( updateApplicationTransportSettings, settings.updateApplicationOperationSettings(), clientContext, httpJsonOperationsStub); this.deleteApplicationCallable = callableFactory.createUnaryCallable( deleteApplicationTransportSettings, settings.deleteApplicationSettings(), clientContext); this.deleteApplicationOperationCallable = callableFactory.createOperationCallable( deleteApplicationTransportSettings, settings.deleteApplicationOperationSettings(), clientContext, httpJsonOperationsStub); this.deployApplicationCallable = callableFactory.createUnaryCallable( deployApplicationTransportSettings, settings.deployApplicationSettings(), clientContext); this.deployApplicationOperationCallable = callableFactory.createOperationCallable( deployApplicationTransportSettings, settings.deployApplicationOperationSettings(), clientContext, httpJsonOperationsStub); this.undeployApplicationCallable = callableFactory.createUnaryCallable( undeployApplicationTransportSettings, settings.undeployApplicationSettings(), clientContext); this.undeployApplicationOperationCallable = callableFactory.createOperationCallable( undeployApplicationTransportSettings, settings.undeployApplicationOperationSettings(), clientContext, httpJsonOperationsStub); this.addApplicationStreamInputCallable = callableFactory.createUnaryCallable( addApplicationStreamInputTransportSettings, settings.addApplicationStreamInputSettings(), clientContext); this.addApplicationStreamInputOperationCallable = callableFactory.createOperationCallable( addApplicationStreamInputTransportSettings, settings.addApplicationStreamInputOperationSettings(), clientContext, httpJsonOperationsStub); this.removeApplicationStreamInputCallable = callableFactory.createUnaryCallable( removeApplicationStreamInputTransportSettings, settings.removeApplicationStreamInputSettings(), clientContext); this.removeApplicationStreamInputOperationCallable = callableFactory.createOperationCallable( removeApplicationStreamInputTransportSettings, settings.removeApplicationStreamInputOperationSettings(), clientContext, httpJsonOperationsStub); this.updateApplicationStreamInputCallable = callableFactory.createUnaryCallable( updateApplicationStreamInputTransportSettings, settings.updateApplicationStreamInputSettings(), clientContext); this.updateApplicationStreamInputOperationCallable = callableFactory.createOperationCallable( updateApplicationStreamInputTransportSettings, settings.updateApplicationStreamInputOperationSettings(), clientContext, httpJsonOperationsStub); this.listInstancesCallable = callableFactory.createUnaryCallable( listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); this.listInstancesPagedCallable = callableFactory.createPagedCallable( listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); this.getInstanceCallable = callableFactory.createUnaryCallable( getInstanceTransportSettings, settings.getInstanceSettings(), clientContext); this.createApplicationInstancesCallable = callableFactory.createUnaryCallable( createApplicationInstancesTransportSettings, settings.createApplicationInstancesSettings(), clientContext); this.createApplicationInstancesOperationCallable = callableFactory.createOperationCallable( createApplicationInstancesTransportSettings, settings.createApplicationInstancesOperationSettings(), clientContext, httpJsonOperationsStub); this.deleteApplicationInstancesCallable = callableFactory.createUnaryCallable( deleteApplicationInstancesTransportSettings, settings.deleteApplicationInstancesSettings(), clientContext); this.deleteApplicationInstancesOperationCallable = callableFactory.createOperationCallable( deleteApplicationInstancesTransportSettings, settings.deleteApplicationInstancesOperationSettings(), clientContext, httpJsonOperationsStub); this.updateApplicationInstancesCallable = callableFactory.createUnaryCallable( updateApplicationInstancesTransportSettings, settings.updateApplicationInstancesSettings(), clientContext); this.updateApplicationInstancesOperationCallable = callableFactory.createOperationCallable( updateApplicationInstancesTransportSettings, settings.updateApplicationInstancesOperationSettings(), clientContext, httpJsonOperationsStub); this.listDraftsCallable = callableFactory.createUnaryCallable( listDraftsTransportSettings, settings.listDraftsSettings(), clientContext); this.listDraftsPagedCallable = callableFactory.createPagedCallable( listDraftsTransportSettings, settings.listDraftsSettings(), clientContext); this.getDraftCallable = callableFactory.createUnaryCallable( getDraftTransportSettings, settings.getDraftSettings(), clientContext); this.createDraftCallable = callableFactory.createUnaryCallable( createDraftTransportSettings, settings.createDraftSettings(), clientContext); this.createDraftOperationCallable = callableFactory.createOperationCallable( createDraftTransportSettings, settings.createDraftOperationSettings(), clientContext, httpJsonOperationsStub); this.updateDraftCallable = callableFactory.createUnaryCallable( updateDraftTransportSettings, settings.updateDraftSettings(), clientContext); this.updateDraftOperationCallable = callableFactory.createOperationCallable( updateDraftTransportSettings, settings.updateDraftOperationSettings(), clientContext, httpJsonOperationsStub); this.deleteDraftCallable = callableFactory.createUnaryCallable( deleteDraftTransportSettings, settings.deleteDraftSettings(), clientContext); this.deleteDraftOperationCallable = callableFactory.createOperationCallable( deleteDraftTransportSettings, settings.deleteDraftOperationSettings(), clientContext, httpJsonOperationsStub); this.listProcessorsCallable = callableFactory.createUnaryCallable( listProcessorsTransportSettings, settings.listProcessorsSettings(), clientContext); this.listProcessorsPagedCallable = callableFactory.createPagedCallable( listProcessorsTransportSettings, settings.listProcessorsSettings(), clientContext); this.listPrebuiltProcessorsCallable = callableFactory.createUnaryCallable( listPrebuiltProcessorsTransportSettings, settings.listPrebuiltProcessorsSettings(), clientContext); this.getProcessorCallable = callableFactory.createUnaryCallable( getProcessorTransportSettings, settings.getProcessorSettings(), clientContext); this.createProcessorCallable = callableFactory.createUnaryCallable( createProcessorTransportSettings, settings.createProcessorSettings(), clientContext); this.createProcessorOperationCallable = callableFactory.createOperationCallable( createProcessorTransportSettings, settings.createProcessorOperationSettings(), clientContext, httpJsonOperationsStub); this.updateProcessorCallable = callableFactory.createUnaryCallable( updateProcessorTransportSettings, settings.updateProcessorSettings(), clientContext); this.updateProcessorOperationCallable = callableFactory.createOperationCallable( updateProcessorTransportSettings, settings.updateProcessorOperationSettings(), clientContext, httpJsonOperationsStub); this.deleteProcessorCallable = callableFactory.createUnaryCallable( deleteProcessorTransportSettings, settings.deleteProcessorSettings(), clientContext); this.deleteProcessorOperationCallable = callableFactory.createOperationCallable( deleteProcessorTransportSettings, settings.deleteProcessorOperationSettings(), clientContext, httpJsonOperationsStub); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @InternalApi public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(listApplicationsMethodDescriptor); methodDescriptors.add(getApplicationMethodDescriptor); methodDescriptors.add(createApplicationMethodDescriptor); methodDescriptors.add(updateApplicationMethodDescriptor); methodDescriptors.add(deleteApplicationMethodDescriptor); methodDescriptors.add(deployApplicationMethodDescriptor); methodDescriptors.add(undeployApplicationMethodDescriptor); methodDescriptors.add(addApplicationStreamInputMethodDescriptor); methodDescriptors.add(removeApplicationStreamInputMethodDescriptor); methodDescriptors.add(updateApplicationStreamInputMethodDescriptor); methodDescriptors.add(listInstancesMethodDescriptor); methodDescriptors.add(getInstanceMethodDescriptor); methodDescriptors.add(createApplicationInstancesMethodDescriptor); methodDescriptors.add(deleteApplicationInstancesMethodDescriptor); methodDescriptors.add(updateApplicationInstancesMethodDescriptor); methodDescriptors.add(listDraftsMethodDescriptor); methodDescriptors.add(getDraftMethodDescriptor); methodDescriptors.add(createDraftMethodDescriptor); methodDescriptors.add(updateDraftMethodDescriptor); methodDescriptors.add(deleteDraftMethodDescriptor); methodDescriptors.add(listProcessorsMethodDescriptor); methodDescriptors.add(listPrebuiltProcessorsMethodDescriptor); methodDescriptors.add(getProcessorMethodDescriptor); methodDescriptors.add(createProcessorMethodDescriptor); methodDescriptors.add(updateProcessorMethodDescriptor); methodDescriptors.add(deleteProcessorMethodDescriptor); return methodDescriptors; } public HttpJsonOperationsStub getHttpJsonOperationsStub() { return httpJsonOperationsStub; } @Override public UnaryCallable listApplicationsCallable() { return listApplicationsCallable; } @Override public UnaryCallable listApplicationsPagedCallable() { return listApplicationsPagedCallable; } @Override public UnaryCallable getApplicationCallable() { return getApplicationCallable; } @Override public UnaryCallable createApplicationCallable() { return createApplicationCallable; } @Override public OperationCallable createApplicationOperationCallable() { return createApplicationOperationCallable; } @Override public UnaryCallable updateApplicationCallable() { return updateApplicationCallable; } @Override public OperationCallable updateApplicationOperationCallable() { return updateApplicationOperationCallable; } @Override public UnaryCallable deleteApplicationCallable() { return deleteApplicationCallable; } @Override public OperationCallable deleteApplicationOperationCallable() { return deleteApplicationOperationCallable; } @Override public UnaryCallable deployApplicationCallable() { return deployApplicationCallable; } @Override public OperationCallable deployApplicationOperationCallable() { return deployApplicationOperationCallable; } @Override public UnaryCallable undeployApplicationCallable() { return undeployApplicationCallable; } @Override public OperationCallable< UndeployApplicationRequest, UndeployApplicationResponse, OperationMetadata> undeployApplicationOperationCallable() { return undeployApplicationOperationCallable; } @Override public UnaryCallable addApplicationStreamInputCallable() { return addApplicationStreamInputCallable; } @Override public OperationCallable< AddApplicationStreamInputRequest, AddApplicationStreamInputResponse, OperationMetadata> addApplicationStreamInputOperationCallable() { return addApplicationStreamInputOperationCallable; } @Override public UnaryCallable removeApplicationStreamInputCallable() { return removeApplicationStreamInputCallable; } @Override public OperationCallable< RemoveApplicationStreamInputRequest, RemoveApplicationStreamInputResponse, OperationMetadata> removeApplicationStreamInputOperationCallable() { return removeApplicationStreamInputOperationCallable; } @Override public UnaryCallable updateApplicationStreamInputCallable() { return updateApplicationStreamInputCallable; } @Override public OperationCallable< UpdateApplicationStreamInputRequest, UpdateApplicationStreamInputResponse, OperationMetadata> updateApplicationStreamInputOperationCallable() { return updateApplicationStreamInputOperationCallable; } @Override public UnaryCallable listInstancesCallable() { return listInstancesCallable; } @Override public UnaryCallable listInstancesPagedCallable() { return listInstancesPagedCallable; } @Override public UnaryCallable getInstanceCallable() { return getInstanceCallable; } @Override public UnaryCallable createApplicationInstancesCallable() { return createApplicationInstancesCallable; } @Override public OperationCallable< CreateApplicationInstancesRequest, CreateApplicationInstancesResponse, OperationMetadata> createApplicationInstancesOperationCallable() { return createApplicationInstancesOperationCallable; } @Override public UnaryCallable deleteApplicationInstancesCallable() { return deleteApplicationInstancesCallable; } @Override public OperationCallable deleteApplicationInstancesOperationCallable() { return deleteApplicationInstancesOperationCallable; } @Override public UnaryCallable updateApplicationInstancesCallable() { return updateApplicationInstancesCallable; } @Override public OperationCallable< UpdateApplicationInstancesRequest, UpdateApplicationInstancesResponse, OperationMetadata> updateApplicationInstancesOperationCallable() { return updateApplicationInstancesOperationCallable; } @Override public UnaryCallable listDraftsCallable() { return listDraftsCallable; } @Override public UnaryCallable listDraftsPagedCallable() { return listDraftsPagedCallable; } @Override public UnaryCallable getDraftCallable() { return getDraftCallable; } @Override public UnaryCallable createDraftCallable() { return createDraftCallable; } @Override public OperationCallable createDraftOperationCallable() { return createDraftOperationCallable; } @Override public UnaryCallable updateDraftCallable() { return updateDraftCallable; } @Override public OperationCallable updateDraftOperationCallable() { return updateDraftOperationCallable; } @Override public UnaryCallable deleteDraftCallable() { return deleteDraftCallable; } @Override public OperationCallable deleteDraftOperationCallable() { return deleteDraftOperationCallable; } @Override public UnaryCallable listProcessorsCallable() { return listProcessorsCallable; } @Override public UnaryCallable listProcessorsPagedCallable() { return listProcessorsPagedCallable; } @Override public UnaryCallable listPrebuiltProcessorsCallable() { return listPrebuiltProcessorsCallable; } @Override public UnaryCallable getProcessorCallable() { return getProcessorCallable; } @Override public UnaryCallable createProcessorCallable() { return createProcessorCallable; } @Override public OperationCallable createProcessorOperationCallable() { return createProcessorOperationCallable; } @Override public UnaryCallable updateProcessorCallable() { return updateProcessorCallable; } @Override public OperationCallable updateProcessorOperationCallable() { return updateProcessorOperationCallable; } @Override public UnaryCallable deleteProcessorCallable() { return deleteProcessorCallable; } @Override public OperationCallable deleteProcessorOperationCallable() { return deleteProcessorOperationCallable; } @Override public final void close() { try { backgroundResources.close(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Failed to close resource", e); } } @Override public void shutdown() { backgroundResources.shutdown(); } @Override public boolean isShutdown() { return backgroundResources.isShutdown(); } @Override public boolean isTerminated() { return backgroundResources.isTerminated(); } @Override public void shutdownNow() { backgroundResources.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return backgroundResources.awaitTermination(duration, unit); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy