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

com.google.cloud.bigquery.dataexchange.v1beta1.stub.HttpJsonAnalyticsHubServiceStub Maven / Gradle / Ivy

Go to download

Analytics Hub is a data exchange that allows you to efficiently and securely exchange data assets across organizations to address challenges of data reliability and cost.

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

package com.google.cloud.bigquery.dataexchange.v1beta1.stub;

import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListDataExchangesPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListListingsPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClient.ListOrgDataExchangesPagedResponse;

import com.google.api.core.BetaApi;
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.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.rpc.ClientContext;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.bigquery.dataexchange.v1beta1.CreateDataExchangeRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.CreateListingRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.DataExchange;
import com.google.cloud.bigquery.dataexchange.v1beta1.DeleteDataExchangeRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.DeleteListingRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.GetDataExchangeRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.GetListingRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.ListDataExchangesRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.ListDataExchangesResponse;
import com.google.cloud.bigquery.dataexchange.v1beta1.ListListingsRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.ListListingsResponse;
import com.google.cloud.bigquery.dataexchange.v1beta1.ListOrgDataExchangesRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.ListOrgDataExchangesResponse;
import com.google.cloud.bigquery.dataexchange.v1beta1.Listing;
import com.google.cloud.bigquery.dataexchange.v1beta1.SubscribeListingRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.SubscribeListingResponse;
import com.google.cloud.bigquery.dataexchange.v1beta1.UpdateDataExchangeRequest;
import com.google.cloud.bigquery.dataexchange.v1beta1.UpdateListingRequest;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
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 AnalyticsHubService service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @BetaApi @Generated("by gapic-generator-java") public class HttpJsonAnalyticsHubServiceStub extends AnalyticsHubServiceStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); private static final ApiMethodDescriptor listDataExchangesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListDataExchanges") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{parent=projects/*/locations/*}/dataExchanges", 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, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListDataExchangesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor< ListOrgDataExchangesRequest, ListOrgDataExchangesResponse> listOrgDataExchangesMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListOrgDataExchanges") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{organization=organizations/*/locations/*}/dataExchanges", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "organization", request.getOrganization()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListOrgDataExchangesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getDataExchangeMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetDataExchange") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{name=projects/*/locations/*/dataExchanges/*}", 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(); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(DataExchange.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createDataExchangeMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateDataExchange") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{parent=projects/*/locations/*}/dataExchanges", 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, "dataExchangeId", request.getDataExchangeId()); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("dataExchange", request.getDataExchange(), false)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(DataExchange.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor updateDataExchangeMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateDataExchange") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{dataExchange.name=projects/*/locations/*/dataExchanges/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "dataExchange.name", request.getDataExchange().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("dataExchange", request.getDataExchange(), false)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(DataExchange.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deleteDataExchangeMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteDataExchange") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{name=projects/*/locations/*/dataExchanges/*}", 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(); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Empty.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listListingsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/ListListings") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{parent=projects/*/locations/*/dataExchanges/*}/listings", 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, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListListingsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getListingMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetListing") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{name=projects/*/locations/*/dataExchanges/*/listings/*}", 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(); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.

newBuilder() .setDefaultInstance(Listing.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor createListingMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/CreateListing") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{parent=projects/*/locations/*/dataExchanges/*}/listings", 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, "listingId", request.getListingId()); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("listing", request.getListing(), false)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Listing.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor updateListingMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/UpdateListing") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{listing.name=projects/*/locations/*/dataExchanges/*/listings/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "listing.name", request.getListing().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("listing", request.getListing(), false)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Listing.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deleteListingMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/DeleteListing") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{name=projects/*/locations/*/dataExchanges/*/listings/*}", 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(); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Empty.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor subscribeListingMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/SubscribeListing") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{name=projects/*/locations/*/dataExchanges/*/listings/*}:subscribe", 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(); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearName().build(), false)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(SubscribeListingResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getIamPolicyMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/GetIamPolicy") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{resource=projects/*/locations/*/dataExchanges/*}:getIamPolicy", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "resource", request.getResource()); return fields; }) .setAdditionalPaths( "/v1beta1/{resource=projects/*/locations/*/dataExchanges/*/listings/*}:getIamPolicy") .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearResource().build(), false)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Policy.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor setIamPolicyMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/SetIamPolicy") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{resource=projects/*/locations/*/dataExchanges/*}:setIamPolicy", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "resource", request.getResource()); return fields; }) .setAdditionalPaths( "/v1beta1/{resource=projects/*/locations/*/dataExchanges/*/listings/*}:setIamPolicy") .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearResource().build(), false)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Policy.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor testIamPermissionsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubService/TestIamPermissions") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{resource=projects/*/locations/*/dataExchanges/*}:testIamPermissions", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam(fields, "resource", request.getResource()); return fields; }) .setAdditionalPaths( "/v1beta1/{resource=projects/*/locations/*/dataExchanges/*/listings/*}:testIamPermissions") .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody("*", request.toBuilder().clearResource().build(), false)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listLocationsMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.location.Locations/ListLocations") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{name=projects/*}/locations", 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(); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getLocationMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.location.Locations/GetLocation") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1beta1/{name=projects/*/locations/*}", 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(); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Location.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private final UnaryCallable listDataExchangesCallable; private final UnaryCallable listDataExchangesPagedCallable; private final UnaryCallable listOrgDataExchangesCallable; private final UnaryCallable listOrgDataExchangesPagedCallable; private final UnaryCallable getDataExchangeCallable; private final UnaryCallable createDataExchangeCallable; private final UnaryCallable updateDataExchangeCallable; private final UnaryCallable deleteDataExchangeCallable; private final UnaryCallable listListingsCallable; private final UnaryCallable listListingsPagedCallable; private final UnaryCallable getListingCallable; private final UnaryCallable createListingCallable; private final UnaryCallable updateListingCallable; private final UnaryCallable deleteListingCallable; private final UnaryCallable subscribeListingCallable; private final UnaryCallable getIamPolicyCallable; private final UnaryCallable setIamPolicyCallable; private final UnaryCallable testIamPermissionsCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable listLocationsPagedCallable; private final UnaryCallable getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonStubCallableFactory callableFactory; public static final HttpJsonAnalyticsHubServiceStub create( AnalyticsHubServiceStubSettings settings) throws IOException { return new HttpJsonAnalyticsHubServiceStub(settings, ClientContext.create(settings)); } public static final HttpJsonAnalyticsHubServiceStub create(ClientContext clientContext) throws IOException { return new HttpJsonAnalyticsHubServiceStub( AnalyticsHubServiceStubSettings.newHttpJsonBuilder().build(), clientContext); } public static final HttpJsonAnalyticsHubServiceStub create( ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { return new HttpJsonAnalyticsHubServiceStub( AnalyticsHubServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of HttpJsonAnalyticsHubServiceStub, 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 HttpJsonAnalyticsHubServiceStub( AnalyticsHubServiceStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new HttpJsonAnalyticsHubServiceCallableFactory()); } /** * Constructs an instance of HttpJsonAnalyticsHubServiceStub, 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 HttpJsonAnalyticsHubServiceStub( AnalyticsHubServiceStubSettings settings, ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; HttpJsonCallSettings listDataExchangesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listDataExchangesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings listOrgDataExchangesTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(listOrgDataExchangesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("organization", String.valueOf(request.getOrganization())); return builder.build(); }) .build(); HttpJsonCallSettings getDataExchangeTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getDataExchangeMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createDataExchangeTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createDataExchangeMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateDataExchangeTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateDataExchangeMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "data_exchange.name", String.valueOf(request.getDataExchange().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteDataExchangeTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteDataExchangeMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listListingsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listListingsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getListingTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getListingMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings createListingTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createListingMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateListingTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateListingMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("listing.name", String.valueOf(request.getListing().getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteListingTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteListingMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings subscribeListingTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(subscribeListingMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getIamPolicyTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getIamPolicyMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); HttpJsonCallSettings setIamPolicyTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(setIamPolicyMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); HttpJsonCallSettings testIamPermissionsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(testIamPermissionsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); HttpJsonCallSettings listLocationsTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listLocationsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getLocationTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getLocationMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); this.listDataExchangesCallable = callableFactory.createUnaryCallable( listDataExchangesTransportSettings, settings.listDataExchangesSettings(), clientContext); this.listDataExchangesPagedCallable = callableFactory.createPagedCallable( listDataExchangesTransportSettings, settings.listDataExchangesSettings(), clientContext); this.listOrgDataExchangesCallable = callableFactory.createUnaryCallable( listOrgDataExchangesTransportSettings, settings.listOrgDataExchangesSettings(), clientContext); this.listOrgDataExchangesPagedCallable = callableFactory.createPagedCallable( listOrgDataExchangesTransportSettings, settings.listOrgDataExchangesSettings(), clientContext); this.getDataExchangeCallable = callableFactory.createUnaryCallable( getDataExchangeTransportSettings, settings.getDataExchangeSettings(), clientContext); this.createDataExchangeCallable = callableFactory.createUnaryCallable( createDataExchangeTransportSettings, settings.createDataExchangeSettings(), clientContext); this.updateDataExchangeCallable = callableFactory.createUnaryCallable( updateDataExchangeTransportSettings, settings.updateDataExchangeSettings(), clientContext); this.deleteDataExchangeCallable = callableFactory.createUnaryCallable( deleteDataExchangeTransportSettings, settings.deleteDataExchangeSettings(), clientContext); this.listListingsCallable = callableFactory.createUnaryCallable( listListingsTransportSettings, settings.listListingsSettings(), clientContext); this.listListingsPagedCallable = callableFactory.createPagedCallable( listListingsTransportSettings, settings.listListingsSettings(), clientContext); this.getListingCallable = callableFactory.createUnaryCallable( getListingTransportSettings, settings.getListingSettings(), clientContext); this.createListingCallable = callableFactory.createUnaryCallable( createListingTransportSettings, settings.createListingSettings(), clientContext); this.updateListingCallable = callableFactory.createUnaryCallable( updateListingTransportSettings, settings.updateListingSettings(), clientContext); this.deleteListingCallable = callableFactory.createUnaryCallable( deleteListingTransportSettings, settings.deleteListingSettings(), clientContext); this.subscribeListingCallable = callableFactory.createUnaryCallable( subscribeListingTransportSettings, settings.subscribeListingSettings(), clientContext); this.getIamPolicyCallable = callableFactory.createUnaryCallable( getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); this.setIamPolicyCallable = callableFactory.createUnaryCallable( setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); this.testIamPermissionsCallable = callableFactory.createUnaryCallable( testIamPermissionsTransportSettings, settings.testIamPermissionsSettings(), clientContext); this.listLocationsCallable = callableFactory.createUnaryCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.listLocationsPagedCallable = callableFactory.createPagedCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.getLocationCallable = callableFactory.createUnaryCallable( getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @InternalApi public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(listDataExchangesMethodDescriptor); methodDescriptors.add(listOrgDataExchangesMethodDescriptor); methodDescriptors.add(getDataExchangeMethodDescriptor); methodDescriptors.add(createDataExchangeMethodDescriptor); methodDescriptors.add(updateDataExchangeMethodDescriptor); methodDescriptors.add(deleteDataExchangeMethodDescriptor); methodDescriptors.add(listListingsMethodDescriptor); methodDescriptors.add(getListingMethodDescriptor); methodDescriptors.add(createListingMethodDescriptor); methodDescriptors.add(updateListingMethodDescriptor); methodDescriptors.add(deleteListingMethodDescriptor); methodDescriptors.add(subscribeListingMethodDescriptor); methodDescriptors.add(getIamPolicyMethodDescriptor); methodDescriptors.add(setIamPolicyMethodDescriptor); methodDescriptors.add(testIamPermissionsMethodDescriptor); methodDescriptors.add(listLocationsMethodDescriptor); methodDescriptors.add(getLocationMethodDescriptor); return methodDescriptors; } @Override public UnaryCallable listDataExchangesCallable() { return listDataExchangesCallable; } @Override public UnaryCallable listDataExchangesPagedCallable() { return listDataExchangesPagedCallable; } @Override public UnaryCallable listOrgDataExchangesCallable() { return listOrgDataExchangesCallable; } @Override public UnaryCallable listOrgDataExchangesPagedCallable() { return listOrgDataExchangesPagedCallable; } @Override public UnaryCallable getDataExchangeCallable() { return getDataExchangeCallable; } @Override public UnaryCallable createDataExchangeCallable() { return createDataExchangeCallable; } @Override public UnaryCallable updateDataExchangeCallable() { return updateDataExchangeCallable; } @Override public UnaryCallable deleteDataExchangeCallable() { return deleteDataExchangeCallable; } @Override public UnaryCallable listListingsCallable() { return listListingsCallable; } @Override public UnaryCallable listListingsPagedCallable() { return listListingsPagedCallable; } @Override public UnaryCallable getListingCallable() { return getListingCallable; } @Override public UnaryCallable createListingCallable() { return createListingCallable; } @Override public UnaryCallable updateListingCallable() { return updateListingCallable; } @Override public UnaryCallable deleteListingCallable() { return deleteListingCallable; } @Override public UnaryCallable subscribeListingCallable() { return subscribeListingCallable; } @Override public UnaryCallable getIamPolicyCallable() { return getIamPolicyCallable; } @Override public UnaryCallable setIamPolicyCallable() { return setIamPolicyCallable; } @Override public UnaryCallable testIamPermissionsCallable() { return testIamPermissionsCallable; } @Override public UnaryCallable listLocationsCallable() { return listLocationsCallable; } @Override public UnaryCallable listLocationsPagedCallable() { return listLocationsPagedCallable; } @Override public UnaryCallable getLocationCallable() { return getLocationCallable; } @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