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

com.google.cloud.osconfig.v1.stub.HttpJsonOsConfigZonalServiceStub 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.osconfig.v1.stub;

import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListInventoriesPagedResponse;
import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse;
import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse;
import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse;
import static com.google.cloud.osconfig.v1.OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse;

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.osconfig.v1.CreateOSPolicyAssignmentRequest;
import com.google.cloud.osconfig.v1.DeleteOSPolicyAssignmentRequest;
import com.google.cloud.osconfig.v1.GetInventoryRequest;
import com.google.cloud.osconfig.v1.GetOSPolicyAssignmentReportRequest;
import com.google.cloud.osconfig.v1.GetOSPolicyAssignmentRequest;
import com.google.cloud.osconfig.v1.GetVulnerabilityReportRequest;
import com.google.cloud.osconfig.v1.Inventory;
import com.google.cloud.osconfig.v1.ListInventoriesRequest;
import com.google.cloud.osconfig.v1.ListInventoriesResponse;
import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsRequest;
import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsResponse;
import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsRequest;
import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsResponse;
import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentsRequest;
import com.google.cloud.osconfig.v1.ListOSPolicyAssignmentsResponse;
import com.google.cloud.osconfig.v1.ListVulnerabilityReportsRequest;
import com.google.cloud.osconfig.v1.ListVulnerabilityReportsResponse;
import com.google.cloud.osconfig.v1.OSPolicyAssignment;
import com.google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata;
import com.google.cloud.osconfig.v1.OSPolicyAssignmentReport;
import com.google.cloud.osconfig.v1.UpdateOSPolicyAssignmentRequest;
import com.google.cloud.osconfig.v1.VulnerabilityReport;
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 OsConfigZonalService service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") public class HttpJsonOsConfigZonalServiceStub extends OsConfigZonalServiceStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder() .add(Empty.getDescriptor()) .add(OSPolicyAssignmentOperationMetadata.getDescriptor()) .add(OSPolicyAssignment.getDescriptor()) .build(); private static final ApiMethodDescriptor createOSPolicyAssignmentMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/CreateOSPolicyAssignment") .setHttpMethod("POST") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/osPolicyAssignments", 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, "osPolicyAssignmentId", request.getOsPolicyAssignmentId()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody( "osPolicyAssignment", request.getOsPolicyAssignment(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (CreateOSPolicyAssignmentRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor updateOSPolicyAssignmentMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/UpdateOSPolicyAssignment") .setHttpMethod("PATCH") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{osPolicyAssignment.name=projects/*/locations/*/osPolicyAssignments/*}", request -> { Map fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putPathParam( fields, "osPolicyAssignment.name", request.getOsPolicyAssignment().getName()); return fields; }) .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() .toBody( "osPolicyAssignment", request.getOsPolicyAssignment(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (UpdateOSPolicyAssignmentRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor getOSPolicyAssignmentMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/GetOSPolicyAssignment") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}", 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(OSPolicyAssignment.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor< ListOSPolicyAssignmentsRequest, ListOSPolicyAssignmentsResponse> listOSPolicyAssignmentsMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/ListOSPolicyAssignments") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*}/osPolicyAssignments", 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()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListOSPolicyAssignmentsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor< ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> listOSPolicyAssignmentRevisionsMethodDescriptor = ApiMethodDescriptor . newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/ListOSPolicyAssignmentRevisions") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}:listRevisions", 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, "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( ListOSPolicyAssignmentRevisionsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor deleteOSPolicyAssignmentMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/DeleteOSPolicyAssignment") .setHttpMethod("DELETE") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}", 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(Operation.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .setOperationSnapshotFactory( (DeleteOSPolicyAssignmentRequest request, Operation response) -> HttpJsonOperationSnapshot.create(response)) .build(); private static final ApiMethodDescriptor< GetOSPolicyAssignmentReportRequest, OSPolicyAssignmentReport> getOSPolicyAssignmentReportMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/GetOSPolicyAssignmentReport") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/instances/*/osPolicyAssignments/*/report}", 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(OSPolicyAssignmentReport.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor< ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsResponse> listOSPolicyAssignmentReportsMethodDescriptor = ApiMethodDescriptor . newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/ListOSPolicyAssignmentReports") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/instances/*/osPolicyAssignments/*}/reports", 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, "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( ListOSPolicyAssignmentReportsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getInventoryMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.osconfig.v1.OsConfigZonalService/GetInventory") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/instances/*/inventory}", 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, "view", request.getViewValue()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(Inventory.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor listInventoriesMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.osconfig.v1.OsConfigZonalService/ListInventories") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/instances/*}/inventories", 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, "pageSize", request.getPageSize()); serializer.putQueryParam(fields, "pageToken", request.getPageToken()); serializer.putQueryParam(fields, "view", request.getViewValue()); serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() .setDefaultInstance(ListInventoriesResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor getVulnerabilityReportMethodDescriptor = ApiMethodDescriptor.newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/GetVulnerabilityReport") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{name=projects/*/locations/*/instances/*/vulnerabilityReport}", 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(VulnerabilityReport.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private static final ApiMethodDescriptor< ListVulnerabilityReportsRequest, ListVulnerabilityReportsResponse> listVulnerabilityReportsMethodDescriptor = ApiMethodDescriptor .newBuilder() .setFullMethodName( "google.cloud.osconfig.v1.OsConfigZonalService/ListVulnerabilityReports") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) .setRequestFormatter( ProtoMessageRequestFormatter.newBuilder() .setPath( "/v1/{parent=projects/*/locations/*/instances/*}/vulnerabilityReports", 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, "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(ListVulnerabilityReportsResponse.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); private final UnaryCallable createOSPolicyAssignmentCallable; private final OperationCallable< CreateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> createOSPolicyAssignmentOperationCallable; private final UnaryCallable updateOSPolicyAssignmentCallable; private final OperationCallable< UpdateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> updateOSPolicyAssignmentOperationCallable; private final UnaryCallable getOSPolicyAssignmentCallable; private final UnaryCallable listOSPolicyAssignmentsCallable; private final UnaryCallable listOSPolicyAssignmentsPagedCallable; private final UnaryCallable< ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> listOSPolicyAssignmentRevisionsCallable; private final UnaryCallable< ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsPagedResponse> listOSPolicyAssignmentRevisionsPagedCallable; private final UnaryCallable deleteOSPolicyAssignmentCallable; private final OperationCallable< DeleteOSPolicyAssignmentRequest, Empty, OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentOperationCallable; private final UnaryCallable getOSPolicyAssignmentReportCallable; private final UnaryCallable< ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsResponse> listOSPolicyAssignmentReportsCallable; private final UnaryCallable< ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsPagedResponse> listOSPolicyAssignmentReportsPagedCallable; private final UnaryCallable getInventoryCallable; private final UnaryCallable listInventoriesCallable; private final UnaryCallable listInventoriesPagedCallable; private final UnaryCallable getVulnerabilityReportCallable; private final UnaryCallable listVulnerabilityReportsCallable; private final UnaryCallable< ListVulnerabilityReportsRequest, ListVulnerabilityReportsPagedResponse> listVulnerabilityReportsPagedCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; private final HttpJsonStubCallableFactory callableFactory; public static final HttpJsonOsConfigZonalServiceStub create( OsConfigZonalServiceStubSettings settings) throws IOException { return new HttpJsonOsConfigZonalServiceStub(settings, ClientContext.create(settings)); } public static final HttpJsonOsConfigZonalServiceStub create(ClientContext clientContext) throws IOException { return new HttpJsonOsConfigZonalServiceStub( OsConfigZonalServiceStubSettings.newHttpJsonBuilder().build(), clientContext); } public static final HttpJsonOsConfigZonalServiceStub create( ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { return new HttpJsonOsConfigZonalServiceStub( OsConfigZonalServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of HttpJsonOsConfigZonalServiceStub, 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 HttpJsonOsConfigZonalServiceStub( OsConfigZonalServiceStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new HttpJsonOsConfigZonalServiceCallableFactory()); } /** * Constructs an instance of HttpJsonOsConfigZonalServiceStub, 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 HttpJsonOsConfigZonalServiceStub( OsConfigZonalServiceStubSettings 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/*/osPolicyAssignments/*/operations/*}:cancel") .build()) .put( "google.longrunning.Operations.GetOperation", HttpRule.newBuilder() .setGet( "/v1/{name=projects/*/locations/*/osPolicyAssignments/*/operations/*}") .build()) .build()); HttpJsonCallSettings createOSPolicyAssignmentTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(createOSPolicyAssignmentMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings updateOSPolicyAssignmentTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(updateOSPolicyAssignmentMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "os_policy_assignment.name", String.valueOf(request.getOsPolicyAssignment().getName())); return builder.build(); }) .build(); HttpJsonCallSettings getOSPolicyAssignmentTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getOSPolicyAssignmentMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listOSPolicyAssignmentsTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(listOSPolicyAssignmentsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings< ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> listOSPolicyAssignmentRevisionsTransportSettings = HttpJsonCallSettings . newBuilder() .setMethodDescriptor(listOSPolicyAssignmentRevisionsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings deleteOSPolicyAssignmentTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(deleteOSPolicyAssignmentMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings getOSPolicyAssignmentReportTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(getOSPolicyAssignmentReportMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings< ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsResponse> listOSPolicyAssignmentReportsTransportSettings = HttpJsonCallSettings . newBuilder() .setMethodDescriptor(listOSPolicyAssignmentReportsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getInventoryTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getInventoryMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listInventoriesTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(listInventoriesMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); HttpJsonCallSettings getVulnerabilityReportTransportSettings = HttpJsonCallSettings.newBuilder() .setMethodDescriptor(getVulnerabilityReportMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); HttpJsonCallSettings listVulnerabilityReportsTransportSettings = HttpJsonCallSettings .newBuilder() .setMethodDescriptor(listVulnerabilityReportsMethodDescriptor) .setTypeRegistry(typeRegistry) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); this.createOSPolicyAssignmentCallable = callableFactory.createUnaryCallable( createOSPolicyAssignmentTransportSettings, settings.createOSPolicyAssignmentSettings(), clientContext); this.createOSPolicyAssignmentOperationCallable = callableFactory.createOperationCallable( createOSPolicyAssignmentTransportSettings, settings.createOSPolicyAssignmentOperationSettings(), clientContext, httpJsonOperationsStub); this.updateOSPolicyAssignmentCallable = callableFactory.createUnaryCallable( updateOSPolicyAssignmentTransportSettings, settings.updateOSPolicyAssignmentSettings(), clientContext); this.updateOSPolicyAssignmentOperationCallable = callableFactory.createOperationCallable( updateOSPolicyAssignmentTransportSettings, settings.updateOSPolicyAssignmentOperationSettings(), clientContext, httpJsonOperationsStub); this.getOSPolicyAssignmentCallable = callableFactory.createUnaryCallable( getOSPolicyAssignmentTransportSettings, settings.getOSPolicyAssignmentSettings(), clientContext); this.listOSPolicyAssignmentsCallable = callableFactory.createUnaryCallable( listOSPolicyAssignmentsTransportSettings, settings.listOSPolicyAssignmentsSettings(), clientContext); this.listOSPolicyAssignmentsPagedCallable = callableFactory.createPagedCallable( listOSPolicyAssignmentsTransportSettings, settings.listOSPolicyAssignmentsSettings(), clientContext); this.listOSPolicyAssignmentRevisionsCallable = callableFactory.createUnaryCallable( listOSPolicyAssignmentRevisionsTransportSettings, settings.listOSPolicyAssignmentRevisionsSettings(), clientContext); this.listOSPolicyAssignmentRevisionsPagedCallable = callableFactory.createPagedCallable( listOSPolicyAssignmentRevisionsTransportSettings, settings.listOSPolicyAssignmentRevisionsSettings(), clientContext); this.deleteOSPolicyAssignmentCallable = callableFactory.createUnaryCallable( deleteOSPolicyAssignmentTransportSettings, settings.deleteOSPolicyAssignmentSettings(), clientContext); this.deleteOSPolicyAssignmentOperationCallable = callableFactory.createOperationCallable( deleteOSPolicyAssignmentTransportSettings, settings.deleteOSPolicyAssignmentOperationSettings(), clientContext, httpJsonOperationsStub); this.getOSPolicyAssignmentReportCallable = callableFactory.createUnaryCallable( getOSPolicyAssignmentReportTransportSettings, settings.getOSPolicyAssignmentReportSettings(), clientContext); this.listOSPolicyAssignmentReportsCallable = callableFactory.createUnaryCallable( listOSPolicyAssignmentReportsTransportSettings, settings.listOSPolicyAssignmentReportsSettings(), clientContext); this.listOSPolicyAssignmentReportsPagedCallable = callableFactory.createPagedCallable( listOSPolicyAssignmentReportsTransportSettings, settings.listOSPolicyAssignmentReportsSettings(), clientContext); this.getInventoryCallable = callableFactory.createUnaryCallable( getInventoryTransportSettings, settings.getInventorySettings(), clientContext); this.listInventoriesCallable = callableFactory.createUnaryCallable( listInventoriesTransportSettings, settings.listInventoriesSettings(), clientContext); this.listInventoriesPagedCallable = callableFactory.createPagedCallable( listInventoriesTransportSettings, settings.listInventoriesSettings(), clientContext); this.getVulnerabilityReportCallable = callableFactory.createUnaryCallable( getVulnerabilityReportTransportSettings, settings.getVulnerabilityReportSettings(), clientContext); this.listVulnerabilityReportsCallable = callableFactory.createUnaryCallable( listVulnerabilityReportsTransportSettings, settings.listVulnerabilityReportsSettings(), clientContext); this.listVulnerabilityReportsPagedCallable = callableFactory.createPagedCallable( listVulnerabilityReportsTransportSettings, settings.listVulnerabilityReportsSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } @InternalApi public static List getMethodDescriptors() { List methodDescriptors = new ArrayList<>(); methodDescriptors.add(createOSPolicyAssignmentMethodDescriptor); methodDescriptors.add(updateOSPolicyAssignmentMethodDescriptor); methodDescriptors.add(getOSPolicyAssignmentMethodDescriptor); methodDescriptors.add(listOSPolicyAssignmentsMethodDescriptor); methodDescriptors.add(listOSPolicyAssignmentRevisionsMethodDescriptor); methodDescriptors.add(deleteOSPolicyAssignmentMethodDescriptor); methodDescriptors.add(getOSPolicyAssignmentReportMethodDescriptor); methodDescriptors.add(listOSPolicyAssignmentReportsMethodDescriptor); methodDescriptors.add(getInventoryMethodDescriptor); methodDescriptors.add(listInventoriesMethodDescriptor); methodDescriptors.add(getVulnerabilityReportMethodDescriptor); methodDescriptors.add(listVulnerabilityReportsMethodDescriptor); return methodDescriptors; } public HttpJsonOperationsStub getHttpJsonOperationsStub() { return httpJsonOperationsStub; } @Override public UnaryCallable createOSPolicyAssignmentCallable() { return createOSPolicyAssignmentCallable; } @Override public OperationCallable< CreateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> createOSPolicyAssignmentOperationCallable() { return createOSPolicyAssignmentOperationCallable; } @Override public UnaryCallable updateOSPolicyAssignmentCallable() { return updateOSPolicyAssignmentCallable; } @Override public OperationCallable< UpdateOSPolicyAssignmentRequest, OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> updateOSPolicyAssignmentOperationCallable() { return updateOSPolicyAssignmentOperationCallable; } @Override public UnaryCallable getOSPolicyAssignmentCallable() { return getOSPolicyAssignmentCallable; } @Override public UnaryCallable listOSPolicyAssignmentsCallable() { return listOSPolicyAssignmentsCallable; } @Override public UnaryCallable listOSPolicyAssignmentsPagedCallable() { return listOSPolicyAssignmentsPagedCallable; } @Override public UnaryCallable< ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsResponse> listOSPolicyAssignmentRevisionsCallable() { return listOSPolicyAssignmentRevisionsCallable; } @Override public UnaryCallable< ListOSPolicyAssignmentRevisionsRequest, ListOSPolicyAssignmentRevisionsPagedResponse> listOSPolicyAssignmentRevisionsPagedCallable() { return listOSPolicyAssignmentRevisionsPagedCallable; } @Override public UnaryCallable deleteOSPolicyAssignmentCallable() { return deleteOSPolicyAssignmentCallable; } @Override public OperationCallable< DeleteOSPolicyAssignmentRequest, Empty, OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentOperationCallable() { return deleteOSPolicyAssignmentOperationCallable; } @Override public UnaryCallable getOSPolicyAssignmentReportCallable() { return getOSPolicyAssignmentReportCallable; } @Override public UnaryCallable listOSPolicyAssignmentReportsCallable() { return listOSPolicyAssignmentReportsCallable; } @Override public UnaryCallable< ListOSPolicyAssignmentReportsRequest, ListOSPolicyAssignmentReportsPagedResponse> listOSPolicyAssignmentReportsPagedCallable() { return listOSPolicyAssignmentReportsPagedCallable; } @Override public UnaryCallable getInventoryCallable() { return getInventoryCallable; } @Override public UnaryCallable listInventoriesCallable() { return listInventoriesCallable; } @Override public UnaryCallable listInventoriesPagedCallable() { return listInventoriesPagedCallable; } @Override public UnaryCallable getVulnerabilityReportCallable() { return getVulnerabilityReportCallable; } @Override public UnaryCallable listVulnerabilityReportsCallable() { return listVulnerabilityReportsCallable; } @Override public UnaryCallable listVulnerabilityReportsPagedCallable() { return listVulnerabilityReportsPagedCallable; } @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 - 2025 Weber Informatics LLC | Privacy Policy