diff --git a/google-cloud-service-control-bom/pom.xml b/google-cloud-service-control-bom/pom.xml index b38111dd..4351f196 100644 --- a/google-cloud-service-control-bom/pom.xml +++ b/google-cloud-service-control-bom/pom.xml @@ -63,11 +63,21 @@ grpc-google-cloud-service-control-v1 1.1.10-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-service-control-v2 + 1.1.10-SNAPSHOT + com.google.api.grpc proto-google-cloud-service-control-v1 1.1.10-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-service-control-v2 + 1.1.10-SNAPSHOT + diff --git a/google-cloud-service-control/pom.xml b/google-cloud-service-control/pom.xml index 1abdb554..f001cd47 100644 --- a/google-cloud-service-control/pom.xml +++ b/google-cloud-service-control/pom.xml @@ -42,6 +42,10 @@ proto-google-common-protos + + com.google.api.grpc + proto-google-cloud-service-control-v2 + com.google.api.grpc proto-google-cloud-service-control-v1 @@ -76,6 +80,11 @@ grpc-google-cloud-service-control-v1 test + + com.google.api.grpc + grpc-google-cloud-service-control-v2 + test + com.google.api diff --git a/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerClient.java b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerClient.java new file mode 100644 index 00000000..99a62612 --- /dev/null +++ b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerClient.java @@ -0,0 +1,346 @@ +/* + * Copyright 2021 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.api.servicecontrol.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.servicecontrol.v2.stub.ServiceControllerStub; +import com.google.api.servicecontrol.v2.stub.ServiceControllerStubSettings; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: [Service Control API v2](/service-infrastructure/docs/service-control) + * + *

Private Preview. This feature is only available for approved services. + * + *

This API provides admission control and telemetry reporting for services that are integrated + * with [Service Infrastructure](/service-infrastructure). + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

{@code
+ * try (ServiceControllerClient serviceControllerClient = ServiceControllerClient.create()) {
+ *   CheckRequest request =
+ *       CheckRequest.newBuilder()
+ *           .setServiceName("serviceName-1928572192")
+ *           .setServiceConfigId("serviceConfigId650537426")
+ *           .setAttributes(AttributeContext.newBuilder().build())
+ *           .addAllResources(new ArrayList())
+ *           .setFlags("flags97513095")
+ *           .build();
+ *   CheckResponse response = serviceControllerClient.check(request);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the ServiceControllerClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ServiceControllerSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * ServiceControllerSettings serviceControllerSettings =
+ *     ServiceControllerSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ServiceControllerClient serviceControllerClient =
+ *     ServiceControllerClient.create(serviceControllerSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * ServiceControllerSettings serviceControllerSettings =
+ *     ServiceControllerSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ServiceControllerClient serviceControllerClient =
+ *     ServiceControllerClient.create(serviceControllerSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class ServiceControllerClient implements BackgroundResource { + private final ServiceControllerSettings settings; + private final ServiceControllerStub stub; + + /** Constructs an instance of ServiceControllerClient with default settings. */ + public static final ServiceControllerClient create() throws IOException { + return create(ServiceControllerSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ServiceControllerClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ServiceControllerClient create(ServiceControllerSettings settings) + throws IOException { + return new ServiceControllerClient(settings); + } + + /** + * Constructs an instance of ServiceControllerClient, using the given stub for making calls. This + * is for advanced usage - prefer using create(ServiceControllerSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final ServiceControllerClient create(ServiceControllerStub stub) { + return new ServiceControllerClient(stub); + } + + /** + * Constructs an instance of ServiceControllerClient, 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 ServiceControllerClient(ServiceControllerSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ServiceControllerStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected ServiceControllerClient(ServiceControllerStub stub) { + this.settings = null; + this.stub = stub; + } + + public final ServiceControllerSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ServiceControllerStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Private Preview. This feature is only available for approved services. + * + *

This method provides admission control for services that are integrated with [Service + * Infrastructure](/service-infrastructure). It checks whether an operation should be allowed + * based on the service configuration and relevant policies. It must be called before the + * operation is executed. For more information, see [Admission + * Control](/service-infrastructure/docs/admission-control). + * + *

NOTE: The admission control has an expected policy propagation delay of 60s. The caller + * **must** not depend on the most recent policy changes. + * + *

NOTE: The admission control has a hard limit of 1 referenced resources per call. If an + * operation refers to more than 1 resources, the caller must call the Check method multiple + * times. + * + *

This method requires the `servicemanagement.services.check` permission on the specified + * service. For more information, see [Service Control API Access + * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + * + *

Sample code: + * + *

{@code
+   * try (ServiceControllerClient serviceControllerClient = ServiceControllerClient.create()) {
+   *   CheckRequest request =
+   *       CheckRequest.newBuilder()
+   *           .setServiceName("serviceName-1928572192")
+   *           .setServiceConfigId("serviceConfigId650537426")
+   *           .setAttributes(AttributeContext.newBuilder().build())
+   *           .addAllResources(new ArrayList())
+   *           .setFlags("flags97513095")
+   *           .build();
+   *   CheckResponse response = serviceControllerClient.check(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CheckResponse check(CheckRequest request) { + return checkCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Private Preview. This feature is only available for approved services. + * + *

This method provides admission control for services that are integrated with [Service + * Infrastructure](/service-infrastructure). It checks whether an operation should be allowed + * based on the service configuration and relevant policies. It must be called before the + * operation is executed. For more information, see [Admission + * Control](/service-infrastructure/docs/admission-control). + * + *

NOTE: The admission control has an expected policy propagation delay of 60s. The caller + * **must** not depend on the most recent policy changes. + * + *

NOTE: The admission control has a hard limit of 1 referenced resources per call. If an + * operation refers to more than 1 resources, the caller must call the Check method multiple + * times. + * + *

This method requires the `servicemanagement.services.check` permission on the specified + * service. For more information, see [Service Control API Access + * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + * + *

Sample code: + * + *

{@code
+   * try (ServiceControllerClient serviceControllerClient = ServiceControllerClient.create()) {
+   *   CheckRequest request =
+   *       CheckRequest.newBuilder()
+   *           .setServiceName("serviceName-1928572192")
+   *           .setServiceConfigId("serviceConfigId650537426")
+   *           .setAttributes(AttributeContext.newBuilder().build())
+   *           .addAllResources(new ArrayList())
+   *           .setFlags("flags97513095")
+   *           .build();
+   *   ApiFuture future = serviceControllerClient.checkCallable().futureCall(request);
+   *   // Do something.
+   *   CheckResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable checkCallable() { + return stub.checkCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Private Preview. This feature is only available for approved services. + * + *

This method provides telemetry reporting for services that are integrated with [Service + * Infrastructure](/service-infrastructure). It reports a list of operations that have occurred on + * a service. It must be called after the operations have been executed. For more information, see + * [Telemetry Reporting](/service-infrastructure/docs/telemetry-reporting). + * + *

NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB per Report call. + * It is recommended to have no more than 100 operations per call. + * + *

This method requires the `servicemanagement.services.report` permission on the specified + * service. For more information, see [Service Control API Access + * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + * + *

Sample code: + * + *

{@code
+   * try (ServiceControllerClient serviceControllerClient = ServiceControllerClient.create()) {
+   *   ReportRequest request =
+   *       ReportRequest.newBuilder()
+   *           .setServiceName("serviceName-1928572192")
+   *           .setServiceConfigId("serviceConfigId650537426")
+   *           .addAllOperations(new ArrayList())
+   *           .build();
+   *   ReportResponse response = serviceControllerClient.report(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReportResponse report(ReportRequest request) { + return reportCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Private Preview. This feature is only available for approved services. + * + *

This method provides telemetry reporting for services that are integrated with [Service + * Infrastructure](/service-infrastructure). It reports a list of operations that have occurred on + * a service. It must be called after the operations have been executed. For more information, see + * [Telemetry Reporting](/service-infrastructure/docs/telemetry-reporting). + * + *

NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB per Report call. + * It is recommended to have no more than 100 operations per call. + * + *

This method requires the `servicemanagement.services.report` permission on the specified + * service. For more information, see [Service Control API Access + * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + * + *

Sample code: + * + *

{@code
+   * try (ServiceControllerClient serviceControllerClient = ServiceControllerClient.create()) {
+   *   ReportRequest request =
+   *       ReportRequest.newBuilder()
+   *           .setServiceName("serviceName-1928572192")
+   *           .setServiceConfigId("serviceConfigId650537426")
+   *           .addAllOperations(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       serviceControllerClient.reportCallable().futureCall(request);
+   *   // Do something.
+   *   ReportResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable reportCallable() { + return stub.reportCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerSettings.java b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerSettings.java new file mode 100644 index 00000000..3cf464d4 --- /dev/null +++ b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerSettings.java @@ -0,0 +1,192 @@ +/* + * Copyright 2021 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.api.servicecontrol.v2; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.servicecontrol.v2.stub.ServiceControllerStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ServiceControllerClient}. + * + *

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

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

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

For example, to set the total timeout of check to 30 seconds: + * + *

{@code
+ * ServiceControllerSettings.Builder serviceControllerSettingsBuilder =
+ *     ServiceControllerSettings.newBuilder();
+ * serviceControllerSettingsBuilder
+ *     .checkSettings()
+ *     .setRetrySettings(
+ *         serviceControllerSettingsBuilder
+ *             .checkSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ServiceControllerSettings serviceControllerSettings = serviceControllerSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ServiceControllerSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to check. */ + public UnaryCallSettings checkSettings() { + return ((ServiceControllerStubSettings) getStubSettings()).checkSettings(); + } + + /** Returns the object with the settings used for calls to report. */ + public UnaryCallSettings reportSettings() { + return ((ServiceControllerStubSettings) getStubSettings()).reportSettings(); + } + + public static final ServiceControllerSettings create(ServiceControllerStubSettings stub) + throws IOException { + return new ServiceControllerSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ServiceControllerStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ServiceControllerStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ServiceControllerStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ServiceControllerStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return ServiceControllerStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ServiceControllerStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ServiceControllerStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ServiceControllerSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ServiceControllerSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(ServiceControllerStubSettings.newBuilder(clientContext)); + } + + protected Builder(ServiceControllerSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ServiceControllerStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(ServiceControllerStubSettings.newBuilder()); + } + + public ServiceControllerStubSettings.Builder getStubSettingsBuilder() { + return ((ServiceControllerStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to check. */ + public UnaryCallSettings.Builder checkSettings() { + return getStubSettingsBuilder().checkSettings(); + } + + /** Returns the builder for the settings used for calls to report. */ + public UnaryCallSettings.Builder reportSettings() { + return getStubSettingsBuilder().reportSettings(); + } + + @Override + public ServiceControllerSettings build() throws IOException { + return new ServiceControllerSettings(this); + } + } +} diff --git a/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/gapic_metadata.json b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/gapic_metadata.json new file mode 100644 index 00000000..39caa24f --- /dev/null +++ b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/gapic_metadata.json @@ -0,0 +1,24 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.api.servicecontrol.v2", + "libraryPackage": "com.google.api.servicecontrol.v2", + "services": { + "ServiceController": { + "clients": { + "grpc": { + "libraryClient": "ServiceControllerClient", + "rpcs": { + "Check": { + "methods": ["check", "checkCallable"] + }, + "Report": { + "methods": ["report", "reportCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/package-info.java b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/package-info.java new file mode 100644 index 00000000..4ee9f114 --- /dev/null +++ b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/package-info.java @@ -0,0 +1,50 @@ +/* + * Copyright 2021 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. + */ + +/** + * A client to Service Control API + * + *

The interfaces provided are listed below, along with usage samples. + * + *

======================= ServiceControllerClient ======================= + * + *

Service Description: [Service Control API v2](/service-infrastructure/docs/service-control) + * + *

Private Preview. This feature is only available for approved services. + * + *

This API provides admission control and telemetry reporting for services that are integrated + * with [Service Infrastructure](/service-infrastructure). + * + *

Sample for ServiceControllerClient: + * + *

{@code
+ * try (ServiceControllerClient serviceControllerClient = ServiceControllerClient.create()) {
+ *   CheckRequest request =
+ *       CheckRequest.newBuilder()
+ *           .setServiceName("serviceName-1928572192")
+ *           .setServiceConfigId("serviceConfigId650537426")
+ *           .setAttributes(AttributeContext.newBuilder().build())
+ *           .addAllResources(new ArrayList())
+ *           .setFlags("flags97513095")
+ *           .build();
+ *   CheckResponse response = serviceControllerClient.check(request);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.api.servicecontrol.v2; + +import javax.annotation.Generated; diff --git a/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/GrpcServiceControllerCallableFactory.java b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/GrpcServiceControllerCallableFactory.java new file mode 100644 index 00000000..dd288578 --- /dev/null +++ b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/GrpcServiceControllerCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2021 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.api.servicecontrol.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the ServiceController service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcServiceControllerCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/GrpcServiceControllerStub.java b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/GrpcServiceControllerStub.java new file mode 100644 index 00000000..c4be1372 --- /dev/null +++ b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/GrpcServiceControllerStub.java @@ -0,0 +1,189 @@ +/* + * Copyright 2021 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.api.servicecontrol.v2.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.servicecontrol.v2.CheckRequest; +import com.google.api.servicecontrol.v2.CheckResponse; +import com.google.api.servicecontrol.v2.ReportRequest; +import com.google.api.servicecontrol.v2.ReportResponse; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the ServiceController service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcServiceControllerStub extends ServiceControllerStub { + private static final MethodDescriptor checkMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.servicecontrol.v2.ServiceController/Check") + .setRequestMarshaller(ProtoUtils.marshaller(CheckRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CheckResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor reportMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.servicecontrol.v2.ServiceController/Report") + .setRequestMarshaller(ProtoUtils.marshaller(ReportRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ReportResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable checkCallable; + private final UnaryCallable reportCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcServiceControllerStub create(ServiceControllerStubSettings settings) + throws IOException { + return new GrpcServiceControllerStub(settings, ClientContext.create(settings)); + } + + public static final GrpcServiceControllerStub create(ClientContext clientContext) + throws IOException { + return new GrpcServiceControllerStub( + ServiceControllerStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcServiceControllerStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcServiceControllerStub( + ServiceControllerStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcServiceControllerStub, 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 GrpcServiceControllerStub( + ServiceControllerStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcServiceControllerCallableFactory()); + } + + /** + * Constructs an instance of GrpcServiceControllerStub, 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 GrpcServiceControllerStub( + ServiceControllerStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings checkTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(checkMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("service_name", String.valueOf(request.getServiceName())); + return params.build(); + }) + .build(); + GrpcCallSettings reportTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(reportMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("service_name", String.valueOf(request.getServiceName())); + return params.build(); + }) + .build(); + + this.checkCallable = + callableFactory.createUnaryCallable( + checkTransportSettings, settings.checkSettings(), clientContext); + this.reportCallable = + callableFactory.createUnaryCallable( + reportTransportSettings, settings.reportSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable checkCallable() { + return checkCallable; + } + + @Override + public UnaryCallable reportCallable() { + return reportCallable; + } + + @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); + } +} diff --git a/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/ServiceControllerStub.java b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/ServiceControllerStub.java new file mode 100644 index 00000000..3f4592a7 --- /dev/null +++ b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/ServiceControllerStub.java @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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.api.servicecontrol.v2.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.servicecontrol.v2.CheckRequest; +import com.google.api.servicecontrol.v2.CheckResponse; +import com.google.api.servicecontrol.v2.ReportRequest; +import com.google.api.servicecontrol.v2.ReportResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the ServiceController service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class ServiceControllerStub implements BackgroundResource { + + public UnaryCallable checkCallable() { + throw new UnsupportedOperationException("Not implemented: checkCallable()"); + } + + public UnaryCallable reportCallable() { + throw new UnsupportedOperationException("Not implemented: reportCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/ServiceControllerStubSettings.java b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/ServiceControllerStubSettings.java new file mode 100644 index 00000000..13c64f1d --- /dev/null +++ b/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v2/stub/ServiceControllerStubSettings.java @@ -0,0 +1,304 @@ +/* + * Copyright 2021 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.api.servicecontrol.v2.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.servicecontrol.v2.CheckRequest; +import com.google.api.servicecontrol.v2.CheckResponse; +import com.google.api.servicecontrol.v2.ReportRequest; +import com.google.api.servicecontrol.v2.ReportResponse; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ServiceControllerStub}. + * + *

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

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

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

For example, to set the total timeout of check to 30 seconds: + * + *

{@code
+ * ServiceControllerStubSettings.Builder serviceControllerSettingsBuilder =
+ *     ServiceControllerStubSettings.newBuilder();
+ * serviceControllerSettingsBuilder
+ *     .checkSettings()
+ *     .setRetrySettings(
+ *         serviceControllerSettingsBuilder
+ *             .checkSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ServiceControllerStubSettings serviceControllerSettings =
+ *     serviceControllerSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ServiceControllerStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/servicecontrol") + .build(); + + private final UnaryCallSettings checkSettings; + private final UnaryCallSettings reportSettings; + + /** Returns the object with the settings used for calls to check. */ + public UnaryCallSettings checkSettings() { + return checkSettings; + } + + /** Returns the object with the settings used for calls to report. */ + public UnaryCallSettings reportSettings() { + return reportSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public ServiceControllerStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcServiceControllerStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "servicecontrol.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "servicecontrol.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ServiceControllerStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ServiceControllerStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + checkSettings = settingsBuilder.checkSettings().build(); + reportSettings = settingsBuilder.reportSettings().build(); + } + + /** Builder for ServiceControllerStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder checkSettings; + private final UnaryCallSettings.Builder reportSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(1000L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(10000L)) + .setInitialRpcTimeout(Duration.ofMillis(5000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(5000L)) + .setTotalTimeout(Duration.ofMillis(5000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + checkSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + reportSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(checkSettings, reportSettings); + initDefaults(this); + } + + protected Builder(ServiceControllerStubSettings settings) { + super(settings); + + checkSettings = settings.checkSettings.toBuilder(); + reportSettings = settings.reportSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(checkSettings, reportSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .checkSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .reportSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to check. */ + public UnaryCallSettings.Builder checkSettings() { + return checkSettings; + } + + /** Returns the builder for the settings used for calls to report. */ + public UnaryCallSettings.Builder reportSettings() { + return reportSettings; + } + + @Override + public ServiceControllerStubSettings build() throws IOException { + return new ServiceControllerStubSettings(this); + } + } +} diff --git a/google-cloud-service-control/src/test/java/com/google/api/servicecontrol/v2/MockServiceController.java b/google-cloud-service-control/src/test/java/com/google/api/servicecontrol/v2/MockServiceController.java new file mode 100644 index 00000000..86e72336 --- /dev/null +++ b/google-cloud-service-control/src/test/java/com/google/api/servicecontrol/v2/MockServiceController.java @@ -0,0 +1,59 @@ +/* + * Copyright 2021 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.api.servicecontrol.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockServiceController implements MockGrpcService { + private final MockServiceControllerImpl serviceImpl; + + public MockServiceController() { + serviceImpl = new MockServiceControllerImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-service-control/src/test/java/com/google/api/servicecontrol/v2/MockServiceControllerImpl.java b/google-cloud-service-control/src/test/java/com/google/api/servicecontrol/v2/MockServiceControllerImpl.java new file mode 100644 index 00000000..bb41de24 --- /dev/null +++ b/google-cloud-service-control/src/test/java/com/google/api/servicecontrol/v2/MockServiceControllerImpl.java @@ -0,0 +1,100 @@ +/* + * Copyright 2021 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.api.servicecontrol.v2; + +import com.google.api.core.BetaApi; +import com.google.api.servicecontrol.v2.ServiceControllerGrpc.ServiceControllerImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockServiceControllerImpl extends ServiceControllerImplBase { + private List requests; + private Queue responses; + + public MockServiceControllerImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void check(CheckRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof CheckResponse) { + requests.add(request); + responseObserver.onNext(((CheckResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method Check, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + CheckResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void report(ReportRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ReportResponse) { + requests.add(request); + responseObserver.onNext(((ReportResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method Report, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ReportResponse.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/google-cloud-service-control/src/test/java/com/google/api/servicecontrol/v2/ServiceControllerClientTest.java b/google-cloud-service-control/src/test/java/com/google/api/servicecontrol/v2/ServiceControllerClientTest.java new file mode 100644 index 00000000..d18b329e --- /dev/null +++ b/google-cloud-service-control/src/test/java/com/google/api/servicecontrol/v2/ServiceControllerClientTest.java @@ -0,0 +1,185 @@ +/* + * Copyright 2021 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.api.servicecontrol.v2; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.protobuf.AbstractMessage; +import com.google.rpc.Status; +import com.google.rpc.context.AttributeContext; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ServiceControllerClientTest { + private static MockServiceController mockServiceController; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private ServiceControllerClient client; + + @BeforeClass + public static void startStaticServer() { + mockServiceController = new MockServiceController(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockServiceController)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + ServiceControllerSettings settings = + ServiceControllerSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ServiceControllerClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void checkTest() throws Exception { + CheckResponse expectedResponse = + CheckResponse.newBuilder() + .setStatus(Status.newBuilder().build()) + .putAllHeaders(new HashMap()) + .build(); + mockServiceController.addResponse(expectedResponse); + + CheckRequest request = + CheckRequest.newBuilder() + .setServiceName("serviceName-1928572192") + .setServiceConfigId("serviceConfigId650537426") + .setAttributes(AttributeContext.newBuilder().build()) + .addAllResources(new ArrayList()) + .setFlags("flags97513095") + .build(); + + CheckResponse actualResponse = client.check(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServiceController.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CheckRequest actualRequest = ((CheckRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getServiceName(), actualRequest.getServiceName()); + Assert.assertEquals(request.getServiceConfigId(), actualRequest.getServiceConfigId()); + Assert.assertEquals(request.getAttributes(), actualRequest.getAttributes()); + Assert.assertEquals(request.getResourcesList(), actualRequest.getResourcesList()); + Assert.assertEquals(request.getFlags(), actualRequest.getFlags()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void checkExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServiceController.addException(exception); + + try { + CheckRequest request = + CheckRequest.newBuilder() + .setServiceName("serviceName-1928572192") + .setServiceConfigId("serviceConfigId650537426") + .setAttributes(AttributeContext.newBuilder().build()) + .addAllResources(new ArrayList()) + .setFlags("flags97513095") + .build(); + client.check(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void reportTest() throws Exception { + ReportResponse expectedResponse = ReportResponse.newBuilder().build(); + mockServiceController.addResponse(expectedResponse); + + ReportRequest request = + ReportRequest.newBuilder() + .setServiceName("serviceName-1928572192") + .setServiceConfigId("serviceConfigId650537426") + .addAllOperations(new ArrayList()) + .build(); + + ReportResponse actualResponse = client.report(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockServiceController.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ReportRequest actualRequest = ((ReportRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getServiceName(), actualRequest.getServiceName()); + Assert.assertEquals(request.getServiceConfigId(), actualRequest.getServiceConfigId()); + Assert.assertEquals(request.getOperationsList(), actualRequest.getOperationsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void reportExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockServiceController.addException(exception); + + try { + ReportRequest request = + ReportRequest.newBuilder() + .setServiceName("serviceName-1928572192") + .setServiceConfigId("serviceConfigId650537426") + .addAllOperations(new ArrayList()) + .build(); + client.report(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/grpc-google-cloud-service-control-v2/pom.xml b/grpc-google-cloud-service-control-v2/pom.xml new file mode 100644 index 00000000..3fc21c41 --- /dev/null +++ b/grpc-google-cloud-service-control-v2/pom.xml @@ -0,0 +1,65 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-service-control-v2 + 1.1.9-SNAPSHOT + grpc-google-cloud-service-control-v2 + GRPC library for google-cloud-service-control + + com.google.cloud + google-cloud-service-control-parent + 1.1.10-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-cloud-service-control-v2 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/grpc-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerGrpc.java b/grpc-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerGrpc.java new file mode 100644 index 00000000..66f124fd --- /dev/null +++ b/grpc-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerGrpc.java @@ -0,0 +1,595 @@ +/* + * Copyright 2020 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.api.servicecontrol.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * [Service Control API v2](/service-infrastructure/docs/service-control)
+ * Private Preview. This feature is only available for approved services.
+ * This API provides admission control and telemetry reporting for services
+ * that are integrated with [Service Infrastructure](/service-infrastructure).
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/api/servicecontrol/v2/service_controller.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class ServiceControllerGrpc { + + private ServiceControllerGrpc() {} + + public static final String SERVICE_NAME = "google.api.servicecontrol.v2.ServiceController"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.api.servicecontrol.v2.CheckRequest, + com.google.api.servicecontrol.v2.CheckResponse> + getCheckMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "Check", + requestType = com.google.api.servicecontrol.v2.CheckRequest.class, + responseType = com.google.api.servicecontrol.v2.CheckResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.servicecontrol.v2.CheckRequest, + com.google.api.servicecontrol.v2.CheckResponse> + getCheckMethod() { + io.grpc.MethodDescriptor< + com.google.api.servicecontrol.v2.CheckRequest, + com.google.api.servicecontrol.v2.CheckResponse> + getCheckMethod; + if ((getCheckMethod = ServiceControllerGrpc.getCheckMethod) == null) { + synchronized (ServiceControllerGrpc.class) { + if ((getCheckMethod = ServiceControllerGrpc.getCheckMethod) == null) { + ServiceControllerGrpc.getCheckMethod = + getCheckMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Check")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.servicecontrol.v2.CheckRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.servicecontrol.v2.CheckResponse.getDefaultInstance())) + .setSchemaDescriptor(new ServiceControllerMethodDescriptorSupplier("Check")) + .build(); + } + } + } + return getCheckMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.api.servicecontrol.v2.ReportRequest, + com.google.api.servicecontrol.v2.ReportResponse> + getReportMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "Report", + requestType = com.google.api.servicecontrol.v2.ReportRequest.class, + responseType = com.google.api.servicecontrol.v2.ReportResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.servicecontrol.v2.ReportRequest, + com.google.api.servicecontrol.v2.ReportResponse> + getReportMethod() { + io.grpc.MethodDescriptor< + com.google.api.servicecontrol.v2.ReportRequest, + com.google.api.servicecontrol.v2.ReportResponse> + getReportMethod; + if ((getReportMethod = ServiceControllerGrpc.getReportMethod) == null) { + synchronized (ServiceControllerGrpc.class) { + if ((getReportMethod = ServiceControllerGrpc.getReportMethod) == null) { + ServiceControllerGrpc.getReportMethod = + getReportMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Report")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.servicecontrol.v2.ReportRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.servicecontrol.v2.ReportResponse.getDefaultInstance())) + .setSchemaDescriptor(new ServiceControllerMethodDescriptorSupplier("Report")) + .build(); + } + } + } + return getReportMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static ServiceControllerStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ServiceControllerStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServiceControllerStub(channel, callOptions); + } + }; + return ServiceControllerStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static ServiceControllerBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ServiceControllerBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServiceControllerBlockingStub(channel, callOptions); + } + }; + return ServiceControllerBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static ServiceControllerFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ServiceControllerFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServiceControllerFutureStub(channel, callOptions); + } + }; + return ServiceControllerFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * [Service Control API v2](/service-infrastructure/docs/service-control)
+   * Private Preview. This feature is only available for approved services.
+   * This API provides admission control and telemetry reporting for services
+   * that are integrated with [Service Infrastructure](/service-infrastructure).
+   * 
+ */ + public abstract static class ServiceControllerImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Private Preview. This feature is only available for approved services.
+     * This method provides admission control for services that are integrated
+     * with [Service Infrastructure](/service-infrastructure). It checks whether
+     * an operation should be allowed based on the service configuration and
+     * relevant policies. It must be called before the operation is executed.
+     * For more information, see
+     * [Admission Control](/service-infrastructure/docs/admission-control).
+     * NOTE: The admission control has an expected policy propagation delay of
+     * 60s. The caller **must** not depend on the most recent policy changes.
+     * NOTE: The admission control has a hard limit of 1 referenced resources
+     * per call. If an operation refers to more than 1 resources, the caller
+     * must call the Check method multiple times.
+     * This method requires the `servicemanagement.services.check` permission
+     * on the specified service. For more information, see
+     * [Service Control API Access
+     * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
+     * 
+ */ + public void check( + com.google.api.servicecontrol.v2.CheckRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCheckMethod(), responseObserver); + } + + /** + * + * + *
+     * Private Preview. This feature is only available for approved services.
+     * This method provides telemetry reporting for services that are integrated
+     * with [Service Infrastructure](/service-infrastructure). It reports a list
+     * of operations that have occurred on a service. It must be called after the
+     * operations have been executed. For more information, see
+     * [Telemetry Reporting](/service-infrastructure/docs/telemetry-reporting).
+     * NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB
+     * per Report call. It is recommended to have no more than 100 operations per
+     * call.
+     * This method requires the `servicemanagement.services.report` permission
+     * on the specified service. For more information, see
+     * [Service Control API Access
+     * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
+     * 
+ */ + public void report( + com.google.api.servicecontrol.v2.ReportRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getReportMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCheckMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.servicecontrol.v2.CheckRequest, + com.google.api.servicecontrol.v2.CheckResponse>(this, METHODID_CHECK))) + .addMethod( + getReportMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.servicecontrol.v2.ReportRequest, + com.google.api.servicecontrol.v2.ReportResponse>(this, METHODID_REPORT))) + .build(); + } + } + + /** + * + * + *
+   * [Service Control API v2](/service-infrastructure/docs/service-control)
+   * Private Preview. This feature is only available for approved services.
+   * This API provides admission control and telemetry reporting for services
+   * that are integrated with [Service Infrastructure](/service-infrastructure).
+   * 
+ */ + public static final class ServiceControllerStub + extends io.grpc.stub.AbstractAsyncStub { + private ServiceControllerStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ServiceControllerStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServiceControllerStub(channel, callOptions); + } + + /** + * + * + *
+     * Private Preview. This feature is only available for approved services.
+     * This method provides admission control for services that are integrated
+     * with [Service Infrastructure](/service-infrastructure). It checks whether
+     * an operation should be allowed based on the service configuration and
+     * relevant policies. It must be called before the operation is executed.
+     * For more information, see
+     * [Admission Control](/service-infrastructure/docs/admission-control).
+     * NOTE: The admission control has an expected policy propagation delay of
+     * 60s. The caller **must** not depend on the most recent policy changes.
+     * NOTE: The admission control has a hard limit of 1 referenced resources
+     * per call. If an operation refers to more than 1 resources, the caller
+     * must call the Check method multiple times.
+     * This method requires the `servicemanagement.services.check` permission
+     * on the specified service. For more information, see
+     * [Service Control API Access
+     * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
+     * 
+ */ + public void check( + com.google.api.servicecontrol.v2.CheckRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCheckMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Private Preview. This feature is only available for approved services.
+     * This method provides telemetry reporting for services that are integrated
+     * with [Service Infrastructure](/service-infrastructure). It reports a list
+     * of operations that have occurred on a service. It must be called after the
+     * operations have been executed. For more information, see
+     * [Telemetry Reporting](/service-infrastructure/docs/telemetry-reporting).
+     * NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB
+     * per Report call. It is recommended to have no more than 100 operations per
+     * call.
+     * This method requires the `servicemanagement.services.report` permission
+     * on the specified service. For more information, see
+     * [Service Control API Access
+     * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
+     * 
+ */ + public void report( + com.google.api.servicecontrol.v2.ReportRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getReportMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + * + * + *
+   * [Service Control API v2](/service-infrastructure/docs/service-control)
+   * Private Preview. This feature is only available for approved services.
+   * This API provides admission control and telemetry reporting for services
+   * that are integrated with [Service Infrastructure](/service-infrastructure).
+   * 
+ */ + public static final class ServiceControllerBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private ServiceControllerBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ServiceControllerBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServiceControllerBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Private Preview. This feature is only available for approved services.
+     * This method provides admission control for services that are integrated
+     * with [Service Infrastructure](/service-infrastructure). It checks whether
+     * an operation should be allowed based on the service configuration and
+     * relevant policies. It must be called before the operation is executed.
+     * For more information, see
+     * [Admission Control](/service-infrastructure/docs/admission-control).
+     * NOTE: The admission control has an expected policy propagation delay of
+     * 60s. The caller **must** not depend on the most recent policy changes.
+     * NOTE: The admission control has a hard limit of 1 referenced resources
+     * per call. If an operation refers to more than 1 resources, the caller
+     * must call the Check method multiple times.
+     * This method requires the `servicemanagement.services.check` permission
+     * on the specified service. For more information, see
+     * [Service Control API Access
+     * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
+     * 
+ */ + public com.google.api.servicecontrol.v2.CheckResponse check( + com.google.api.servicecontrol.v2.CheckRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCheckMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Private Preview. This feature is only available for approved services.
+     * This method provides telemetry reporting for services that are integrated
+     * with [Service Infrastructure](/service-infrastructure). It reports a list
+     * of operations that have occurred on a service. It must be called after the
+     * operations have been executed. For more information, see
+     * [Telemetry Reporting](/service-infrastructure/docs/telemetry-reporting).
+     * NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB
+     * per Report call. It is recommended to have no more than 100 operations per
+     * call.
+     * This method requires the `servicemanagement.services.report` permission
+     * on the specified service. For more information, see
+     * [Service Control API Access
+     * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
+     * 
+ */ + public com.google.api.servicecontrol.v2.ReportResponse report( + com.google.api.servicecontrol.v2.ReportRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getReportMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * [Service Control API v2](/service-infrastructure/docs/service-control)
+   * Private Preview. This feature is only available for approved services.
+   * This API provides admission control and telemetry reporting for services
+   * that are integrated with [Service Infrastructure](/service-infrastructure).
+   * 
+ */ + public static final class ServiceControllerFutureStub + extends io.grpc.stub.AbstractFutureStub { + private ServiceControllerFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ServiceControllerFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ServiceControllerFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Private Preview. This feature is only available for approved services.
+     * This method provides admission control for services that are integrated
+     * with [Service Infrastructure](/service-infrastructure). It checks whether
+     * an operation should be allowed based on the service configuration and
+     * relevant policies. It must be called before the operation is executed.
+     * For more information, see
+     * [Admission Control](/service-infrastructure/docs/admission-control).
+     * NOTE: The admission control has an expected policy propagation delay of
+     * 60s. The caller **must** not depend on the most recent policy changes.
+     * NOTE: The admission control has a hard limit of 1 referenced resources
+     * per call. If an operation refers to more than 1 resources, the caller
+     * must call the Check method multiple times.
+     * This method requires the `servicemanagement.services.check` permission
+     * on the specified service. For more information, see
+     * [Service Control API Access
+     * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.api.servicecontrol.v2.CheckResponse> + check(com.google.api.servicecontrol.v2.CheckRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCheckMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Private Preview. This feature is only available for approved services.
+     * This method provides telemetry reporting for services that are integrated
+     * with [Service Infrastructure](/service-infrastructure). It reports a list
+     * of operations that have occurred on a service. It must be called after the
+     * operations have been executed. For more information, see
+     * [Telemetry Reporting](/service-infrastructure/docs/telemetry-reporting).
+     * NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB
+     * per Report call. It is recommended to have no more than 100 operations per
+     * call.
+     * This method requires the `servicemanagement.services.report` permission
+     * on the specified service. For more information, see
+     * [Service Control API Access
+     * Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.api.servicecontrol.v2.ReportResponse> + report(com.google.api.servicecontrol.v2.ReportRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getReportMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CHECK = 0; + private static final int METHODID_REPORT = 1; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final ServiceControllerImplBase serviceImpl; + private final int methodId; + + MethodHandlers(ServiceControllerImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CHECK: + serviceImpl.check( + (com.google.api.servicecontrol.v2.CheckRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_REPORT: + serviceImpl.report( + (com.google.api.servicecontrol.v2.ReportRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class ServiceControllerBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + ServiceControllerBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("ServiceController"); + } + } + + private static final class ServiceControllerFileDescriptorSupplier + extends ServiceControllerBaseDescriptorSupplier { + ServiceControllerFileDescriptorSupplier() {} + } + + private static final class ServiceControllerMethodDescriptorSupplier + extends ServiceControllerBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + ServiceControllerMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (ServiceControllerGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new ServiceControllerFileDescriptorSupplier()) + .addMethod(getCheckMethod()) + .addMethod(getReportMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/pom.xml b/pom.xml index 1c76b29c..3d1c316d 100644 --- a/pom.xml +++ b/pom.xml @@ -71,6 +71,16 @@ google-cloud-service-control 1.1.10-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-service-control-v2 + 1.1.9-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-service-control-v2 + 1.1.9-SNAPSHOT + com.google.api.grpc grpc-google-cloud-service-control-v1 @@ -112,7 +122,9 @@ google-cloud-service-control grpc-google-cloud-service-control-v1 + grpc-google-cloud-service-control-v2 proto-google-cloud-service-control-v1 + proto-google-cloud-service-control-v2 google-cloud-service-control-bom diff --git a/proto-google-cloud-service-control-v2/clirr-ignored-differences.xml b/proto-google-cloud-service-control-v2/clirr-ignored-differences.xml new file mode 100644 index 00000000..d842892e --- /dev/null +++ b/proto-google-cloud-service-control-v2/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/api/servicecontrol/v2/*OrBuilder + * get*(*) + + + 7012 + com/google/api/servicecontrol/v2/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/api/servicecontrol/v2/*OrBuilder + boolean has*(*) + + diff --git a/proto-google-cloud-service-control-v2/pom.xml b/proto-google-cloud-service-control-v2/pom.xml new file mode 100644 index 00000000..9c011b61 --- /dev/null +++ b/proto-google-cloud-service-control-v2/pom.xml @@ -0,0 +1,34 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-service-control-v2 + 1.1.9-SNAPSHOT + proto-google-cloud-service-control-v2 + Proto library for google-cloud-service-control + + com.google.cloud + google-cloud-service-control-parent + 1.1.10-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckRequest.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckRequest.java new file mode 100644 index 00000000..2b5fa106 --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckRequest.java @@ -0,0 +1,1806 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +/** + * + * + *
+ * Request message for the Check method.
+ * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.CheckRequest} + */ +public final class CheckRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.servicecontrol.v2.CheckRequest) + CheckRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CheckRequest.newBuilder() to construct. + private CheckRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CheckRequest() { + serviceName_ = ""; + serviceConfigId_ = ""; + resources_ = java.util.Collections.emptyList(); + flags_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CheckRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CheckRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + serviceName_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + serviceConfigId_ = s; + break; + } + case 26: + { + com.google.rpc.context.AttributeContext.Builder subBuilder = null; + if (attributes_ != null) { + subBuilder = attributes_.toBuilder(); + } + attributes_ = + input.readMessage( + com.google.rpc.context.AttributeContext.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(attributes_); + attributes_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + resources_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + resources_.add( + input.readMessage( + com.google.api.servicecontrol.v2.ResourceInfo.parser(), extensionRegistry)); + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + flags_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + resources_ = java.util.Collections.unmodifiableList(resources_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.CheckRequest.class, + com.google.api.servicecontrol.v2.CheckRequest.Builder.class); + } + + public static final int SERVICE_NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object serviceName_; + /** + * + * + *
+   * The service name as specified in its service configuration. For example,
+   * `"pubsub.googleapis.com"`.
+   * See
+   * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+   * for the definition of a service name.
+   * 
+ * + * string service_name = 1; + * + * @return The serviceName. + */ + @java.lang.Override + public java.lang.String getServiceName() { + java.lang.Object ref = serviceName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceName_ = s; + return s; + } + } + /** + * + * + *
+   * The service name as specified in its service configuration. For example,
+   * `"pubsub.googleapis.com"`.
+   * See
+   * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+   * for the definition of a service name.
+   * 
+ * + * string service_name = 1; + * + * @return The bytes for serviceName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceNameBytes() { + java.lang.Object ref = serviceName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERVICE_CONFIG_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object serviceConfigId_; + /** + * + * + *
+   * Specifies the version of the service configuration that should be used to
+   * process the request. Must not be empty. Set this field to 'latest' to
+   * specify using the latest configuration.
+   * 
+ * + * string service_config_id = 2; + * + * @return The serviceConfigId. + */ + @java.lang.Override + public java.lang.String getServiceConfigId() { + java.lang.Object ref = serviceConfigId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceConfigId_ = s; + return s; + } + } + /** + * + * + *
+   * Specifies the version of the service configuration that should be used to
+   * process the request. Must not be empty. Set this field to 'latest' to
+   * specify using the latest configuration.
+   * 
+ * + * string service_config_id = 2; + * + * @return The bytes for serviceConfigId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceConfigIdBytes() { + java.lang.Object ref = serviceConfigId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceConfigId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ATTRIBUTES_FIELD_NUMBER = 3; + private com.google.rpc.context.AttributeContext attributes_; + /** + * + * + *
+   * Describes attributes about the operation being executed by the service.
+   * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + * + * @return Whether the attributes field is set. + */ + @java.lang.Override + public boolean hasAttributes() { + return attributes_ != null; + } + /** + * + * + *
+   * Describes attributes about the operation being executed by the service.
+   * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + * + * @return The attributes. + */ + @java.lang.Override + public com.google.rpc.context.AttributeContext getAttributes() { + return attributes_ == null + ? com.google.rpc.context.AttributeContext.getDefaultInstance() + : attributes_; + } + /** + * + * + *
+   * Describes attributes about the operation being executed by the service.
+   * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + */ + @java.lang.Override + public com.google.rpc.context.AttributeContextOrBuilder getAttributesOrBuilder() { + return getAttributes(); + } + + public static final int RESOURCES_FIELD_NUMBER = 4; + private java.util.List resources_; + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + @java.lang.Override + public java.util.List getResourcesList() { + return resources_; + } + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + @java.lang.Override + public java.util.List + getResourcesOrBuilderList() { + return resources_; + } + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + @java.lang.Override + public int getResourcesCount() { + return resources_.size(); + } + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + @java.lang.Override + public com.google.api.servicecontrol.v2.ResourceInfo getResources(int index) { + return resources_.get(index); + } + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + @java.lang.Override + public com.google.api.servicecontrol.v2.ResourceInfoOrBuilder getResourcesOrBuilder(int index) { + return resources_.get(index); + } + + public static final int FLAGS_FIELD_NUMBER = 5; + private volatile java.lang.Object flags_; + /** + * + * + *
+   * Optional. Contains a comma-separated list of flags.
+   * 
+ * + * string flags = 5; + * + * @return The flags. + */ + @java.lang.Override + public java.lang.String getFlags() { + java.lang.Object ref = flags_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + flags_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Contains a comma-separated list of flags.
+   * 
+ * + * string flags = 5; + * + * @return The bytes for flags. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFlagsBytes() { + java.lang.Object ref = flags_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + flags_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, serviceName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceConfigId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, serviceConfigId_); + } + if (attributes_ != null) { + output.writeMessage(3, getAttributes()); + } + for (int i = 0; i < resources_.size(); i++) { + output.writeMessage(4, resources_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(flags_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, flags_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, serviceName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceConfigId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, serviceConfigId_); + } + if (attributes_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getAttributes()); + } + for (int i = 0; i < resources_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, resources_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(flags_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, flags_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.servicecontrol.v2.CheckRequest)) { + return super.equals(obj); + } + com.google.api.servicecontrol.v2.CheckRequest other = + (com.google.api.servicecontrol.v2.CheckRequest) obj; + + if (!getServiceName().equals(other.getServiceName())) return false; + if (!getServiceConfigId().equals(other.getServiceConfigId())) return false; + if (hasAttributes() != other.hasAttributes()) return false; + if (hasAttributes()) { + if (!getAttributes().equals(other.getAttributes())) return false; + } + if (!getResourcesList().equals(other.getResourcesList())) return false; + if (!getFlags().equals(other.getFlags())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SERVICE_NAME_FIELD_NUMBER; + hash = (53 * hash) + getServiceName().hashCode(); + hash = (37 * hash) + SERVICE_CONFIG_ID_FIELD_NUMBER; + hash = (53 * hash) + getServiceConfigId().hashCode(); + if (hasAttributes()) { + hash = (37 * hash) + ATTRIBUTES_FIELD_NUMBER; + hash = (53 * hash) + getAttributes().hashCode(); + } + if (getResourcesCount() > 0) { + hash = (37 * hash) + RESOURCES_FIELD_NUMBER; + hash = (53 * hash) + getResourcesList().hashCode(); + } + hash = (37 * hash) + FLAGS_FIELD_NUMBER; + hash = (53 * hash) + getFlags().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.CheckRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.servicecontrol.v2.CheckRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the Check method.
+   * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.CheckRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.servicecontrol.v2.CheckRequest) + com.google.api.servicecontrol.v2.CheckRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.CheckRequest.class, + com.google.api.servicecontrol.v2.CheckRequest.Builder.class); + } + + // Construct using com.google.api.servicecontrol.v2.CheckRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResourcesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + serviceName_ = ""; + + serviceConfigId_ = ""; + + if (attributesBuilder_ == null) { + attributes_ = null; + } else { + attributes_ = null; + attributesBuilder_ = null; + } + if (resourcesBuilder_ == null) { + resources_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + resourcesBuilder_.clear(); + } + flags_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckRequest_descriptor; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.CheckRequest getDefaultInstanceForType() { + return com.google.api.servicecontrol.v2.CheckRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.CheckRequest build() { + com.google.api.servicecontrol.v2.CheckRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.CheckRequest buildPartial() { + com.google.api.servicecontrol.v2.CheckRequest result = + new com.google.api.servicecontrol.v2.CheckRequest(this); + int from_bitField0_ = bitField0_; + result.serviceName_ = serviceName_; + result.serviceConfigId_ = serviceConfigId_; + if (attributesBuilder_ == null) { + result.attributes_ = attributes_; + } else { + result.attributes_ = attributesBuilder_.build(); + } + if (resourcesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + resources_ = java.util.Collections.unmodifiableList(resources_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.resources_ = resources_; + } else { + result.resources_ = resourcesBuilder_.build(); + } + result.flags_ = flags_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.servicecontrol.v2.CheckRequest) { + return mergeFrom((com.google.api.servicecontrol.v2.CheckRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.servicecontrol.v2.CheckRequest other) { + if (other == com.google.api.servicecontrol.v2.CheckRequest.getDefaultInstance()) return this; + if (!other.getServiceName().isEmpty()) { + serviceName_ = other.serviceName_; + onChanged(); + } + if (!other.getServiceConfigId().isEmpty()) { + serviceConfigId_ = other.serviceConfigId_; + onChanged(); + } + if (other.hasAttributes()) { + mergeAttributes(other.getAttributes()); + } + if (resourcesBuilder_ == null) { + if (!other.resources_.isEmpty()) { + if (resources_.isEmpty()) { + resources_ = other.resources_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResourcesIsMutable(); + resources_.addAll(other.resources_); + } + onChanged(); + } + } else { + if (!other.resources_.isEmpty()) { + if (resourcesBuilder_.isEmpty()) { + resourcesBuilder_.dispose(); + resourcesBuilder_ = null; + resources_ = other.resources_; + bitField0_ = (bitField0_ & ~0x00000001); + resourcesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResourcesFieldBuilder() + : null; + } else { + resourcesBuilder_.addAllMessages(other.resources_); + } + } + } + if (!other.getFlags().isEmpty()) { + flags_ = other.flags_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.servicecontrol.v2.CheckRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.servicecontrol.v2.CheckRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object serviceName_ = ""; + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @return The serviceName. + */ + public java.lang.String getServiceName() { + java.lang.Object ref = serviceName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @return The bytes for serviceName. + */ + public com.google.protobuf.ByteString getServiceNameBytes() { + java.lang.Object ref = serviceName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @param value The serviceName to set. + * @return This builder for chaining. + */ + public Builder setServiceName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @return This builder for chaining. + */ + public Builder clearServiceName() { + + serviceName_ = getDefaultInstance().getServiceName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @param value The bytes for serviceName to set. + * @return This builder for chaining. + */ + public Builder setServiceNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceName_ = value; + onChanged(); + return this; + } + + private java.lang.Object serviceConfigId_ = ""; + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @return The serviceConfigId. + */ + public java.lang.String getServiceConfigId() { + java.lang.Object ref = serviceConfigId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceConfigId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @return The bytes for serviceConfigId. + */ + public com.google.protobuf.ByteString getServiceConfigIdBytes() { + java.lang.Object ref = serviceConfigId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceConfigId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @param value The serviceConfigId to set. + * @return This builder for chaining. + */ + public Builder setServiceConfigId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceConfigId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @return This builder for chaining. + */ + public Builder clearServiceConfigId() { + + serviceConfigId_ = getDefaultInstance().getServiceConfigId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @param value The bytes for serviceConfigId to set. + * @return This builder for chaining. + */ + public Builder setServiceConfigIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceConfigId_ = value; + onChanged(); + return this; + } + + private com.google.rpc.context.AttributeContext attributes_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.context.AttributeContext, + com.google.rpc.context.AttributeContext.Builder, + com.google.rpc.context.AttributeContextOrBuilder> + attributesBuilder_; + /** + * + * + *
+     * Describes attributes about the operation being executed by the service.
+     * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + * + * @return Whether the attributes field is set. + */ + public boolean hasAttributes() { + return attributesBuilder_ != null || attributes_ != null; + } + /** + * + * + *
+     * Describes attributes about the operation being executed by the service.
+     * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + * + * @return The attributes. + */ + public com.google.rpc.context.AttributeContext getAttributes() { + if (attributesBuilder_ == null) { + return attributes_ == null + ? com.google.rpc.context.AttributeContext.getDefaultInstance() + : attributes_; + } else { + return attributesBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Describes attributes about the operation being executed by the service.
+     * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + */ + public Builder setAttributes(com.google.rpc.context.AttributeContext value) { + if (attributesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + attributes_ = value; + onChanged(); + } else { + attributesBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Describes attributes about the operation being executed by the service.
+     * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + */ + public Builder setAttributes(com.google.rpc.context.AttributeContext.Builder builderForValue) { + if (attributesBuilder_ == null) { + attributes_ = builderForValue.build(); + onChanged(); + } else { + attributesBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Describes attributes about the operation being executed by the service.
+     * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + */ + public Builder mergeAttributes(com.google.rpc.context.AttributeContext value) { + if (attributesBuilder_ == null) { + if (attributes_ != null) { + attributes_ = + com.google.rpc.context.AttributeContext.newBuilder(attributes_) + .mergeFrom(value) + .buildPartial(); + } else { + attributes_ = value; + } + onChanged(); + } else { + attributesBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Describes attributes about the operation being executed by the service.
+     * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + */ + public Builder clearAttributes() { + if (attributesBuilder_ == null) { + attributes_ = null; + onChanged(); + } else { + attributes_ = null; + attributesBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Describes attributes about the operation being executed by the service.
+     * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + */ + public com.google.rpc.context.AttributeContext.Builder getAttributesBuilder() { + + onChanged(); + return getAttributesFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Describes attributes about the operation being executed by the service.
+     * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + */ + public com.google.rpc.context.AttributeContextOrBuilder getAttributesOrBuilder() { + if (attributesBuilder_ != null) { + return attributesBuilder_.getMessageOrBuilder(); + } else { + return attributes_ == null + ? com.google.rpc.context.AttributeContext.getDefaultInstance() + : attributes_; + } + } + /** + * + * + *
+     * Describes attributes about the operation being executed by the service.
+     * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.context.AttributeContext, + com.google.rpc.context.AttributeContext.Builder, + com.google.rpc.context.AttributeContextOrBuilder> + getAttributesFieldBuilder() { + if (attributesBuilder_ == null) { + attributesBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.context.AttributeContext, + com.google.rpc.context.AttributeContext.Builder, + com.google.rpc.context.AttributeContextOrBuilder>( + getAttributes(), getParentForChildren(), isClean()); + attributes_ = null; + } + return attributesBuilder_; + } + + private java.util.List resources_ = + java.util.Collections.emptyList(); + + private void ensureResourcesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + resources_ = + new java.util.ArrayList(resources_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.servicecontrol.v2.ResourceInfo, + com.google.api.servicecontrol.v2.ResourceInfo.Builder, + com.google.api.servicecontrol.v2.ResourceInfoOrBuilder> + resourcesBuilder_; + + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public java.util.List getResourcesList() { + if (resourcesBuilder_ == null) { + return java.util.Collections.unmodifiableList(resources_); + } else { + return resourcesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public int getResourcesCount() { + if (resourcesBuilder_ == null) { + return resources_.size(); + } else { + return resourcesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public com.google.api.servicecontrol.v2.ResourceInfo getResources(int index) { + if (resourcesBuilder_ == null) { + return resources_.get(index); + } else { + return resourcesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public Builder setResources(int index, com.google.api.servicecontrol.v2.ResourceInfo value) { + if (resourcesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResourcesIsMutable(); + resources_.set(index, value); + onChanged(); + } else { + resourcesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public Builder setResources( + int index, com.google.api.servicecontrol.v2.ResourceInfo.Builder builderForValue) { + if (resourcesBuilder_ == null) { + ensureResourcesIsMutable(); + resources_.set(index, builderForValue.build()); + onChanged(); + } else { + resourcesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public Builder addResources(com.google.api.servicecontrol.v2.ResourceInfo value) { + if (resourcesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResourcesIsMutable(); + resources_.add(value); + onChanged(); + } else { + resourcesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public Builder addResources(int index, com.google.api.servicecontrol.v2.ResourceInfo value) { + if (resourcesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResourcesIsMutable(); + resources_.add(index, value); + onChanged(); + } else { + resourcesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public Builder addResources( + com.google.api.servicecontrol.v2.ResourceInfo.Builder builderForValue) { + if (resourcesBuilder_ == null) { + ensureResourcesIsMutable(); + resources_.add(builderForValue.build()); + onChanged(); + } else { + resourcesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public Builder addResources( + int index, com.google.api.servicecontrol.v2.ResourceInfo.Builder builderForValue) { + if (resourcesBuilder_ == null) { + ensureResourcesIsMutable(); + resources_.add(index, builderForValue.build()); + onChanged(); + } else { + resourcesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public Builder addAllResources( + java.lang.Iterable values) { + if (resourcesBuilder_ == null) { + ensureResourcesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, resources_); + onChanged(); + } else { + resourcesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public Builder clearResources() { + if (resourcesBuilder_ == null) { + resources_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resourcesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public Builder removeResources(int index) { + if (resourcesBuilder_ == null) { + ensureResourcesIsMutable(); + resources_.remove(index); + onChanged(); + } else { + resourcesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public com.google.api.servicecontrol.v2.ResourceInfo.Builder getResourcesBuilder(int index) { + return getResourcesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public com.google.api.servicecontrol.v2.ResourceInfoOrBuilder getResourcesOrBuilder(int index) { + if (resourcesBuilder_ == null) { + return resources_.get(index); + } else { + return resourcesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public java.util.List + getResourcesOrBuilderList() { + if (resourcesBuilder_ != null) { + return resourcesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(resources_); + } + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public com.google.api.servicecontrol.v2.ResourceInfo.Builder addResourcesBuilder() { + return getResourcesFieldBuilder() + .addBuilder(com.google.api.servicecontrol.v2.ResourceInfo.getDefaultInstance()); + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public com.google.api.servicecontrol.v2.ResourceInfo.Builder addResourcesBuilder(int index) { + return getResourcesFieldBuilder() + .addBuilder(index, com.google.api.servicecontrol.v2.ResourceInfo.getDefaultInstance()); + } + /** + * + * + *
+     * Describes the resources and the policies applied to each resource.
+     * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + public java.util.List + getResourcesBuilderList() { + return getResourcesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.servicecontrol.v2.ResourceInfo, + com.google.api.servicecontrol.v2.ResourceInfo.Builder, + com.google.api.servicecontrol.v2.ResourceInfoOrBuilder> + getResourcesFieldBuilder() { + if (resourcesBuilder_ == null) { + resourcesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.servicecontrol.v2.ResourceInfo, + com.google.api.servicecontrol.v2.ResourceInfo.Builder, + com.google.api.servicecontrol.v2.ResourceInfoOrBuilder>( + resources_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + resources_ = null; + } + return resourcesBuilder_; + } + + private java.lang.Object flags_ = ""; + /** + * + * + *
+     * Optional. Contains a comma-separated list of flags.
+     * 
+ * + * string flags = 5; + * + * @return The flags. + */ + public java.lang.String getFlags() { + java.lang.Object ref = flags_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + flags_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Contains a comma-separated list of flags.
+     * 
+ * + * string flags = 5; + * + * @return The bytes for flags. + */ + public com.google.protobuf.ByteString getFlagsBytes() { + java.lang.Object ref = flags_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + flags_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Contains a comma-separated list of flags.
+     * 
+ * + * string flags = 5; + * + * @param value The flags to set. + * @return This builder for chaining. + */ + public Builder setFlags(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + flags_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Contains a comma-separated list of flags.
+     * 
+ * + * string flags = 5; + * + * @return This builder for chaining. + */ + public Builder clearFlags() { + + flags_ = getDefaultInstance().getFlags(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Contains a comma-separated list of flags.
+     * 
+ * + * string flags = 5; + * + * @param value The bytes for flags to set. + * @return This builder for chaining. + */ + public Builder setFlagsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + flags_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.servicecontrol.v2.CheckRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.servicecontrol.v2.CheckRequest) + private static final com.google.api.servicecontrol.v2.CheckRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.servicecontrol.v2.CheckRequest(); + } + + public static com.google.api.servicecontrol.v2.CheckRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CheckRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CheckRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.CheckRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckRequestOrBuilder.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckRequestOrBuilder.java new file mode 100644 index 00000000..3798be87 --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckRequestOrBuilder.java @@ -0,0 +1,199 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +public interface CheckRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.servicecontrol.v2.CheckRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The service name as specified in its service configuration. For example,
+   * `"pubsub.googleapis.com"`.
+   * See
+   * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+   * for the definition of a service name.
+   * 
+ * + * string service_name = 1; + * + * @return The serviceName. + */ + java.lang.String getServiceName(); + /** + * + * + *
+   * The service name as specified in its service configuration. For example,
+   * `"pubsub.googleapis.com"`.
+   * See
+   * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+   * for the definition of a service name.
+   * 
+ * + * string service_name = 1; + * + * @return The bytes for serviceName. + */ + com.google.protobuf.ByteString getServiceNameBytes(); + + /** + * + * + *
+   * Specifies the version of the service configuration that should be used to
+   * process the request. Must not be empty. Set this field to 'latest' to
+   * specify using the latest configuration.
+   * 
+ * + * string service_config_id = 2; + * + * @return The serviceConfigId. + */ + java.lang.String getServiceConfigId(); + /** + * + * + *
+   * Specifies the version of the service configuration that should be used to
+   * process the request. Must not be empty. Set this field to 'latest' to
+   * specify using the latest configuration.
+   * 
+ * + * string service_config_id = 2; + * + * @return The bytes for serviceConfigId. + */ + com.google.protobuf.ByteString getServiceConfigIdBytes(); + + /** + * + * + *
+   * Describes attributes about the operation being executed by the service.
+   * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + * + * @return Whether the attributes field is set. + */ + boolean hasAttributes(); + /** + * + * + *
+   * Describes attributes about the operation being executed by the service.
+   * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + * + * @return The attributes. + */ + com.google.rpc.context.AttributeContext getAttributes(); + /** + * + * + *
+   * Describes attributes about the operation being executed by the service.
+   * 
+ * + * .google.rpc.context.AttributeContext attributes = 3; + */ + com.google.rpc.context.AttributeContextOrBuilder getAttributesOrBuilder(); + + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + java.util.List getResourcesList(); + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + com.google.api.servicecontrol.v2.ResourceInfo getResources(int index); + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + int getResourcesCount(); + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + java.util.List + getResourcesOrBuilderList(); + /** + * + * + *
+   * Describes the resources and the policies applied to each resource.
+   * 
+ * + * repeated .google.api.servicecontrol.v2.ResourceInfo resources = 4; + */ + com.google.api.servicecontrol.v2.ResourceInfoOrBuilder getResourcesOrBuilder(int index); + + /** + * + * + *
+   * Optional. Contains a comma-separated list of flags.
+   * 
+ * + * string flags = 5; + * + * @return The flags. + */ + java.lang.String getFlags(); + /** + * + * + *
+   * Optional. Contains a comma-separated list of flags.
+   * 
+ * + * string flags = 5; + * + * @return The bytes for flags. + */ + com.google.protobuf.ByteString getFlagsBytes(); +} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckResponse.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckResponse.java new file mode 100644 index 00000000..0e033530 --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckResponse.java @@ -0,0 +1,1064 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +/** + * + * + *
+ * Response message for the Check method.
+ * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.CheckResponse} + */ +public final class CheckResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.servicecontrol.v2.CheckResponse) + CheckResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use CheckResponse.newBuilder() to construct. + private CheckResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CheckResponse() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CheckResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CheckResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.rpc.Status.Builder subBuilder = null; + if (status_ != null) { + subBuilder = status_.toBuilder(); + } + status_ = input.readMessage(com.google.rpc.Status.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(status_); + status_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + headers_ = + com.google.protobuf.MapField.newMapField( + HeadersDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry headers__ = + input.readMessage( + HeadersDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + headers_.getMutableMap().put(headers__.getKey(), headers__.getValue()); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckResponse_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 2: + return internalGetHeaders(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.CheckResponse.class, + com.google.api.servicecontrol.v2.CheckResponse.Builder.class); + } + + public static final int STATUS_FIELD_NUMBER = 1; + private com.google.rpc.Status status_; + /** + * + * + *
+   * Operation is allowed when this field is not set. Any non-'OK' status
+   * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+   * would contain additional details about the denial.
+   * 
+ * + * .google.rpc.Status status = 1; + * + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return status_ != null; + } + /** + * + * + *
+   * Operation is allowed when this field is not set. Any non-'OK' status
+   * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+   * would contain additional details about the denial.
+   * 
+ * + * .google.rpc.Status status = 1; + * + * @return The status. + */ + @java.lang.Override + public com.google.rpc.Status getStatus() { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + /** + * + * + *
+   * Operation is allowed when this field is not set. Any non-'OK' status
+   * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+   * would contain additional details about the denial.
+   * 
+ * + * .google.rpc.Status status = 1; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + return getStatus(); + } + + public static final int HEADERS_FIELD_NUMBER = 2; + + private static final class HeadersDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckResponse_HeadersEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField headers_; + + private com.google.protobuf.MapField internalGetHeaders() { + if (headers_ == null) { + return com.google.protobuf.MapField.emptyMapField(HeadersDefaultEntryHolder.defaultEntry); + } + return headers_; + } + + public int getHeadersCount() { + return internalGetHeaders().getMap().size(); + } + /** + * + * + *
+   * Returns a set of request contexts generated from the `CheckRequest`.
+   * 
+ * + * map<string, string> headers = 2; + */ + @java.lang.Override + public boolean containsHeaders(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetHeaders().getMap().containsKey(key); + } + /** Use {@link #getHeadersMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getHeaders() { + return getHeadersMap(); + } + /** + * + * + *
+   * Returns a set of request contexts generated from the `CheckRequest`.
+   * 
+ * + * map<string, string> headers = 2; + */ + @java.lang.Override + public java.util.Map getHeadersMap() { + return internalGetHeaders().getMap(); + } + /** + * + * + *
+   * Returns a set of request contexts generated from the `CheckRequest`.
+   * 
+ * + * map<string, string> headers = 2; + */ + @java.lang.Override + public java.lang.String getHeadersOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetHeaders().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Returns a set of request contexts generated from the `CheckRequest`.
+   * 
+ * + * map<string, string> headers = 2; + */ + @java.lang.Override + public java.lang.String getHeadersOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetHeaders().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (status_ != null) { + output.writeMessage(1, getStatus()); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetHeaders(), HeadersDefaultEntryHolder.defaultEntry, 2); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (status_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getStatus()); + } + for (java.util.Map.Entry entry : + internalGetHeaders().getMap().entrySet()) { + com.google.protobuf.MapEntry headers__ = + HeadersDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, headers__); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.servicecontrol.v2.CheckResponse)) { + return super.equals(obj); + } + com.google.api.servicecontrol.v2.CheckResponse other = + (com.google.api.servicecontrol.v2.CheckResponse) obj; + + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus().equals(other.getStatus())) return false; + } + if (!internalGetHeaders().equals(other.internalGetHeaders())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + if (!internalGetHeaders().getMap().isEmpty()) { + hash = (37 * hash) + HEADERS_FIELD_NUMBER; + hash = (53 * hash) + internalGetHeaders().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.CheckResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.servicecontrol.v2.CheckResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for the Check method.
+   * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.CheckResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.servicecontrol.v2.CheckResponse) + com.google.api.servicecontrol.v2.CheckResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckResponse_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 2: + return internalGetHeaders(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 2: + return internalGetMutableHeaders(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.CheckResponse.class, + com.google.api.servicecontrol.v2.CheckResponse.Builder.class); + } + + // Construct using com.google.api.servicecontrol.v2.CheckResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (statusBuilder_ == null) { + status_ = null; + } else { + status_ = null; + statusBuilder_ = null; + } + internalGetMutableHeaders().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_CheckResponse_descriptor; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.CheckResponse getDefaultInstanceForType() { + return com.google.api.servicecontrol.v2.CheckResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.CheckResponse build() { + com.google.api.servicecontrol.v2.CheckResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.CheckResponse buildPartial() { + com.google.api.servicecontrol.v2.CheckResponse result = + new com.google.api.servicecontrol.v2.CheckResponse(this); + int from_bitField0_ = bitField0_; + if (statusBuilder_ == null) { + result.status_ = status_; + } else { + result.status_ = statusBuilder_.build(); + } + result.headers_ = internalGetHeaders(); + result.headers_.makeImmutable(); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.servicecontrol.v2.CheckResponse) { + return mergeFrom((com.google.api.servicecontrol.v2.CheckResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.servicecontrol.v2.CheckResponse other) { + if (other == com.google.api.servicecontrol.v2.CheckResponse.getDefaultInstance()) return this; + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + internalGetMutableHeaders().mergeFrom(other.internalGetHeaders()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.servicecontrol.v2.CheckResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.servicecontrol.v2.CheckResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.rpc.Status status_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + statusBuilder_; + /** + * + * + *
+     * Operation is allowed when this field is not set. Any non-'OK' status
+     * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+     * would contain additional details about the denial.
+     * 
+ * + * .google.rpc.Status status = 1; + * + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return statusBuilder_ != null || status_ != null; + } + /** + * + * + *
+     * Operation is allowed when this field is not set. Any non-'OK' status
+     * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+     * would contain additional details about the denial.
+     * 
+ * + * .google.rpc.Status status = 1; + * + * @return The status. + */ + public com.google.rpc.Status getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Operation is allowed when this field is not set. Any non-'OK' status
+     * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+     * would contain additional details about the denial.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public Builder setStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + onChanged(); + } else { + statusBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Operation is allowed when this field is not set. Any non-'OK' status
+     * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+     * would contain additional details about the denial.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public Builder setStatus(com.google.rpc.Status.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + onChanged(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Operation is allowed when this field is not set. Any non-'OK' status
+     * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+     * would contain additional details about the denial.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public Builder mergeStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (status_ != null) { + status_ = com.google.rpc.Status.newBuilder(status_).mergeFrom(value).buildPartial(); + } else { + status_ = value; + } + onChanged(); + } else { + statusBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Operation is allowed when this field is not set. Any non-'OK' status
+     * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+     * would contain additional details about the denial.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public Builder clearStatus() { + if (statusBuilder_ == null) { + status_ = null; + onChanged(); + } else { + status_ = null; + statusBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Operation is allowed when this field is not set. Any non-'OK' status
+     * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+     * would contain additional details about the denial.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public com.google.rpc.Status.Builder getStatusBuilder() { + + onChanged(); + return getStatusFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Operation is allowed when this field is not set. Any non-'OK' status
+     * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+     * would contain additional details about the denial.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + } + /** + * + * + *
+     * Operation is allowed when this field is not set. Any non-'OK' status
+     * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+     * would contain additional details about the denial.
+     * 
+ * + * .google.rpc.Status status = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>(getStatus(), getParentForChildren(), isClean()); + status_ = null; + } + return statusBuilder_; + } + + private com.google.protobuf.MapField headers_; + + private com.google.protobuf.MapField internalGetHeaders() { + if (headers_ == null) { + return com.google.protobuf.MapField.emptyMapField(HeadersDefaultEntryHolder.defaultEntry); + } + return headers_; + } + + private com.google.protobuf.MapField + internalGetMutableHeaders() { + onChanged(); + ; + if (headers_ == null) { + headers_ = com.google.protobuf.MapField.newMapField(HeadersDefaultEntryHolder.defaultEntry); + } + if (!headers_.isMutable()) { + headers_ = headers_.copy(); + } + return headers_; + } + + public int getHeadersCount() { + return internalGetHeaders().getMap().size(); + } + /** + * + * + *
+     * Returns a set of request contexts generated from the `CheckRequest`.
+     * 
+ * + * map<string, string> headers = 2; + */ + @java.lang.Override + public boolean containsHeaders(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetHeaders().getMap().containsKey(key); + } + /** Use {@link #getHeadersMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getHeaders() { + return getHeadersMap(); + } + /** + * + * + *
+     * Returns a set of request contexts generated from the `CheckRequest`.
+     * 
+ * + * map<string, string> headers = 2; + */ + @java.lang.Override + public java.util.Map getHeadersMap() { + return internalGetHeaders().getMap(); + } + /** + * + * + *
+     * Returns a set of request contexts generated from the `CheckRequest`.
+     * 
+ * + * map<string, string> headers = 2; + */ + @java.lang.Override + public java.lang.String getHeadersOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetHeaders().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Returns a set of request contexts generated from the `CheckRequest`.
+     * 
+ * + * map<string, string> headers = 2; + */ + @java.lang.Override + public java.lang.String getHeadersOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetHeaders().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearHeaders() { + internalGetMutableHeaders().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Returns a set of request contexts generated from the `CheckRequest`.
+     * 
+ * + * map<string, string> headers = 2; + */ + public Builder removeHeaders(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableHeaders().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableHeaders() { + return internalGetMutableHeaders().getMutableMap(); + } + /** + * + * + *
+     * Returns a set of request contexts generated from the `CheckRequest`.
+     * 
+ * + * map<string, string> headers = 2; + */ + public Builder putHeaders(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableHeaders().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Returns a set of request contexts generated from the `CheckRequest`.
+     * 
+ * + * map<string, string> headers = 2; + */ + public Builder putAllHeaders(java.util.Map values) { + internalGetMutableHeaders().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.servicecontrol.v2.CheckResponse) + } + + // @@protoc_insertion_point(class_scope:google.api.servicecontrol.v2.CheckResponse) + private static final com.google.api.servicecontrol.v2.CheckResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.servicecontrol.v2.CheckResponse(); + } + + public static com.google.api.servicecontrol.v2.CheckResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CheckResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CheckResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.CheckResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckResponseOrBuilder.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckResponseOrBuilder.java new file mode 100644 index 00000000..75d9479d --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/CheckResponseOrBuilder.java @@ -0,0 +1,120 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +public interface CheckResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.servicecontrol.v2.CheckResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Operation is allowed when this field is not set. Any non-'OK' status
+   * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+   * would contain additional details about the denial.
+   * 
+ * + * .google.rpc.Status status = 1; + * + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + * + * + *
+   * Operation is allowed when this field is not set. Any non-'OK' status
+   * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+   * would contain additional details about the denial.
+   * 
+ * + * .google.rpc.Status status = 1; + * + * @return The status. + */ + com.google.rpc.Status getStatus(); + /** + * + * + *
+   * Operation is allowed when this field is not set. Any non-'OK' status
+   * indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
+   * would contain additional details about the denial.
+   * 
+ * + * .google.rpc.Status status = 1; + */ + com.google.rpc.StatusOrBuilder getStatusOrBuilder(); + + /** + * + * + *
+   * Returns a set of request contexts generated from the `CheckRequest`.
+   * 
+ * + * map<string, string> headers = 2; + */ + int getHeadersCount(); + /** + * + * + *
+   * Returns a set of request contexts generated from the `CheckRequest`.
+   * 
+ * + * map<string, string> headers = 2; + */ + boolean containsHeaders(java.lang.String key); + /** Use {@link #getHeadersMap()} instead. */ + @java.lang.Deprecated + java.util.Map getHeaders(); + /** + * + * + *
+   * Returns a set of request contexts generated from the `CheckRequest`.
+   * 
+ * + * map<string, string> headers = 2; + */ + java.util.Map getHeadersMap(); + /** + * + * + *
+   * Returns a set of request contexts generated from the `CheckRequest`.
+   * 
+ * + * map<string, string> headers = 2; + */ + java.lang.String getHeadersOrDefault(java.lang.String key, java.lang.String defaultValue); + /** + * + * + *
+   * Returns a set of request contexts generated from the `CheckRequest`.
+   * 
+ * + * map<string, string> headers = 2; + */ + java.lang.String getHeadersOrThrow(java.lang.String key); +} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportRequest.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportRequest.java new file mode 100644 index 00000000..7c7437ae --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportRequest.java @@ -0,0 +1,1393 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +/** + * + * + *
+ * Request message for the Report method.
+ * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.ReportRequest} + */ +public final class ReportRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.servicecontrol.v2.ReportRequest) + ReportRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReportRequest.newBuilder() to construct. + private ReportRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReportRequest() { + serviceName_ = ""; + serviceConfigId_ = ""; + operations_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReportRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ReportRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + serviceName_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + serviceConfigId_ = s; + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + operations_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + operations_.add( + input.readMessage( + com.google.rpc.context.AttributeContext.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + operations_ = java.util.Collections.unmodifiableList(operations_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.ReportRequest.class, + com.google.api.servicecontrol.v2.ReportRequest.Builder.class); + } + + public static final int SERVICE_NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object serviceName_; + /** + * + * + *
+   * The service name as specified in its service configuration. For example,
+   * `"pubsub.googleapis.com"`.
+   * See
+   * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+   * for the definition of a service name.
+   * 
+ * + * string service_name = 1; + * + * @return The serviceName. + */ + @java.lang.Override + public java.lang.String getServiceName() { + java.lang.Object ref = serviceName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceName_ = s; + return s; + } + } + /** + * + * + *
+   * The service name as specified in its service configuration. For example,
+   * `"pubsub.googleapis.com"`.
+   * See
+   * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+   * for the definition of a service name.
+   * 
+ * + * string service_name = 1; + * + * @return The bytes for serviceName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceNameBytes() { + java.lang.Object ref = serviceName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERVICE_CONFIG_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object serviceConfigId_; + /** + * + * + *
+   * Specifies the version of the service configuration that should be used to
+   * process the request. Must not be empty. Set this field to 'latest' to
+   * specify using the latest configuration.
+   * 
+ * + * string service_config_id = 2; + * + * @return The serviceConfigId. + */ + @java.lang.Override + public java.lang.String getServiceConfigId() { + java.lang.Object ref = serviceConfigId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceConfigId_ = s; + return s; + } + } + /** + * + * + *
+   * Specifies the version of the service configuration that should be used to
+   * process the request. Must not be empty. Set this field to 'latest' to
+   * specify using the latest configuration.
+   * 
+ * + * string service_config_id = 2; + * + * @return The bytes for serviceConfigId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceConfigIdBytes() { + java.lang.Object ref = serviceConfigId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceConfigId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int OPERATIONS_FIELD_NUMBER = 3; + private java.util.List operations_; + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + @java.lang.Override + public java.util.List getOperationsList() { + return operations_; + } + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + @java.lang.Override + public java.util.List + getOperationsOrBuilderList() { + return operations_; + } + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + @java.lang.Override + public int getOperationsCount() { + return operations_.size(); + } + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + @java.lang.Override + public com.google.rpc.context.AttributeContext getOperations(int index) { + return operations_.get(index); + } + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + @java.lang.Override + public com.google.rpc.context.AttributeContextOrBuilder getOperationsOrBuilder(int index) { + return operations_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, serviceName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceConfigId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, serviceConfigId_); + } + for (int i = 0; i < operations_.size(); i++) { + output.writeMessage(3, operations_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, serviceName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceConfigId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, serviceConfigId_); + } + for (int i = 0; i < operations_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, operations_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.servicecontrol.v2.ReportRequest)) { + return super.equals(obj); + } + com.google.api.servicecontrol.v2.ReportRequest other = + (com.google.api.servicecontrol.v2.ReportRequest) obj; + + if (!getServiceName().equals(other.getServiceName())) return false; + if (!getServiceConfigId().equals(other.getServiceConfigId())) return false; + if (!getOperationsList().equals(other.getOperationsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SERVICE_NAME_FIELD_NUMBER; + hash = (53 * hash) + getServiceName().hashCode(); + hash = (37 * hash) + SERVICE_CONFIG_ID_FIELD_NUMBER; + hash = (53 * hash) + getServiceConfigId().hashCode(); + if (getOperationsCount() > 0) { + hash = (37 * hash) + OPERATIONS_FIELD_NUMBER; + hash = (53 * hash) + getOperationsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.ReportRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.servicecontrol.v2.ReportRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for the Report method.
+   * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.ReportRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.servicecontrol.v2.ReportRequest) + com.google.api.servicecontrol.v2.ReportRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.ReportRequest.class, + com.google.api.servicecontrol.v2.ReportRequest.Builder.class); + } + + // Construct using com.google.api.servicecontrol.v2.ReportRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getOperationsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + serviceName_ = ""; + + serviceConfigId_ = ""; + + if (operationsBuilder_ == null) { + operations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + operationsBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportRequest_descriptor; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ReportRequest getDefaultInstanceForType() { + return com.google.api.servicecontrol.v2.ReportRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ReportRequest build() { + com.google.api.servicecontrol.v2.ReportRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ReportRequest buildPartial() { + com.google.api.servicecontrol.v2.ReportRequest result = + new com.google.api.servicecontrol.v2.ReportRequest(this); + int from_bitField0_ = bitField0_; + result.serviceName_ = serviceName_; + result.serviceConfigId_ = serviceConfigId_; + if (operationsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + operations_ = java.util.Collections.unmodifiableList(operations_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.operations_ = operations_; + } else { + result.operations_ = operationsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.servicecontrol.v2.ReportRequest) { + return mergeFrom((com.google.api.servicecontrol.v2.ReportRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.servicecontrol.v2.ReportRequest other) { + if (other == com.google.api.servicecontrol.v2.ReportRequest.getDefaultInstance()) return this; + if (!other.getServiceName().isEmpty()) { + serviceName_ = other.serviceName_; + onChanged(); + } + if (!other.getServiceConfigId().isEmpty()) { + serviceConfigId_ = other.serviceConfigId_; + onChanged(); + } + if (operationsBuilder_ == null) { + if (!other.operations_.isEmpty()) { + if (operations_.isEmpty()) { + operations_ = other.operations_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureOperationsIsMutable(); + operations_.addAll(other.operations_); + } + onChanged(); + } + } else { + if (!other.operations_.isEmpty()) { + if (operationsBuilder_.isEmpty()) { + operationsBuilder_.dispose(); + operationsBuilder_ = null; + operations_ = other.operations_; + bitField0_ = (bitField0_ & ~0x00000001); + operationsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getOperationsFieldBuilder() + : null; + } else { + operationsBuilder_.addAllMessages(other.operations_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.servicecontrol.v2.ReportRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.servicecontrol.v2.ReportRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object serviceName_ = ""; + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @return The serviceName. + */ + public java.lang.String getServiceName() { + java.lang.Object ref = serviceName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @return The bytes for serviceName. + */ + public com.google.protobuf.ByteString getServiceNameBytes() { + java.lang.Object ref = serviceName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @param value The serviceName to set. + * @return This builder for chaining. + */ + public Builder setServiceName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @return This builder for chaining. + */ + public Builder clearServiceName() { + + serviceName_ = getDefaultInstance().getServiceName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The service name as specified in its service configuration. For example,
+     * `"pubsub.googleapis.com"`.
+     * See
+     * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+     * for the definition of a service name.
+     * 
+ * + * string service_name = 1; + * + * @param value The bytes for serviceName to set. + * @return This builder for chaining. + */ + public Builder setServiceNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceName_ = value; + onChanged(); + return this; + } + + private java.lang.Object serviceConfigId_ = ""; + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @return The serviceConfigId. + */ + public java.lang.String getServiceConfigId() { + java.lang.Object ref = serviceConfigId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceConfigId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @return The bytes for serviceConfigId. + */ + public com.google.protobuf.ByteString getServiceConfigIdBytes() { + java.lang.Object ref = serviceConfigId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceConfigId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @param value The serviceConfigId to set. + * @return This builder for chaining. + */ + public Builder setServiceConfigId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceConfigId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @return This builder for chaining. + */ + public Builder clearServiceConfigId() { + + serviceConfigId_ = getDefaultInstance().getServiceConfigId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the version of the service configuration that should be used to
+     * process the request. Must not be empty. Set this field to 'latest' to
+     * specify using the latest configuration.
+     * 
+ * + * string service_config_id = 2; + * + * @param value The bytes for serviceConfigId to set. + * @return This builder for chaining. + */ + public Builder setServiceConfigIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceConfigId_ = value; + onChanged(); + return this; + } + + private java.util.List operations_ = + java.util.Collections.emptyList(); + + private void ensureOperationsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + operations_ = new java.util.ArrayList(operations_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.context.AttributeContext, + com.google.rpc.context.AttributeContext.Builder, + com.google.rpc.context.AttributeContextOrBuilder> + operationsBuilder_; + + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public java.util.List getOperationsList() { + if (operationsBuilder_ == null) { + return java.util.Collections.unmodifiableList(operations_); + } else { + return operationsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public int getOperationsCount() { + if (operationsBuilder_ == null) { + return operations_.size(); + } else { + return operationsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public com.google.rpc.context.AttributeContext getOperations(int index) { + if (operationsBuilder_ == null) { + return operations_.get(index); + } else { + return operationsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public Builder setOperations(int index, com.google.rpc.context.AttributeContext value) { + if (operationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOperationsIsMutable(); + operations_.set(index, value); + onChanged(); + } else { + operationsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public Builder setOperations( + int index, com.google.rpc.context.AttributeContext.Builder builderForValue) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + operations_.set(index, builderForValue.build()); + onChanged(); + } else { + operationsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public Builder addOperations(com.google.rpc.context.AttributeContext value) { + if (operationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOperationsIsMutable(); + operations_.add(value); + onChanged(); + } else { + operationsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public Builder addOperations(int index, com.google.rpc.context.AttributeContext value) { + if (operationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOperationsIsMutable(); + operations_.add(index, value); + onChanged(); + } else { + operationsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public Builder addOperations(com.google.rpc.context.AttributeContext.Builder builderForValue) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + operations_.add(builderForValue.build()); + onChanged(); + } else { + operationsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public Builder addOperations( + int index, com.google.rpc.context.AttributeContext.Builder builderForValue) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + operations_.add(index, builderForValue.build()); + onChanged(); + } else { + operationsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public Builder addAllOperations( + java.lang.Iterable values) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, operations_); + onChanged(); + } else { + operationsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public Builder clearOperations() { + if (operationsBuilder_ == null) { + operations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + operationsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public Builder removeOperations(int index) { + if (operationsBuilder_ == null) { + ensureOperationsIsMutable(); + operations_.remove(index); + onChanged(); + } else { + operationsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public com.google.rpc.context.AttributeContext.Builder getOperationsBuilder(int index) { + return getOperationsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public com.google.rpc.context.AttributeContextOrBuilder getOperationsOrBuilder(int index) { + if (operationsBuilder_ == null) { + return operations_.get(index); + } else { + return operationsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public java.util.List + getOperationsOrBuilderList() { + if (operationsBuilder_ != null) { + return operationsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(operations_); + } + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public com.google.rpc.context.AttributeContext.Builder addOperationsBuilder() { + return getOperationsFieldBuilder() + .addBuilder(com.google.rpc.context.AttributeContext.getDefaultInstance()); + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public com.google.rpc.context.AttributeContext.Builder addOperationsBuilder(int index) { + return getOperationsFieldBuilder() + .addBuilder(index, com.google.rpc.context.AttributeContext.getDefaultInstance()); + } + /** + * + * + *
+     * Describes the list of operations to be reported. Each operation is
+     * represented as an AttributeContext, and contains all attributes around an
+     * API access.
+     * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + public java.util.List + getOperationsBuilderList() { + return getOperationsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.context.AttributeContext, + com.google.rpc.context.AttributeContext.Builder, + com.google.rpc.context.AttributeContextOrBuilder> + getOperationsFieldBuilder() { + if (operationsBuilder_ == null) { + operationsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.context.AttributeContext, + com.google.rpc.context.AttributeContext.Builder, + com.google.rpc.context.AttributeContextOrBuilder>( + operations_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + operations_ = null; + } + return operationsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.servicecontrol.v2.ReportRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.servicecontrol.v2.ReportRequest) + private static final com.google.api.servicecontrol.v2.ReportRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.servicecontrol.v2.ReportRequest(); + } + + public static com.google.api.servicecontrol.v2.ReportRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReportRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ReportRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ReportRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportRequestOrBuilder.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportRequestOrBuilder.java new file mode 100644 index 00000000..329e9943 --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportRequestOrBuilder.java @@ -0,0 +1,149 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +public interface ReportRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.servicecontrol.v2.ReportRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The service name as specified in its service configuration. For example,
+   * `"pubsub.googleapis.com"`.
+   * See
+   * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+   * for the definition of a service name.
+   * 
+ * + * string service_name = 1; + * + * @return The serviceName. + */ + java.lang.String getServiceName(); + /** + * + * + *
+   * The service name as specified in its service configuration. For example,
+   * `"pubsub.googleapis.com"`.
+   * See
+   * [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
+   * for the definition of a service name.
+   * 
+ * + * string service_name = 1; + * + * @return The bytes for serviceName. + */ + com.google.protobuf.ByteString getServiceNameBytes(); + + /** + * + * + *
+   * Specifies the version of the service configuration that should be used to
+   * process the request. Must not be empty. Set this field to 'latest' to
+   * specify using the latest configuration.
+   * 
+ * + * string service_config_id = 2; + * + * @return The serviceConfigId. + */ + java.lang.String getServiceConfigId(); + /** + * + * + *
+   * Specifies the version of the service configuration that should be used to
+   * process the request. Must not be empty. Set this field to 'latest' to
+   * specify using the latest configuration.
+   * 
+ * + * string service_config_id = 2; + * + * @return The bytes for serviceConfigId. + */ + com.google.protobuf.ByteString getServiceConfigIdBytes(); + + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + java.util.List getOperationsList(); + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + com.google.rpc.context.AttributeContext getOperations(int index); + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + int getOperationsCount(); + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + java.util.List + getOperationsOrBuilderList(); + /** + * + * + *
+   * Describes the list of operations to be reported. Each operation is
+   * represented as an AttributeContext, and contains all attributes around an
+   * API access.
+   * 
+ * + * repeated .google.rpc.context.AttributeContext operations = 3; + */ + com.google.rpc.context.AttributeContextOrBuilder getOperationsOrBuilder(int index); +} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportResponse.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportResponse.java new file mode 100644 index 00000000..ef1cbc0a --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportResponse.java @@ -0,0 +1,457 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +/** + * + * + *
+ * Response message for the Report method.
+ * If the request contains any invalid data, the server returns an RPC error.
+ * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.ReportResponse} + */ +public final class ReportResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.servicecontrol.v2.ReportResponse) + ReportResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReportResponse.newBuilder() to construct. + private ReportResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReportResponse() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReportResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ReportResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.ReportResponse.class, + com.google.api.servicecontrol.v2.ReportResponse.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.servicecontrol.v2.ReportResponse)) { + return super.equals(obj); + } + com.google.api.servicecontrol.v2.ReportResponse other = + (com.google.api.servicecontrol.v2.ReportResponse) obj; + + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.ReportResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.servicecontrol.v2.ReportResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for the Report method.
+   * If the request contains any invalid data, the server returns an RPC error.
+   * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.ReportResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.servicecontrol.v2.ReportResponse) + com.google.api.servicecontrol.v2.ReportResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.ReportResponse.class, + com.google.api.servicecontrol.v2.ReportResponse.Builder.class); + } + + // Construct using com.google.api.servicecontrol.v2.ReportResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ReportResponse_descriptor; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ReportResponse getDefaultInstanceForType() { + return com.google.api.servicecontrol.v2.ReportResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ReportResponse build() { + com.google.api.servicecontrol.v2.ReportResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ReportResponse buildPartial() { + com.google.api.servicecontrol.v2.ReportResponse result = + new com.google.api.servicecontrol.v2.ReportResponse(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.servicecontrol.v2.ReportResponse) { + return mergeFrom((com.google.api.servicecontrol.v2.ReportResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.servicecontrol.v2.ReportResponse other) { + if (other == com.google.api.servicecontrol.v2.ReportResponse.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.servicecontrol.v2.ReportResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.servicecontrol.v2.ReportResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.servicecontrol.v2.ReportResponse) + } + + // @@protoc_insertion_point(class_scope:google.api.servicecontrol.v2.ReportResponse) + private static final com.google.api.servicecontrol.v2.ReportResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.servicecontrol.v2.ReportResponse(); + } + + public static com.google.api.servicecontrol.v2.ReportResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReportResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ReportResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ReportResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportResponseOrBuilder.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportResponseOrBuilder.java new file mode 100644 index 00000000..64515959 --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ReportResponseOrBuilder.java @@ -0,0 +1,24 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +public interface ReportResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.servicecontrol.v2.ReportResponse) + com.google.protobuf.MessageOrBuilder {} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ResourceInfo.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ResourceInfo.java new file mode 100644 index 00000000..fe194f01 --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ResourceInfo.java @@ -0,0 +1,1420 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +/** + * + * + *
+ * Describes a resource referenced in the request.
+ * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.ResourceInfo} + */ +public final class ResourceInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.servicecontrol.v2.ResourceInfo) + ResourceInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use ResourceInfo.newBuilder() to construct. + private ResourceInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ResourceInfo() { + name_ = ""; + type_ = ""; + permission_ = ""; + container_ = ""; + location_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ResourceInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ResourceInfo( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + type_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + permission_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + container_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + location_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ResourceInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ResourceInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.ResourceInfo.class, + com.google.api.servicecontrol.v2.ResourceInfo.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The name of the resource referenced in the request.
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The name of the resource referenced in the request.
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TYPE_FIELD_NUMBER = 2; + private volatile java.lang.Object type_; + /** + * + * + *
+   * The resource type in the format of "{service}/{kind}".
+   * 
+ * + * string type = 2; + * + * @return The type. + */ + @java.lang.Override + public java.lang.String getType() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + type_ = s; + return s; + } + } + /** + * + * + *
+   * The resource type in the format of "{service}/{kind}".
+   * 
+ * + * string type = 2; + * + * @return The bytes for type. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PERMISSION_FIELD_NUMBER = 3; + private volatile java.lang.Object permission_; + /** + * + * + *
+   * The resource permission needed for this request.
+   * The format must be "{service}/{plural}.{verb}".
+   * 
+ * + * string permission = 3; + * + * @return The permission. + */ + @java.lang.Override + public java.lang.String getPermission() { + java.lang.Object ref = permission_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + permission_ = s; + return s; + } + } + /** + * + * + *
+   * The resource permission needed for this request.
+   * The format must be "{service}/{plural}.{verb}".
+   * 
+ * + * string permission = 3; + * + * @return The bytes for permission. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPermissionBytes() { + java.lang.Object ref = permission_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + permission_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTAINER_FIELD_NUMBER = 4; + private volatile java.lang.Object container_; + /** + * + * + *
+   * Optional. The identifier of the container of this resource. For Google
+   * Cloud APIs, the resource container must be one of the following formats:
+   *     - `projects/<project-id or project-number>`
+   *     - `folders/<folder-id>`
+   *     - `organizations/<organization-id>`
+   * For the policy enforcement on the container level (VPCSC and Location
+   * Policy check), this field takes precedence on the container extracted from
+   * name when presents.
+   * 
+ * + * string container = 4; + * + * @return The container. + */ + @java.lang.Override + public java.lang.String getContainer() { + java.lang.Object ref = container_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + container_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The identifier of the container of this resource. For Google
+   * Cloud APIs, the resource container must be one of the following formats:
+   *     - `projects/<project-id or project-number>`
+   *     - `folders/<folder-id>`
+   *     - `organizations/<organization-id>`
+   * For the policy enforcement on the container level (VPCSC and Location
+   * Policy check), this field takes precedence on the container extracted from
+   * name when presents.
+   * 
+ * + * string container = 4; + * + * @return The bytes for container. + */ + @java.lang.Override + public com.google.protobuf.ByteString getContainerBytes() { + java.lang.Object ref = container_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + container_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LOCATION_FIELD_NUMBER = 5; + private volatile java.lang.Object location_; + /** + * + * + *
+   * Optional. The location of the resource. The value must be a valid zone,
+   * region or multiregion. For example: "europe-west4" or
+   * "northamerica-northeast1-a"
+   * 
+ * + * string location = 5; + * + * @return The location. + */ + @java.lang.Override + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The location of the resource. The value must be a valid zone,
+   * region or multiregion. For example: "europe-west4" or
+   * "northamerica-northeast1-a"
+   * 
+ * + * string location = 5; + * + * @return The bytes for location. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, type_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(permission_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, permission_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(container_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, container_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, location_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, type_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(permission_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, permission_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(container_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, container_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, location_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.servicecontrol.v2.ResourceInfo)) { + return super.equals(obj); + } + com.google.api.servicecontrol.v2.ResourceInfo other = + (com.google.api.servicecontrol.v2.ResourceInfo) obj; + + if (!getName().equals(other.getName())) return false; + if (!getType().equals(other.getType())) return false; + if (!getPermission().equals(other.getPermission())) return false; + if (!getContainer().equals(other.getContainer())) return false; + if (!getLocation().equals(other.getLocation())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + TYPE_FIELD_NUMBER; + hash = (53 * hash) + getType().hashCode(); + hash = (37 * hash) + PERMISSION_FIELD_NUMBER; + hash = (53 * hash) + getPermission().hashCode(); + hash = (37 * hash) + CONTAINER_FIELD_NUMBER; + hash = (53 * hash) + getContainer().hashCode(); + hash = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.servicecontrol.v2.ResourceInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Describes a resource referenced in the request.
+   * 
+ * + * Protobuf type {@code google.api.servicecontrol.v2.ResourceInfo} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.servicecontrol.v2.ResourceInfo) + com.google.api.servicecontrol.v2.ResourceInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ResourceInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ResourceInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.servicecontrol.v2.ResourceInfo.class, + com.google.api.servicecontrol.v2.ResourceInfo.Builder.class); + } + + // Construct using com.google.api.servicecontrol.v2.ResourceInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + type_ = ""; + + permission_ = ""; + + container_ = ""; + + location_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.servicecontrol.v2.ServiceControllerProto + .internal_static_google_api_servicecontrol_v2_ResourceInfo_descriptor; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ResourceInfo getDefaultInstanceForType() { + return com.google.api.servicecontrol.v2.ResourceInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ResourceInfo build() { + com.google.api.servicecontrol.v2.ResourceInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ResourceInfo buildPartial() { + com.google.api.servicecontrol.v2.ResourceInfo result = + new com.google.api.servicecontrol.v2.ResourceInfo(this); + result.name_ = name_; + result.type_ = type_; + result.permission_ = permission_; + result.container_ = container_; + result.location_ = location_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.servicecontrol.v2.ResourceInfo) { + return mergeFrom((com.google.api.servicecontrol.v2.ResourceInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.servicecontrol.v2.ResourceInfo other) { + if (other == com.google.api.servicecontrol.v2.ResourceInfo.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getType().isEmpty()) { + type_ = other.type_; + onChanged(); + } + if (!other.getPermission().isEmpty()) { + permission_ = other.permission_; + onChanged(); + } + if (!other.getContainer().isEmpty()) { + container_ = other.container_; + onChanged(); + } + if (!other.getLocation().isEmpty()) { + location_ = other.location_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.servicecontrol.v2.ResourceInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.servicecontrol.v2.ResourceInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The name of the resource referenced in the request.
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The name of the resource referenced in the request.
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The name of the resource referenced in the request.
+     * 
+ * + * string name = 1; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the resource referenced in the request.
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the resource referenced in the request.
+     * 
+ * + * string name = 1; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object type_ = ""; + /** + * + * + *
+     * The resource type in the format of "{service}/{kind}".
+     * 
+ * + * string type = 2; + * + * @return The type. + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + type_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource type in the format of "{service}/{kind}".
+     * 
+ * + * string type = 2; + * + * @return The bytes for type. + */ + public com.google.protobuf.ByteString getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource type in the format of "{service}/{kind}".
+     * 
+ * + * string type = 2; + * + * @param value The type to set. + * @return This builder for chaining. + */ + public Builder setType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + type_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource type in the format of "{service}/{kind}".
+     * 
+ * + * string type = 2; + * + * @return This builder for chaining. + */ + public Builder clearType() { + + type_ = getDefaultInstance().getType(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource type in the format of "{service}/{kind}".
+     * 
+ * + * string type = 2; + * + * @param value The bytes for type to set. + * @return This builder for chaining. + */ + public Builder setTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + type_ = value; + onChanged(); + return this; + } + + private java.lang.Object permission_ = ""; + /** + * + * + *
+     * The resource permission needed for this request.
+     * The format must be "{service}/{plural}.{verb}".
+     * 
+ * + * string permission = 3; + * + * @return The permission. + */ + public java.lang.String getPermission() { + java.lang.Object ref = permission_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + permission_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource permission needed for this request.
+     * The format must be "{service}/{plural}.{verb}".
+     * 
+ * + * string permission = 3; + * + * @return The bytes for permission. + */ + public com.google.protobuf.ByteString getPermissionBytes() { + java.lang.Object ref = permission_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + permission_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource permission needed for this request.
+     * The format must be "{service}/{plural}.{verb}".
+     * 
+ * + * string permission = 3; + * + * @param value The permission to set. + * @return This builder for chaining. + */ + public Builder setPermission(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + permission_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource permission needed for this request.
+     * The format must be "{service}/{plural}.{verb}".
+     * 
+ * + * string permission = 3; + * + * @return This builder for chaining. + */ + public Builder clearPermission() { + + permission_ = getDefaultInstance().getPermission(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource permission needed for this request.
+     * The format must be "{service}/{plural}.{verb}".
+     * 
+ * + * string permission = 3; + * + * @param value The bytes for permission to set. + * @return This builder for chaining. + */ + public Builder setPermissionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + permission_ = value; + onChanged(); + return this; + } + + private java.lang.Object container_ = ""; + /** + * + * + *
+     * Optional. The identifier of the container of this resource. For Google
+     * Cloud APIs, the resource container must be one of the following formats:
+     *     - `projects/<project-id or project-number>`
+     *     - `folders/<folder-id>`
+     *     - `organizations/<organization-id>`
+     * For the policy enforcement on the container level (VPCSC and Location
+     * Policy check), this field takes precedence on the container extracted from
+     * name when presents.
+     * 
+ * + * string container = 4; + * + * @return The container. + */ + public java.lang.String getContainer() { + java.lang.Object ref = container_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + container_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The identifier of the container of this resource. For Google
+     * Cloud APIs, the resource container must be one of the following formats:
+     *     - `projects/<project-id or project-number>`
+     *     - `folders/<folder-id>`
+     *     - `organizations/<organization-id>`
+     * For the policy enforcement on the container level (VPCSC and Location
+     * Policy check), this field takes precedence on the container extracted from
+     * name when presents.
+     * 
+ * + * string container = 4; + * + * @return The bytes for container. + */ + public com.google.protobuf.ByteString getContainerBytes() { + java.lang.Object ref = container_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + container_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The identifier of the container of this resource. For Google
+     * Cloud APIs, the resource container must be one of the following formats:
+     *     - `projects/<project-id or project-number>`
+     *     - `folders/<folder-id>`
+     *     - `organizations/<organization-id>`
+     * For the policy enforcement on the container level (VPCSC and Location
+     * Policy check), this field takes precedence on the container extracted from
+     * name when presents.
+     * 
+ * + * string container = 4; + * + * @param value The container to set. + * @return This builder for chaining. + */ + public Builder setContainer(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + container_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The identifier of the container of this resource. For Google
+     * Cloud APIs, the resource container must be one of the following formats:
+     *     - `projects/<project-id or project-number>`
+     *     - `folders/<folder-id>`
+     *     - `organizations/<organization-id>`
+     * For the policy enforcement on the container level (VPCSC and Location
+     * Policy check), this field takes precedence on the container extracted from
+     * name when presents.
+     * 
+ * + * string container = 4; + * + * @return This builder for chaining. + */ + public Builder clearContainer() { + + container_ = getDefaultInstance().getContainer(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The identifier of the container of this resource. For Google
+     * Cloud APIs, the resource container must be one of the following formats:
+     *     - `projects/<project-id or project-number>`
+     *     - `folders/<folder-id>`
+     *     - `organizations/<organization-id>`
+     * For the policy enforcement on the container level (VPCSC and Location
+     * Policy check), this field takes precedence on the container extracted from
+     * name when presents.
+     * 
+ * + * string container = 4; + * + * @param value The bytes for container to set. + * @return This builder for chaining. + */ + public Builder setContainerBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + container_ = value; + onChanged(); + return this; + } + + private java.lang.Object location_ = ""; + /** + * + * + *
+     * Optional. The location of the resource. The value must be a valid zone,
+     * region or multiregion. For example: "europe-west4" or
+     * "northamerica-northeast1-a"
+     * 
+ * + * string location = 5; + * + * @return The location. + */ + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The location of the resource. The value must be a valid zone,
+     * region or multiregion. For example: "europe-west4" or
+     * "northamerica-northeast1-a"
+     * 
+ * + * string location = 5; + * + * @return The bytes for location. + */ + public com.google.protobuf.ByteString getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The location of the resource. The value must be a valid zone,
+     * region or multiregion. For example: "europe-west4" or
+     * "northamerica-northeast1-a"
+     * 
+ * + * string location = 5; + * + * @param value The location to set. + * @return This builder for chaining. + */ + public Builder setLocation(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + location_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The location of the resource. The value must be a valid zone,
+     * region or multiregion. For example: "europe-west4" or
+     * "northamerica-northeast1-a"
+     * 
+ * + * string location = 5; + * + * @return This builder for chaining. + */ + public Builder clearLocation() { + + location_ = getDefaultInstance().getLocation(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The location of the resource. The value must be a valid zone,
+     * region or multiregion. For example: "europe-west4" or
+     * "northamerica-northeast1-a"
+     * 
+ * + * string location = 5; + * + * @param value The bytes for location to set. + * @return This builder for chaining. + */ + public Builder setLocationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + location_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.servicecontrol.v2.ResourceInfo) + } + + // @@protoc_insertion_point(class_scope:google.api.servicecontrol.v2.ResourceInfo) + private static final com.google.api.servicecontrol.v2.ResourceInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.servicecontrol.v2.ResourceInfo(); + } + + public static com.google.api.servicecontrol.v2.ResourceInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ResourceInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ResourceInfo(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.servicecontrol.v2.ResourceInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ResourceInfoOrBuilder.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ResourceInfoOrBuilder.java new file mode 100644 index 00000000..8ab00ec3 --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ResourceInfoOrBuilder.java @@ -0,0 +1,170 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +public interface ResourceInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.servicecontrol.v2.ResourceInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The name of the resource referenced in the request.
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The name of the resource referenced in the request.
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The resource type in the format of "{service}/{kind}".
+   * 
+ * + * string type = 2; + * + * @return The type. + */ + java.lang.String getType(); + /** + * + * + *
+   * The resource type in the format of "{service}/{kind}".
+   * 
+ * + * string type = 2; + * + * @return The bytes for type. + */ + com.google.protobuf.ByteString getTypeBytes(); + + /** + * + * + *
+   * The resource permission needed for this request.
+   * The format must be "{service}/{plural}.{verb}".
+   * 
+ * + * string permission = 3; + * + * @return The permission. + */ + java.lang.String getPermission(); + /** + * + * + *
+   * The resource permission needed for this request.
+   * The format must be "{service}/{plural}.{verb}".
+   * 
+ * + * string permission = 3; + * + * @return The bytes for permission. + */ + com.google.protobuf.ByteString getPermissionBytes(); + + /** + * + * + *
+   * Optional. The identifier of the container of this resource. For Google
+   * Cloud APIs, the resource container must be one of the following formats:
+   *     - `projects/<project-id or project-number>`
+   *     - `folders/<folder-id>`
+   *     - `organizations/<organization-id>`
+   * For the policy enforcement on the container level (VPCSC and Location
+   * Policy check), this field takes precedence on the container extracted from
+   * name when presents.
+   * 
+ * + * string container = 4; + * + * @return The container. + */ + java.lang.String getContainer(); + /** + * + * + *
+   * Optional. The identifier of the container of this resource. For Google
+   * Cloud APIs, the resource container must be one of the following formats:
+   *     - `projects/<project-id or project-number>`
+   *     - `folders/<folder-id>`
+   *     - `organizations/<organization-id>`
+   * For the policy enforcement on the container level (VPCSC and Location
+   * Policy check), this field takes precedence on the container extracted from
+   * name when presents.
+   * 
+ * + * string container = 4; + * + * @return The bytes for container. + */ + com.google.protobuf.ByteString getContainerBytes(); + + /** + * + * + *
+   * Optional. The location of the resource. The value must be a valid zone,
+   * region or multiregion. For example: "europe-west4" or
+   * "northamerica-northeast1-a"
+   * 
+ * + * string location = 5; + * + * @return The location. + */ + java.lang.String getLocation(); + /** + * + * + *
+   * Optional. The location of the resource. The value must be a valid zone,
+   * region or multiregion. For example: "europe-west4" or
+   * "northamerica-northeast1-a"
+   * 
+ * + * string location = 5; + * + * @return The bytes for location. + */ + com.google.protobuf.ByteString getLocationBytes(); +} diff --git a/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerProto.java b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerProto.java new file mode 100644 index 00000000..e47f3a75 --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/java/com/google/api/servicecontrol/v2/ServiceControllerProto.java @@ -0,0 +1,174 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/servicecontrol/v2/service_controller.proto + +package com.google.api.servicecontrol.v2; + +public final class ServiceControllerProto { + private ServiceControllerProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_servicecontrol_v2_CheckRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_servicecontrol_v2_CheckRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_servicecontrol_v2_ResourceInfo_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_servicecontrol_v2_ResourceInfo_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_servicecontrol_v2_CheckResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_servicecontrol_v2_CheckResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_servicecontrol_v2_CheckResponse_HeadersEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_servicecontrol_v2_CheckResponse_HeadersEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_servicecontrol_v2_ReportRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_servicecontrol_v2_ReportRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_servicecontrol_v2_ReportResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_servicecontrol_v2_ReportResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n5google/api/servicecontrol/v2/service_c" + + "ontroller.proto\022\034google.api.servicecontr" + + "ol.v2\032\034google/api/annotations.proto\032\027goo" + + "gle/api/client.proto\032*google/rpc/context" + + "/attribute_context.proto\032\027google/rpc/sta" + + "tus.proto\"\307\001\n\014CheckRequest\022\024\n\014service_na" + + "me\030\001 \001(\t\022\031\n\021service_config_id\030\002 \001(\t\0228\n\na" + + "ttributes\030\003 \001(\0132$.google.rpc.context.Att" + + "ributeContext\022=\n\tresources\030\004 \003(\0132*.googl" + + "e.api.servicecontrol.v2.ResourceInfo\022\r\n\005" + + "flags\030\005 \001(\t\"c\n\014ResourceInfo\022\014\n\004name\030\001 \001(" + + "\t\022\014\n\004type\030\002 \001(\t\022\022\n\npermission\030\003 \001(\t\022\021\n\tc" + + "ontainer\030\004 \001(\t\022\020\n\010location\030\005 \001(\t\"\256\001\n\rChe" + + "ckResponse\022\"\n\006status\030\001 \001(\0132\022.google.rpc." + + "Status\022I\n\007headers\030\002 \003(\01328.google.api.ser" + + "vicecontrol.v2.CheckResponse.HeadersEntr" + + "y\032.\n\014HeadersEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" + + "\002 \001(\t:\0028\001\"z\n\rReportRequest\022\024\n\014service_na" + + "me\030\001 \001(\t\022\031\n\021service_config_id\030\002 \001(\t\0228\n\no" + + "perations\030\003 \003(\0132$.google.rpc.context.Att" + + "ributeContext\"\020\n\016ReportResponse2\274\003\n\021Serv" + + "iceController\022\216\001\n\005Check\022*.google.api.ser" + + "vicecontrol.v2.CheckRequest\032+.google.api" + + ".servicecontrol.v2.CheckResponse\",\202\323\344\223\002&" + + "\"!/v2/services/{service_name}:check:\001*\022\222" + + "\001\n\006Report\022+.google.api.servicecontrol.v2" + + ".ReportRequest\032,.google.api.servicecontr" + + "ol.v2.ReportResponse\"-\202\323\344\223\002\'\"\"/v2/servic" + + "es/{service_name}:report:\001*\032\200\001\312A\035service" + + "control.googleapis.com\322A]https://www.goo" + + "gleapis.com/auth/cloud-platform,https://" + + "www.googleapis.com/auth/servicecontrolB\370" + + "\001\n com.google.api.servicecontrol.v2B\026Ser" + + "viceControllerProtoP\001ZJgoogle.golang.org" + + "/genproto/googleapis/api/servicecontrol/" + + "v2;servicecontrol\370\001\001\242\002\004GASC\252\002\036Google.Clo" + + "ud.ServiceControl.V2\312\002\036Google\\Cloud\\Serv" + + "iceControl\\V2\352\002!Google::Cloud::ServiceCo" + + "ntrol::V2b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.rpc.context.AttributeContextProto.getDescriptor(), + com.google.rpc.StatusProto.getDescriptor(), + }); + internal_static_google_api_servicecontrol_v2_CheckRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_api_servicecontrol_v2_CheckRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_api_servicecontrol_v2_CheckRequest_descriptor, + new java.lang.String[] { + "ServiceName", "ServiceConfigId", "Attributes", "Resources", "Flags", + }); + internal_static_google_api_servicecontrol_v2_ResourceInfo_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_api_servicecontrol_v2_ResourceInfo_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_api_servicecontrol_v2_ResourceInfo_descriptor, + new java.lang.String[] { + "Name", "Type", "Permission", "Container", "Location", + }); + internal_static_google_api_servicecontrol_v2_CheckResponse_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_api_servicecontrol_v2_CheckResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_api_servicecontrol_v2_CheckResponse_descriptor, + new java.lang.String[] { + "Status", "Headers", + }); + internal_static_google_api_servicecontrol_v2_CheckResponse_HeadersEntry_descriptor = + internal_static_google_api_servicecontrol_v2_CheckResponse_descriptor + .getNestedTypes() + .get(0); + internal_static_google_api_servicecontrol_v2_CheckResponse_HeadersEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_api_servicecontrol_v2_CheckResponse_HeadersEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_api_servicecontrol_v2_ReportRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_api_servicecontrol_v2_ReportRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_api_servicecontrol_v2_ReportRequest_descriptor, + new java.lang.String[] { + "ServiceName", "ServiceConfigId", "Operations", + }); + internal_static_google_api_servicecontrol_v2_ReportResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_api_servicecontrol_v2_ReportResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_api_servicecontrol_v2_ReportResponse_descriptor, + new java.lang.String[] {}); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.oauthScopes); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.rpc.context.AttributeContextProto.getDescriptor(); + com.google.rpc.StatusProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-service-control-v2/src/main/proto/google/api/servicecontrol/v2/service_controller.proto b/proto-google-cloud-service-control-v2/src/main/proto/google/api/servicecontrol/v2/service_controller.proto new file mode 100644 index 00000000..62e3f24c --- /dev/null +++ b/proto-google-cloud-service-control-v2/src/main/proto/google/api/servicecontrol/v2/service_controller.proto @@ -0,0 +1,186 @@ +// Copyright 2022 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 +// +// http://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. + +syntax = "proto3"; + +package google.api.servicecontrol.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/rpc/context/attribute_context.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceControl.V2"; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v2;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "ServiceControllerProto"; +option java_package = "com.google.api.servicecontrol.v2"; +option objc_class_prefix = "GASC"; +option php_namespace = "Google\\Cloud\\ServiceControl\\V2"; +option ruby_package = "Google::Cloud::ServiceControl::V2"; + +// [Service Control API v2](/service-infrastructure/docs/service-control) +// +// Private Preview. This feature is only available for approved services. +// +// This API provides admission control and telemetry reporting for services +// that are integrated with [Service Infrastructure](/service-infrastructure). +service ServiceController { + option (google.api.default_host) = "servicecontrol.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/servicecontrol"; + + // Private Preview. This feature is only available for approved services. + // + // This method provides admission control for services that are integrated + // with [Service Infrastructure](/service-infrastructure). It checks whether + // an operation should be allowed based on the service configuration and + // relevant policies. It must be called before the operation is executed. + // For more information, see + // [Admission Control](/service-infrastructure/docs/admission-control). + // + // NOTE: The admission control has an expected policy propagation delay of + // 60s. The caller **must** not depend on the most recent policy changes. + // + // NOTE: The admission control has a hard limit of 1 referenced resources + // per call. If an operation refers to more than 1 resources, the caller + // must call the Check method multiple times. + // + // This method requires the `servicemanagement.services.check` permission + // on the specified service. For more information, see + // [Service Control API Access + // Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + rpc Check(CheckRequest) returns (CheckResponse) { + option (google.api.http) = { + post: "/v2/services/{service_name}:check" + body: "*" + }; + } + + // Private Preview. This feature is only available for approved services. + // + // This method provides telemetry reporting for services that are integrated + // with [Service Infrastructure](/service-infrastructure). It reports a list + // of operations that have occurred on a service. It must be called after the + // operations have been executed. For more information, see + // [Telemetry Reporting](/service-infrastructure/docs/telemetry-reporting). + // + // NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB + // per Report call. It is recommended to have no more than 100 operations per + // call. + // + // This method requires the `servicemanagement.services.report` permission + // on the specified service. For more information, see + // [Service Control API Access + // Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control). + rpc Report(ReportRequest) returns (ReportResponse) { + option (google.api.http) = { + post: "/v2/services/{service_name}:report" + body: "*" + }; + } +} + +// Request message for the Check method. +message CheckRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // Specifies the version of the service configuration that should be used to + // process the request. Must not be empty. Set this field to 'latest' to + // specify using the latest configuration. + string service_config_id = 2; + + // Describes attributes about the operation being executed by the service. + google.rpc.context.AttributeContext attributes = 3; + + // Describes the resources and the policies applied to each resource. + repeated ResourceInfo resources = 4; + + // Optional. Contains a comma-separated list of flags. + string flags = 5; +} + +// Describes a resource referenced in the request. +message ResourceInfo { + // The name of the resource referenced in the request. + string name = 1; + + // The resource type in the format of "{service}/{kind}". + string type = 2; + + // The resource permission needed for this request. + // The format must be "{service}/{plural}.{verb}". + string permission = 3; + + // Optional. The identifier of the container of this resource. For Google + // Cloud APIs, the resource container must be one of the following formats: + // - `projects/` + // - `folders/` + // - `organizations/` + // For the policy enforcement on the container level (VPCSC and Location + // Policy check), this field takes precedence on the container extracted from + // name when presents. + string container = 4; + + // Optional. The location of the resource. The value must be a valid zone, + // region or multiregion. For example: "europe-west4" or + // "northamerica-northeast1-a" + string location = 5; +} + +// Response message for the Check method. +message CheckResponse { + // Operation is allowed when this field is not set. Any non-'OK' status + // indicates a denial; [google.rpc.Status.details][google.rpc.Status.details] + // would contain additional details about the denial. + google.rpc.Status status = 1; + + // Returns a set of request contexts generated from the `CheckRequest`. + map headers = 2; +} + +// Request message for the Report method. +message ReportRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // Specifies the version of the service configuration that should be used to + // process the request. Must not be empty. Set this field to 'latest' to + // specify using the latest configuration. + string service_config_id = 2; + + // Describes the list of operations to be reported. Each operation is + // represented as an AttributeContext, and contains all attributes around an + // API access. + repeated google.rpc.context.AttributeContext operations = 3; +} + +// Response message for the Report method. +// If the request contains any invalid data, the server returns an RPC error. +message ReportResponse { + +} diff --git a/versions.txt b/versions.txt index d3687473..7347e4fd 100644 --- a/versions.txt +++ b/versions.txt @@ -4,3 +4,5 @@ google-cloud-service-control:1.1.9:1.1.10-SNAPSHOT grpc-google-cloud-service-control-v1:1.1.9:1.1.10-SNAPSHOT proto-google-cloud-service-control-v1:1.1.9:1.1.10-SNAPSHOT +proto-google-cloud-service-control-v2:1.1.9:1.1.10-SNAPSHOT +grpc-google-cloud-service-control-v2:1.1.9:1.1.10-SNAPSHOT