diff --git a/google-cloud-asset-bom/pom.xml b/google-cloud-asset-bom/pom.xml index b24609654..8493023d5 100644 --- a/google-cloud-asset-bom/pom.xml +++ b/google-cloud-asset-bom/pom.xml @@ -76,11 +76,21 @@ grpc-google-cloud-asset-v1beta1 0.81.2-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-asset-v1p1beta1 + 0.81.2-SNAPSHOT + com.google.api.grpc grpc-google-cloud-asset-v1p2beta1 0.81.2-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-asset-v1p1beta1 + 0.81.2-SNAPSHOT + com.google.api.grpc proto-google-cloud-asset-v1p2beta1 diff --git a/google-cloud-asset/pom.xml b/google-cloud-asset/pom.xml index d446f569c..f6c92f59b 100644 --- a/google-cloud-asset/pom.xml +++ b/google-cloud-asset/pom.xml @@ -46,6 +46,10 @@ com.google.api.grpc proto-google-cloud-asset-v1 + + com.google.api.grpc + proto-google-cloud-asset-v1p1beta1 + com.google.api.grpc proto-google-cloud-asset-v1p2beta1 @@ -107,6 +111,11 @@ grpc-google-cloud-asset-v1beta1 test + + com.google.api.grpc + grpc-google-cloud-asset-v1p1beta1 + test + com.google.api.grpc grpc-google-cloud-asset-v1p2beta1 diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceClient.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceClient.java new file mode 100644 index 000000000..4e2134fff --- /dev/null +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceClient.java @@ -0,0 +1,1046 @@ +/* + * 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.cloud.asset.v1p1beta1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.asset.v1p1beta1.stub.AssetServiceStub; +import com.google.cloud.asset.v1p1beta1.stub.AssetServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Asset service definition. + * + *

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: + * + *

+ * 
+ * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ *   String scope = "";
+ *   String query = "";
+ *   List<String> assetTypes = new ArrayList<>();
+ *   for (StandardResourceMetadata element : assetServiceClient.searchResources(scope, query, assetTypes).iterateAll()) {
+ *     // doThingsWith(element);
+ *   }
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the assetServiceClient 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 AssetServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * AssetServiceSettings assetServiceSettings =
+ *     AssetServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * AssetServiceClient assetServiceClient =
+ *     AssetServiceClient.create(assetServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * AssetServiceSettings assetServiceSettings =
+ *     AssetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * AssetServiceClient assetServiceClient =
+ *     AssetServiceClient.create(assetServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AssetServiceClient implements BackgroundResource { + private final AssetServiceSettings settings; + private final AssetServiceStub stub; + + /** Constructs an instance of AssetServiceClient with default settings. */ + public static final AssetServiceClient create() throws IOException { + return create(AssetServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of AssetServiceClient, 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 AssetServiceClient create(AssetServiceSettings settings) throws IOException { + return new AssetServiceClient(settings); + } + + /** + * Constructs an instance of AssetServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer to use AssetServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final AssetServiceClient create(AssetServiceStub stub) { + return new AssetServiceClient(stub); + } + + /** + * Constructs an instance of AssetServiceClient, 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 AssetServiceClient(AssetServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((AssetServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected AssetServiceClient(AssetServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final AssetServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AssetServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches resources which are accessible with .get permission. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   String query = "";
+   *   List<String> assetTypes = new ArrayList<>();
+   *   for (StandardResourceMetadata element : assetServiceClient.searchResources(scope, query, assetTypes).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param scope Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: * Organization number (such as + * "organizations/123") * Folder number(such as "folders/1234") * Project number (such + * as "projects/12345") + * @param query Optional. The query statement. + * @param assetTypes Optional. A list of asset types that this request searches for. If empty, it + * will search all the supported asset types. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SearchResourcesPagedResponse searchResources( + String scope, String query, List assetTypes) { + SearchResourcesRequest request = + SearchResourcesRequest.newBuilder() + .setScope(scope) + .setQuery(query) + .addAllAssetTypes(assetTypes) + .build(); + return searchResources(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches resources which are accessible with .get permission. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchResourcesRequest request = SearchResourcesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   for (StandardResourceMetadata element : assetServiceClient.searchResources(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @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 SearchResourcesPagedResponse searchResources(SearchResourcesRequest request) { + return searchResourcesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches resources which are accessible with .get permission. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchResourcesRequest request = SearchResourcesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   ApiFuture<SearchResourcesPagedResponse> future = assetServiceClient.searchResourcesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (StandardResourceMetadata element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + searchResourcesPagedCallable() { + return stub.searchResourcesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches resources which are accessible with .get permission. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchResourcesRequest request = SearchResourcesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   while (true) {
+   *     SearchResourcesResponse response = assetServiceClient.searchResourcesCallable().call(request);
+   *     for (StandardResourceMetadata element : response.getResultsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + searchResourcesCallable() { + return stub.searchResourcesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches IAM policies which are accessible with .getIamPolicy permission. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   String query = "";
+   *   for (IamPolicySearchResult element : assetServiceClient.searchIamPolicies(scope, query).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param scope Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: * Organization number (such as + * "organizations/123") * Folder number(such as "folders/1234") * Project number (such + * as "projects/12345") + * @param query Optional. The query statement. Examples: * + * "policy:myuser{@literal @}mydomain.com" * "policy:(myuser{@literal @}mydomain.com + * viewer)" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SearchIamPoliciesPagedResponse searchIamPolicies(String scope, String query) { + SearchIamPoliciesRequest request = + SearchIamPoliciesRequest.newBuilder().setScope(scope).setQuery(query).build(); + return searchIamPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches IAM policies which are accessible with .getIamPolicy permission. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchIamPoliciesRequest request = SearchIamPoliciesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   for (IamPolicySearchResult element : assetServiceClient.searchIamPolicies(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @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 SearchIamPoliciesPagedResponse searchIamPolicies(SearchIamPoliciesRequest request) { + return searchIamPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches IAM policies which are accessible with .getIamPolicy permission. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchIamPoliciesRequest request = SearchIamPoliciesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   ApiFuture<SearchIamPoliciesPagedResponse> future = assetServiceClient.searchIamPoliciesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (IamPolicySearchResult element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + searchIamPoliciesPagedCallable() { + return stub.searchIamPoliciesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches IAM policies which are accessible with .getIamPolicy permission. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchIamPoliciesRequest request = SearchIamPoliciesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   while (true) {
+   *     SearchIamPoliciesResponse response = assetServiceClient.searchIamPoliciesCallable().call(request);
+   *     for (IamPolicySearchResult element : response.getResultsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + searchIamPoliciesCallable() { + return stub.searchIamPoliciesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the resources under a given accessible CRM scope (project/folder/organization). + * This RPC gives callers especially admins the ability to search all the resources under a scope, + * even if they don't have .get permission of all the resources. Callers should have + * cloud.assets.SearchAllResources permission on the requested scope, otherwise it will be + * rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   String query = "";
+   *   List<String> assetTypes = new ArrayList<>();
+   *   for (StandardResourceMetadata element : assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param scope Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: * Organization number (such as + * "organizations/123") * Folder number(such as "folders/1234") * Project number (such + * as "projects/12345") + * @param query Optional. The query statement. + * @param assetTypes Optional. A list of asset types that this request searches for. If empty, it + * will search all the supported asset types. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SearchAllResourcesPagedResponse searchAllResources( + String scope, String query, List assetTypes) { + SearchAllResourcesRequest request = + SearchAllResourcesRequest.newBuilder() + .setScope(scope) + .setQuery(query) + .addAllAssetTypes(assetTypes) + .build(); + return searchAllResources(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the resources under a given accessible CRM scope (project/folder/organization). + * This RPC gives callers especially admins the ability to search all the resources under a scope, + * even if they don't have .get permission of all the resources. Callers should have + * cloud.assets.SearchAllResources permission on the requested scope, otherwise it will be + * rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchAllResourcesRequest request = SearchAllResourcesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   for (StandardResourceMetadata element : assetServiceClient.searchAllResources(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @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 SearchAllResourcesPagedResponse searchAllResources( + SearchAllResourcesRequest request) { + return searchAllResourcesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the resources under a given accessible CRM scope (project/folder/organization). + * This RPC gives callers especially admins the ability to search all the resources under a scope, + * even if they don't have .get permission of all the resources. Callers should have + * cloud.assets.SearchAllResources permission on the requested scope, otherwise it will be + * rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchAllResourcesRequest request = SearchAllResourcesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   ApiFuture<SearchAllResourcesPagedResponse> future = assetServiceClient.searchAllResourcesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (StandardResourceMetadata element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + searchAllResourcesPagedCallable() { + return stub.searchAllResourcesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the resources under a given accessible CRM scope (project/folder/organization). + * This RPC gives callers especially admins the ability to search all the resources under a scope, + * even if they don't have .get permission of all the resources. Callers should have + * cloud.assets.SearchAllResources permission on the requested scope, otherwise it will be + * rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchAllResourcesRequest request = SearchAllResourcesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   while (true) {
+   *     SearchAllResourcesResponse response = assetServiceClient.searchAllResourcesCallable().call(request);
+   *     for (StandardResourceMetadata element : response.getResultsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + searchAllResourcesCallable() { + return stub.searchAllResourcesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the IAM policies under a given accessible CRM scope (project/folder/organization). + * This RPC gives callers especially admins the ability to search all the IAM policies under a + * scope, even if they don't have .getIamPolicy permission of all the IAM policies. Callers should + * have cloud.assets.SearchAllIamPolicies permission on the requested scope, otherwise it will be + * rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   String query = "";
+   *   for (IamPolicySearchResult element : assetServiceClient.searchAllIamPolicies(scope, query).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param scope Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: * Organization number (such as + * "organizations/123") * Folder number(such as "folders/1234") * Project number (such + * as "projects/12345") + * @param query Optional. The query statement. Examples: * + * "policy:myuser{@literal @}mydomain.com" * "policy:(myuser{@literal @}mydomain.com + * viewer)" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(String scope, String query) { + SearchAllIamPoliciesRequest request = + SearchAllIamPoliciesRequest.newBuilder().setScope(scope).setQuery(query).build(); + return searchAllIamPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the IAM policies under a given accessible CRM scope (project/folder/organization). + * This RPC gives callers especially admins the ability to search all the IAM policies under a + * scope, even if they don't have .getIamPolicy permission of all the IAM policies. Callers should + * have cloud.assets.SearchAllIamPolicies permission on the requested scope, otherwise it will be + * rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchAllIamPoliciesRequest request = SearchAllIamPoliciesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   for (IamPolicySearchResult element : assetServiceClient.searchAllIamPolicies(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @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 SearchAllIamPoliciesPagedResponse searchAllIamPolicies( + SearchAllIamPoliciesRequest request) { + return searchAllIamPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the IAM policies under a given accessible CRM scope (project/folder/organization). + * This RPC gives callers especially admins the ability to search all the IAM policies under a + * scope, even if they don't have .getIamPolicy permission of all the IAM policies. Callers should + * have cloud.assets.SearchAllIamPolicies permission on the requested scope, otherwise it will be + * rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchAllIamPoliciesRequest request = SearchAllIamPoliciesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   ApiFuture<SearchAllIamPoliciesPagedResponse> future = assetServiceClient.searchAllIamPoliciesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (IamPolicySearchResult element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + searchAllIamPoliciesPagedCallable() { + return stub.searchAllIamPoliciesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the IAM policies under a given accessible CRM scope (project/folder/organization). + * This RPC gives callers especially admins the ability to search all the IAM policies under a + * scope, even if they don't have .getIamPolicy permission of all the IAM policies. Callers should + * have cloud.assets.SearchAllIamPolicies permission on the requested scope, otherwise it will be + * rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchAllIamPoliciesRequest request = SearchAllIamPoliciesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   while (true) {
+   *     SearchAllIamPoliciesResponse response = assetServiceClient.searchAllIamPoliciesCallable().call(request);
+   *     for (IamPolicySearchResult element : response.getResultsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + searchAllIamPoliciesCallable() { + return stub.searchAllIamPoliciesCallable(); + } + + @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); + } + + public static class SearchResourcesPagedResponse + extends AbstractPagedListResponse< + SearchResourcesRequest, + SearchResourcesResponse, + StandardResourceMetadata, + SearchResourcesPage, + SearchResourcesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + SearchResourcesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public SearchResourcesPagedResponse apply(SearchResourcesPage input) { + return new SearchResourcesPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private SearchResourcesPagedResponse(SearchResourcesPage page) { + super(page, SearchResourcesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class SearchResourcesPage + extends AbstractPage< + SearchResourcesRequest, + SearchResourcesResponse, + StandardResourceMetadata, + SearchResourcesPage> { + + private SearchResourcesPage( + PageContext + context, + SearchResourcesResponse response) { + super(context, response); + } + + private static SearchResourcesPage createEmptyPage() { + return new SearchResourcesPage(null, null); + } + + @Override + protected SearchResourcesPage createPage( + PageContext + context, + SearchResourcesResponse response) { + return new SearchResourcesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class SearchResourcesFixedSizeCollection + extends AbstractFixedSizeCollection< + SearchResourcesRequest, + SearchResourcesResponse, + StandardResourceMetadata, + SearchResourcesPage, + SearchResourcesFixedSizeCollection> { + + private SearchResourcesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static SearchResourcesFixedSizeCollection createEmptyCollection() { + return new SearchResourcesFixedSizeCollection(null, 0); + } + + @Override + protected SearchResourcesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new SearchResourcesFixedSizeCollection(pages, collectionSize); + } + } + + public static class SearchIamPoliciesPagedResponse + extends AbstractPagedListResponse< + SearchIamPoliciesRequest, + SearchIamPoliciesResponse, + IamPolicySearchResult, + SearchIamPoliciesPage, + SearchIamPoliciesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + SearchIamPoliciesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public SearchIamPoliciesPagedResponse apply(SearchIamPoliciesPage input) { + return new SearchIamPoliciesPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private SearchIamPoliciesPagedResponse(SearchIamPoliciesPage page) { + super(page, SearchIamPoliciesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class SearchIamPoliciesPage + extends AbstractPage< + SearchIamPoliciesRequest, + SearchIamPoliciesResponse, + IamPolicySearchResult, + SearchIamPoliciesPage> { + + private SearchIamPoliciesPage( + PageContext + context, + SearchIamPoliciesResponse response) { + super(context, response); + } + + private static SearchIamPoliciesPage createEmptyPage() { + return new SearchIamPoliciesPage(null, null); + } + + @Override + protected SearchIamPoliciesPage createPage( + PageContext + context, + SearchIamPoliciesResponse response) { + return new SearchIamPoliciesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class SearchIamPoliciesFixedSizeCollection + extends AbstractFixedSizeCollection< + SearchIamPoliciesRequest, + SearchIamPoliciesResponse, + IamPolicySearchResult, + SearchIamPoliciesPage, + SearchIamPoliciesFixedSizeCollection> { + + private SearchIamPoliciesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static SearchIamPoliciesFixedSizeCollection createEmptyCollection() { + return new SearchIamPoliciesFixedSizeCollection(null, 0); + } + + @Override + protected SearchIamPoliciesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new SearchIamPoliciesFixedSizeCollection(pages, collectionSize); + } + } + + public static class SearchAllResourcesPagedResponse + extends AbstractPagedListResponse< + SearchAllResourcesRequest, + SearchAllResourcesResponse, + StandardResourceMetadata, + SearchAllResourcesPage, + SearchAllResourcesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + SearchAllResourcesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public SearchAllResourcesPagedResponse apply(SearchAllResourcesPage input) { + return new SearchAllResourcesPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private SearchAllResourcesPagedResponse(SearchAllResourcesPage page) { + super(page, SearchAllResourcesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class SearchAllResourcesPage + extends AbstractPage< + SearchAllResourcesRequest, + SearchAllResourcesResponse, + StandardResourceMetadata, + SearchAllResourcesPage> { + + private SearchAllResourcesPage( + PageContext + context, + SearchAllResourcesResponse response) { + super(context, response); + } + + private static SearchAllResourcesPage createEmptyPage() { + return new SearchAllResourcesPage(null, null); + } + + @Override + protected SearchAllResourcesPage createPage( + PageContext + context, + SearchAllResourcesResponse response) { + return new SearchAllResourcesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class SearchAllResourcesFixedSizeCollection + extends AbstractFixedSizeCollection< + SearchAllResourcesRequest, + SearchAllResourcesResponse, + StandardResourceMetadata, + SearchAllResourcesPage, + SearchAllResourcesFixedSizeCollection> { + + private SearchAllResourcesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static SearchAllResourcesFixedSizeCollection createEmptyCollection() { + return new SearchAllResourcesFixedSizeCollection(null, 0); + } + + @Override + protected SearchAllResourcesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new SearchAllResourcesFixedSizeCollection(pages, collectionSize); + } + } + + public static class SearchAllIamPoliciesPagedResponse + extends AbstractPagedListResponse< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + IamPolicySearchResult, + SearchAllIamPoliciesPage, + SearchAllIamPoliciesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse, IamPolicySearchResult> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + SearchAllIamPoliciesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public SearchAllIamPoliciesPagedResponse apply(SearchAllIamPoliciesPage input) { + return new SearchAllIamPoliciesPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private SearchAllIamPoliciesPagedResponse(SearchAllIamPoliciesPage page) { + super(page, SearchAllIamPoliciesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class SearchAllIamPoliciesPage + extends AbstractPage< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + IamPolicySearchResult, + SearchAllIamPoliciesPage> { + + private SearchAllIamPoliciesPage( + PageContext< + SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse, IamPolicySearchResult> + context, + SearchAllIamPoliciesResponse response) { + super(context, response); + } + + private static SearchAllIamPoliciesPage createEmptyPage() { + return new SearchAllIamPoliciesPage(null, null); + } + + @Override + protected SearchAllIamPoliciesPage createPage( + PageContext< + SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse, IamPolicySearchResult> + context, + SearchAllIamPoliciesResponse response) { + return new SearchAllIamPoliciesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse, IamPolicySearchResult> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class SearchAllIamPoliciesFixedSizeCollection + extends AbstractFixedSizeCollection< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + IamPolicySearchResult, + SearchAllIamPoliciesPage, + SearchAllIamPoliciesFixedSizeCollection> { + + private SearchAllIamPoliciesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static SearchAllIamPoliciesFixedSizeCollection createEmptyCollection() { + return new SearchAllIamPoliciesFixedSizeCollection(null, 0); + } + + @Override + protected SearchAllIamPoliciesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new SearchAllIamPoliciesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceSettings.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceSettings.java new file mode 100644 index 000000000..a5d537b7f --- /dev/null +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceSettings.java @@ -0,0 +1,231 @@ +/* + * 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.cloud.asset.v1p1beta1; + +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllResourcesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchResourcesPagedResponse; + +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.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.asset.v1p1beta1.stub.AssetServiceStubSettings; +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 AssetServiceClient}. + * + *

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

    + *
  • The default service address (cloudasset.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 searchResources to 30 seconds: + * + *

+ * 
+ * AssetServiceSettings.Builder assetServiceSettingsBuilder =
+ *     AssetServiceSettings.newBuilder();
+ * assetServiceSettingsBuilder.searchResourcesSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AssetServiceSettings assetServiceSettings = assetServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AssetServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to searchResources. */ + public PagedCallSettings< + SearchResourcesRequest, SearchResourcesResponse, SearchResourcesPagedResponse> + searchResourcesSettings() { + return ((AssetServiceStubSettings) getStubSettings()).searchResourcesSettings(); + } + + /** Returns the object with the settings used for calls to searchIamPolicies. */ + public PagedCallSettings< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, SearchIamPoliciesPagedResponse> + searchIamPoliciesSettings() { + return ((AssetServiceStubSettings) getStubSettings()).searchIamPoliciesSettings(); + } + + /** Returns the object with the settings used for calls to searchAllResources. */ + public PagedCallSettings< + SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse> + searchAllResourcesSettings() { + return ((AssetServiceStubSettings) getStubSettings()).searchAllResourcesSettings(); + } + + /** Returns the object with the settings used for calls to searchAllIamPolicies. */ + public PagedCallSettings< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse> + searchAllIamPoliciesSettings() { + return ((AssetServiceStubSettings) getStubSettings()).searchAllIamPoliciesSettings(); + } + + public static final AssetServiceSettings create(AssetServiceStubSettings stub) + throws IOException { + return new AssetServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return AssetServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return AssetServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return AssetServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return AssetServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return AssetServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return AssetServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return AssetServiceStubSettings.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 AssetServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for AssetServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(AssetServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(AssetServiceStubSettings.newBuilder()); + } + + protected Builder(AssetServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(AssetServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public AssetServiceStubSettings.Builder getStubSettingsBuilder() { + return ((AssetServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * 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) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to searchResources. */ + public PagedCallSettings.Builder< + SearchResourcesRequest, SearchResourcesResponse, SearchResourcesPagedResponse> + searchResourcesSettings() { + return getStubSettingsBuilder().searchResourcesSettings(); + } + + /** Returns the builder for the settings used for calls to searchIamPolicies. */ + public PagedCallSettings.Builder< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, SearchIamPoliciesPagedResponse> + searchIamPoliciesSettings() { + return getStubSettingsBuilder().searchIamPoliciesSettings(); + } + + /** Returns the builder for the settings used for calls to searchAllResources. */ + public PagedCallSettings.Builder< + SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse> + searchAllResourcesSettings() { + return getStubSettingsBuilder().searchAllResourcesSettings(); + } + + /** Returns the builder for the settings used for calls to searchAllIamPolicies. */ + public PagedCallSettings.Builder< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse> + searchAllIamPoliciesSettings() { + return getStubSettingsBuilder().searchAllIamPoliciesSettings(); + } + + @Override + public AssetServiceSettings build() throws IOException { + return new AssetServiceSettings(this); + } + } +} diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/package-info.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/package-info.java new file mode 100644 index 000000000..b83807eac --- /dev/null +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/package-info.java @@ -0,0 +1,42 @@ +/* + * 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. + */ + +/** + * A client to Cloud Asset API. + * + *

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

================== AssetServiceClient ================== + * + *

Service Description: Asset service definition. + * + *

Sample for AssetServiceClient: + * + *

+ * 
+ * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+ *   String scope = "";
+ *   String query = "";
+ *   List<String> assetTypes = new ArrayList<>();
+ *   SearchResourcesPagedResponse response = assetServiceClient.searchResources(scope, query, assetTypes);
+ * }
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +package com.google.cloud.asset.v1p1beta1; + +import javax.annotation.Generated; diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/AssetServiceStub.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/AssetServiceStub.java new file mode 100644 index 000000000..0ea88fbf2 --- /dev/null +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/AssetServiceStub.java @@ -0,0 +1,87 @@ +/* + * 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.cloud.asset.v1p1beta1.stub; + +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllResourcesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchResourcesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest; +import com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse; +import com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest; +import com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse; +import com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest; +import com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse; +import com.google.cloud.asset.v1p1beta1.SearchResourcesRequest; +import com.google.cloud.asset.v1p1beta1.SearchResourcesResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Cloud Asset API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class AssetServiceStub implements BackgroundResource { + + public UnaryCallable + searchResourcesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: searchResourcesPagedCallable()"); + } + + public UnaryCallable searchResourcesCallable() { + throw new UnsupportedOperationException("Not implemented: searchResourcesCallable()"); + } + + public UnaryCallable + searchIamPoliciesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: searchIamPoliciesPagedCallable()"); + } + + public UnaryCallable + searchIamPoliciesCallable() { + throw new UnsupportedOperationException("Not implemented: searchIamPoliciesCallable()"); + } + + public UnaryCallable + searchAllResourcesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: searchAllResourcesPagedCallable()"); + } + + public UnaryCallable + searchAllResourcesCallable() { + throw new UnsupportedOperationException("Not implemented: searchAllResourcesCallable()"); + } + + public UnaryCallable + searchAllIamPoliciesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: searchAllIamPoliciesPagedCallable()"); + } + + public UnaryCallable + searchAllIamPoliciesCallable() { + throw new UnsupportedOperationException("Not implemented: searchAllIamPoliciesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/AssetServiceStubSettings.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/AssetServiceStubSettings.java new file mode 100644 index 000000000..a61917d1b --- /dev/null +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/AssetServiceStubSettings.java @@ -0,0 +1,653 @@ +/* + * 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.cloud.asset.v1p1beta1.stub; + +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllResourcesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchResourcesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +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.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.asset.v1p1beta1.IamPolicySearchResult; +import com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest; +import com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse; +import com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest; +import com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse; +import com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest; +import com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse; +import com.google.cloud.asset.v1p1beta1.SearchResourcesRequest; +import com.google.cloud.asset.v1p1beta1.SearchResourcesResponse; +import com.google.cloud.asset.v1p1beta1.StandardResourceMetadata; +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 AssetServiceStub}. + * + *

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

    + *
  • The default service address (cloudasset.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 searchResources to 30 seconds: + * + *

+ * 
+ * AssetServiceStubSettings.Builder assetServiceSettingsBuilder =
+ *     AssetServiceStubSettings.newBuilder();
+ * assetServiceSettingsBuilder.searchResourcesSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AssetServiceStubSettings assetServiceSettings = assetServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class AssetServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final PagedCallSettings< + SearchResourcesRequest, SearchResourcesResponse, SearchResourcesPagedResponse> + searchResourcesSettings; + private final PagedCallSettings< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, SearchIamPoliciesPagedResponse> + searchIamPoliciesSettings; + private final PagedCallSettings< + SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse> + searchAllResourcesSettings; + private final PagedCallSettings< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse> + searchAllIamPoliciesSettings; + + /** Returns the object with the settings used for calls to searchResources. */ + public PagedCallSettings< + SearchResourcesRequest, SearchResourcesResponse, SearchResourcesPagedResponse> + searchResourcesSettings() { + return searchResourcesSettings; + } + + /** Returns the object with the settings used for calls to searchIamPolicies. */ + public PagedCallSettings< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, SearchIamPoliciesPagedResponse> + searchIamPoliciesSettings() { + return searchIamPoliciesSettings; + } + + /** Returns the object with the settings used for calls to searchAllResources. */ + public PagedCallSettings< + SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse> + searchAllResourcesSettings() { + return searchAllResourcesSettings; + } + + /** Returns the object with the settings used for calls to searchAllIamPolicies. */ + public PagedCallSettings< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse> + searchAllIamPoliciesSettings() { + return searchAllIamPoliciesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AssetServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcAssetServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + 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 "cloudasset.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); + } + + /** 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(AssetServiceStubSettings.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 AssetServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + searchResourcesSettings = settingsBuilder.searchResourcesSettings().build(); + searchIamPoliciesSettings = settingsBuilder.searchIamPoliciesSettings().build(); + searchAllResourcesSettings = settingsBuilder.searchAllResourcesSettings().build(); + searchAllIamPoliciesSettings = settingsBuilder.searchAllIamPoliciesSettings().build(); + } + + private static final PagedListDescriptor< + SearchResourcesRequest, SearchResourcesResponse, StandardResourceMetadata> + SEARCH_RESOURCES_PAGE_STR_DESC = + new PagedListDescriptor< + SearchResourcesRequest, SearchResourcesResponse, StandardResourceMetadata>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public SearchResourcesRequest injectToken( + SearchResourcesRequest payload, String token) { + return SearchResourcesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public SearchResourcesRequest injectPageSize( + SearchResourcesRequest payload, int pageSize) { + return SearchResourcesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(SearchResourcesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(SearchResourcesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + SearchResourcesResponse payload) { + return payload.getResultsList() != null + ? payload.getResultsList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, IamPolicySearchResult> + SEARCH_IAM_POLICIES_PAGE_STR_DESC = + new PagedListDescriptor< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, IamPolicySearchResult>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public SearchIamPoliciesRequest injectToken( + SearchIamPoliciesRequest payload, String token) { + return SearchIamPoliciesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public SearchIamPoliciesRequest injectPageSize( + SearchIamPoliciesRequest payload, int pageSize) { + return SearchIamPoliciesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(SearchIamPoliciesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(SearchIamPoliciesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + SearchIamPoliciesResponse payload) { + return payload.getResultsList() != null + ? payload.getResultsList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor< + SearchAllResourcesRequest, SearchAllResourcesResponse, StandardResourceMetadata> + SEARCH_ALL_RESOURCES_PAGE_STR_DESC = + new PagedListDescriptor< + SearchAllResourcesRequest, SearchAllResourcesResponse, StandardResourceMetadata>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public SearchAllResourcesRequest injectToken( + SearchAllResourcesRequest payload, String token) { + return SearchAllResourcesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public SearchAllResourcesRequest injectPageSize( + SearchAllResourcesRequest payload, int pageSize) { + return SearchAllResourcesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(SearchAllResourcesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(SearchAllResourcesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + SearchAllResourcesResponse payload) { + return payload.getResultsList() != null + ? payload.getResultsList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor< + SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse, IamPolicySearchResult> + SEARCH_ALL_IAM_POLICIES_PAGE_STR_DESC = + new PagedListDescriptor< + SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse, IamPolicySearchResult>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public SearchAllIamPoliciesRequest injectToken( + SearchAllIamPoliciesRequest payload, String token) { + return SearchAllIamPoliciesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public SearchAllIamPoliciesRequest injectPageSize( + SearchAllIamPoliciesRequest payload, int pageSize) { + return SearchAllIamPoliciesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(SearchAllIamPoliciesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(SearchAllIamPoliciesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + SearchAllIamPoliciesResponse payload) { + return payload.getResultsList() != null + ? payload.getResultsList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + SearchResourcesRequest, SearchResourcesResponse, SearchResourcesPagedResponse> + SEARCH_RESOURCES_PAGE_STR_FACT = + new PagedListResponseFactory< + SearchResourcesRequest, SearchResourcesResponse, SearchResourcesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + SearchResourcesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, SEARCH_RESOURCES_PAGE_STR_DESC, request, context); + return SearchResourcesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, SearchIamPoliciesPagedResponse> + SEARCH_IAM_POLICIES_PAGE_STR_FACT = + new PagedListResponseFactory< + SearchIamPoliciesRequest, + SearchIamPoliciesResponse, + SearchIamPoliciesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + SearchIamPoliciesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, IamPolicySearchResult> + pageContext = + PageContext.create( + callable, SEARCH_IAM_POLICIES_PAGE_STR_DESC, request, context); + return SearchIamPoliciesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse> + SEARCH_ALL_RESOURCES_PAGE_STR_FACT = + new PagedListResponseFactory< + SearchAllResourcesRequest, + SearchAllResourcesResponse, + SearchAllResourcesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + SearchAllResourcesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + SearchAllResourcesRequest, + SearchAllResourcesResponse, + StandardResourceMetadata> + pageContext = + PageContext.create( + callable, SEARCH_ALL_RESOURCES_PAGE_STR_DESC, request, context); + return SearchAllResourcesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse> + SEARCH_ALL_IAM_POLICIES_PAGE_STR_FACT = + new PagedListResponseFactory< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + SearchAllIamPoliciesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + IamPolicySearchResult> + pageContext = + PageContext.create( + callable, SEARCH_ALL_IAM_POLICIES_PAGE_STR_DESC, request, context); + return SearchAllIamPoliciesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for AssetServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + SearchResourcesRequest, SearchResourcesResponse, SearchResourcesPagedResponse> + searchResourcesSettings; + private final PagedCallSettings.Builder< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, SearchIamPoliciesPagedResponse> + searchIamPoliciesSettings; + private final PagedCallSettings.Builder< + SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse> + searchAllResourcesSettings; + private final PagedCallSettings.Builder< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse> + searchAllIamPoliciesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", 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(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + searchResourcesSettings = PagedCallSettings.newBuilder(SEARCH_RESOURCES_PAGE_STR_FACT); + + searchIamPoliciesSettings = PagedCallSettings.newBuilder(SEARCH_IAM_POLICIES_PAGE_STR_FACT); + + searchAllResourcesSettings = PagedCallSettings.newBuilder(SEARCH_ALL_RESOURCES_PAGE_STR_FACT); + + searchAllIamPoliciesSettings = + PagedCallSettings.newBuilder(SEARCH_ALL_IAM_POLICIES_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + searchResourcesSettings, + searchIamPoliciesSettings, + searchAllResourcesSettings, + searchAllIamPoliciesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .searchResourcesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .searchIamPoliciesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .searchAllResourcesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .searchAllIamPoliciesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(AssetServiceStubSettings settings) { + super(settings); + + searchResourcesSettings = settings.searchResourcesSettings.toBuilder(); + searchIamPoliciesSettings = settings.searchIamPoliciesSettings.toBuilder(); + searchAllResourcesSettings = settings.searchAllResourcesSettings.toBuilder(); + searchAllIamPoliciesSettings = settings.searchAllIamPoliciesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + searchResourcesSettings, + searchIamPoliciesSettings, + searchAllResourcesSettings, + searchAllIamPoliciesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * 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) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to searchResources. */ + public PagedCallSettings.Builder< + SearchResourcesRequest, SearchResourcesResponse, SearchResourcesPagedResponse> + searchResourcesSettings() { + return searchResourcesSettings; + } + + /** Returns the builder for the settings used for calls to searchIamPolicies. */ + public PagedCallSettings.Builder< + SearchIamPoliciesRequest, SearchIamPoliciesResponse, SearchIamPoliciesPagedResponse> + searchIamPoliciesSettings() { + return searchIamPoliciesSettings; + } + + /** Returns the builder for the settings used for calls to searchAllResources. */ + public PagedCallSettings.Builder< + SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse> + searchAllResourcesSettings() { + return searchAllResourcesSettings; + } + + /** Returns the builder for the settings used for calls to searchAllIamPolicies. */ + public PagedCallSettings.Builder< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse> + searchAllIamPoliciesSettings() { + return searchAllIamPoliciesSettings; + } + + @Override + public AssetServiceStubSettings build() throws IOException { + return new AssetServiceStubSettings(this); + } + } +} diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/GrpcAssetServiceCallableFactory.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/GrpcAssetServiceCallableFactory.java new file mode 100644 index 000000000..076480e6f --- /dev/null +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/GrpcAssetServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * 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.cloud.asset.v1p1beta1.stub; + +import com.google.api.core.BetaApi; +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.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Cloud Asset API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcAssetServiceCallableFactory 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 pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/GrpcAssetServiceStub.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/GrpcAssetServiceStub.java new file mode 100644 index 000000000..248f04615 --- /dev/null +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/GrpcAssetServiceStub.java @@ -0,0 +1,303 @@ +/* + * 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.cloud.asset.v1p1beta1.stub; + +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllResourcesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchResourcesPagedResponse; + +import com.google.api.core.BetaApi; +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.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest; +import com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse; +import com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest; +import com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse; +import com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest; +import com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse; +import com.google.cloud.asset.v1p1beta1.SearchResourcesRequest; +import com.google.cloud.asset.v1p1beta1.SearchResourcesResponse; +import com.google.common.collect.ImmutableMap; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Cloud Asset API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcAssetServiceStub extends AssetServiceStub { + + private static final MethodDescriptor + searchResourcesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.asset.v1p1beta1.AssetService/SearchResources") + .setRequestMarshaller( + ProtoUtils.marshaller(SearchResourcesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(SearchResourcesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + searchIamPoliciesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.asset.v1p1beta1.AssetService/SearchIamPolicies") + .setRequestMarshaller( + ProtoUtils.marshaller(SearchIamPoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(SearchIamPoliciesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + searchAllResourcesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.asset.v1p1beta1.AssetService/SearchAllResources") + .setRequestMarshaller( + ProtoUtils.marshaller(SearchAllResourcesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(SearchAllResourcesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + searchAllIamPoliciesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.asset.v1p1beta1.AssetService/SearchAllIamPolicies") + .setRequestMarshaller( + ProtoUtils.marshaller(SearchAllIamPoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(SearchAllIamPoliciesResponse.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + searchResourcesCallable; + private final UnaryCallable + searchResourcesPagedCallable; + private final UnaryCallable + searchIamPoliciesCallable; + private final UnaryCallable + searchIamPoliciesPagedCallable; + private final UnaryCallable + searchAllResourcesCallable; + private final UnaryCallable + searchAllResourcesPagedCallable; + private final UnaryCallable + searchAllIamPoliciesCallable; + private final UnaryCallable + searchAllIamPoliciesPagedCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcAssetServiceStub create(AssetServiceStubSettings settings) + throws IOException { + return new GrpcAssetServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcAssetServiceStub create(ClientContext clientContext) throws IOException { + return new GrpcAssetServiceStub(AssetServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcAssetServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcAssetServiceStub( + AssetServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcAssetServiceStub, 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 GrpcAssetServiceStub(AssetServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcAssetServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcAssetServiceStub, 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 GrpcAssetServiceStub( + AssetServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings + searchResourcesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(searchResourcesMethodDescriptor) + .build(); + GrpcCallSettings + searchIamPoliciesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(searchIamPoliciesMethodDescriptor) + .build(); + GrpcCallSettings + searchAllResourcesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(searchAllResourcesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(SearchAllResourcesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("scope", String.valueOf(request.getScope())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + searchAllIamPoliciesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(searchAllIamPoliciesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(SearchAllIamPoliciesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("scope", String.valueOf(request.getScope())); + return params.build(); + } + }) + .build(); + + this.searchResourcesCallable = + callableFactory.createUnaryCallable( + searchResourcesTransportSettings, settings.searchResourcesSettings(), clientContext); + this.searchResourcesPagedCallable = + callableFactory.createPagedCallable( + searchResourcesTransportSettings, settings.searchResourcesSettings(), clientContext); + this.searchIamPoliciesCallable = + callableFactory.createUnaryCallable( + searchIamPoliciesTransportSettings, + settings.searchIamPoliciesSettings(), + clientContext); + this.searchIamPoliciesPagedCallable = + callableFactory.createPagedCallable( + searchIamPoliciesTransportSettings, + settings.searchIamPoliciesSettings(), + clientContext); + this.searchAllResourcesCallable = + callableFactory.createUnaryCallable( + searchAllResourcesTransportSettings, + settings.searchAllResourcesSettings(), + clientContext); + this.searchAllResourcesPagedCallable = + callableFactory.createPagedCallable( + searchAllResourcesTransportSettings, + settings.searchAllResourcesSettings(), + clientContext); + this.searchAllIamPoliciesCallable = + callableFactory.createUnaryCallable( + searchAllIamPoliciesTransportSettings, + settings.searchAllIamPoliciesSettings(), + clientContext); + this.searchAllIamPoliciesPagedCallable = + callableFactory.createPagedCallable( + searchAllIamPoliciesTransportSettings, + settings.searchAllIamPoliciesSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable + searchResourcesPagedCallable() { + return searchResourcesPagedCallable; + } + + public UnaryCallable searchResourcesCallable() { + return searchResourcesCallable; + } + + public UnaryCallable + searchIamPoliciesPagedCallable() { + return searchIamPoliciesPagedCallable; + } + + public UnaryCallable + searchIamPoliciesCallable() { + return searchIamPoliciesCallable; + } + + public UnaryCallable + searchAllResourcesPagedCallable() { + return searchAllResourcesPagedCallable; + } + + public UnaryCallable + searchAllResourcesCallable() { + return searchAllResourcesCallable; + } + + public UnaryCallable + searchAllIamPoliciesPagedCallable() { + return searchAllIamPoliciesPagedCallable; + } + + public UnaryCallable + searchAllIamPoliciesCallable() { + return searchAllIamPoliciesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @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-asset/src/test/java/com/google/cloud/asset/v1p1beta1/AssetServiceClientTest.java b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/AssetServiceClientTest.java new file mode 100644 index 000000000..279ae9185 --- /dev/null +++ b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/AssetServiceClientTest.java @@ -0,0 +1,295 @@ +/* + * 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.cloud.asset.v1p1beta1; + +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchAllResourcesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1p1beta1.AssetServiceClient.SearchResourcesPagedResponse; + +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.common.collect.Lists; +import com.google.protobuf.AbstractMessage; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class AssetServiceClientTest { + private static MockAssetService mockAssetService; + private static MockServiceHelper serviceHelper; + private AssetServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockAssetService = new MockAssetService(); + serviceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockAssetService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + AssetServiceSettings settings = + AssetServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = AssetServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void searchResourcesTest() { + String nextPageToken = ""; + StandardResourceMetadata resultsElement = StandardResourceMetadata.newBuilder().build(); + List results = Arrays.asList(resultsElement); + SearchResourcesResponse expectedResponse = + SearchResourcesResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllResults(results) + .build(); + mockAssetService.addResponse(expectedResponse); + + String scope = "scope109264468"; + String query = "query107944136"; + List assetTypes = new ArrayList<>(); + + SearchResourcesPagedResponse pagedListResponse = + client.searchResources(scope, query, assetTypes); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getResultsList().get(0), resources.get(0)); + + List actualRequests = mockAssetService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SearchResourcesRequest actualRequest = (SearchResourcesRequest) actualRequests.get(0); + + Assert.assertEquals(scope, actualRequest.getScope()); + Assert.assertEquals(query, actualRequest.getQuery()); + Assert.assertEquals(assetTypes, actualRequest.getAssetTypesList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void searchResourcesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockAssetService.addException(exception); + + try { + String scope = "scope109264468"; + String query = "query107944136"; + List assetTypes = new ArrayList<>(); + + client.searchResources(scope, query, assetTypes); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void searchIamPoliciesTest() { + String nextPageToken = ""; + IamPolicySearchResult resultsElement = IamPolicySearchResult.newBuilder().build(); + List results = Arrays.asList(resultsElement); + SearchIamPoliciesResponse expectedResponse = + SearchIamPoliciesResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllResults(results) + .build(); + mockAssetService.addResponse(expectedResponse); + + String scope = "scope109264468"; + String query = "query107944136"; + + SearchIamPoliciesPagedResponse pagedListResponse = client.searchIamPolicies(scope, query); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getResultsList().get(0), resources.get(0)); + + List actualRequests = mockAssetService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SearchIamPoliciesRequest actualRequest = (SearchIamPoliciesRequest) actualRequests.get(0); + + Assert.assertEquals(scope, actualRequest.getScope()); + Assert.assertEquals(query, actualRequest.getQuery()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void searchIamPoliciesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockAssetService.addException(exception); + + try { + String scope = "scope109264468"; + String query = "query107944136"; + + client.searchIamPolicies(scope, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void searchAllResourcesTest() { + String nextPageToken = ""; + StandardResourceMetadata resultsElement = StandardResourceMetadata.newBuilder().build(); + List results = Arrays.asList(resultsElement); + SearchAllResourcesResponse expectedResponse = + SearchAllResourcesResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllResults(results) + .build(); + mockAssetService.addResponse(expectedResponse); + + String scope = "scope109264468"; + String query = "query107944136"; + List assetTypes = new ArrayList<>(); + + SearchAllResourcesPagedResponse pagedListResponse = + client.searchAllResources(scope, query, assetTypes); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getResultsList().get(0), resources.get(0)); + + List actualRequests = mockAssetService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SearchAllResourcesRequest actualRequest = (SearchAllResourcesRequest) actualRequests.get(0); + + Assert.assertEquals(scope, actualRequest.getScope()); + Assert.assertEquals(query, actualRequest.getQuery()); + Assert.assertEquals(assetTypes, actualRequest.getAssetTypesList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void searchAllResourcesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockAssetService.addException(exception); + + try { + String scope = "scope109264468"; + String query = "query107944136"; + List assetTypes = new ArrayList<>(); + + client.searchAllResources(scope, query, assetTypes); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void searchAllIamPoliciesTest() { + String nextPageToken = ""; + IamPolicySearchResult resultsElement = IamPolicySearchResult.newBuilder().build(); + List results = Arrays.asList(resultsElement); + SearchAllIamPoliciesResponse expectedResponse = + SearchAllIamPoliciesResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllResults(results) + .build(); + mockAssetService.addResponse(expectedResponse); + + String scope = "scope109264468"; + String query = "query107944136"; + + SearchAllIamPoliciesPagedResponse pagedListResponse = client.searchAllIamPolicies(scope, query); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getResultsList().get(0), resources.get(0)); + + List actualRequests = mockAssetService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SearchAllIamPoliciesRequest actualRequest = (SearchAllIamPoliciesRequest) actualRequests.get(0); + + Assert.assertEquals(scope, actualRequest.getScope()); + Assert.assertEquals(query, actualRequest.getQuery()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void searchAllIamPoliciesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockAssetService.addException(exception); + + try { + String scope = "scope109264468"; + String query = "query107944136"; + + client.searchAllIamPolicies(scope, query); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/MockAssetService.java b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/MockAssetService.java new file mode 100644 index 000000000..2094aa2fb --- /dev/null +++ b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/MockAssetService.java @@ -0,0 +1,57 @@ +/* + * 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.cloud.asset.v1p1beta1; + +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockAssetService implements MockGrpcService { + private final MockAssetServiceImpl serviceImpl; + + public MockAssetService() { + serviceImpl = new MockAssetServiceImpl(); + } + + @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-asset/src/test/java/com/google/cloud/asset/v1p1beta1/MockAssetServiceImpl.java b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/MockAssetServiceImpl.java new file mode 100644 index 000000000..7e7013b0c --- /dev/null +++ b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/MockAssetServiceImpl.java @@ -0,0 +1,121 @@ +/* + * 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.cloud.asset.v1p1beta1; + +import com.google.api.core.BetaApi; +import com.google.cloud.asset.v1p1beta1.AssetServiceGrpc.AssetServiceImplBase; +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockAssetServiceImpl extends AssetServiceImplBase { + private List requests; + private Queue responses; + + public MockAssetServiceImpl() { + 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 searchResources( + SearchResourcesRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof SearchResourcesResponse) { + requests.add(request); + responseObserver.onNext((SearchResourcesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void searchIamPolicies( + SearchIamPoliciesRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof SearchIamPoliciesResponse) { + requests.add(request); + responseObserver.onNext((SearchIamPoliciesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void searchAllResources( + SearchAllResourcesRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof SearchAllResourcesResponse) { + requests.add(request); + responseObserver.onNext((SearchAllResourcesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void searchAllIamPolicies( + SearchAllIamPoliciesRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof SearchAllIamPoliciesResponse) { + requests.add(request); + responseObserver.onNext((SearchAllIamPoliciesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/grpc-google-cloud-asset-v1p1beta1/pom.xml b/grpc-google-cloud-asset-v1p1beta1/pom.xml new file mode 100644 index 000000000..f83911b43 --- /dev/null +++ b/grpc-google-cloud-asset-v1p1beta1/pom.xml @@ -0,0 +1,56 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-asset-v1p1beta1 + 0.81.2-SNAPSHOT + grpc-google-cloud-asset-v1p1beta1 + GRPC library for grpc-google-cloud-asset-v1p1beta1 + + com.google.cloud + google-cloud-asset-parent + 0.116.2-beta-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-asset-v1p1beta1 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/grpc-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceGrpc.java b/grpc-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceGrpc.java new file mode 100644 index 000000000..e6665a241 --- /dev/null +++ b/grpc-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceGrpc.java @@ -0,0 +1,806 @@ +/* + * 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.cloud.asset.v1p1beta1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * Asset service definition.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler (version 1.10.0)", + comments = "Source: google/cloud/asset/v1p1beta1/asset_service.proto") +public final class AssetServiceGrpc { + + private AssetServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.asset.v1p1beta1.AssetService"; + + // Static method descriptors that strictly reflect the proto. + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getSearchResourcesMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse> + METHOD_SEARCH_RESOURCES = getSearchResourcesMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse> + getSearchResourcesMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse> + getSearchResourcesMethod() { + return getSearchResourcesMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse> + getSearchResourcesMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse> + getSearchResourcesMethod; + if ((getSearchResourcesMethod = AssetServiceGrpc.getSearchResourcesMethod) == null) { + synchronized (AssetServiceGrpc.class) { + if ((getSearchResourcesMethod = AssetServiceGrpc.getSearchResourcesMethod) == null) { + AssetServiceGrpc.getSearchResourcesMethod = + getSearchResourcesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.asset.v1p1beta1.AssetService", "SearchResources")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new AssetServiceMethodDescriptorSupplier("SearchResources")) + .build(); + } + } + } + return getSearchResourcesMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getSearchIamPoliciesMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse> + METHOD_SEARCH_IAM_POLICIES = getSearchIamPoliciesMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse> + getSearchIamPoliciesMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse> + getSearchIamPoliciesMethod() { + return getSearchIamPoliciesMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse> + getSearchIamPoliciesMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse> + getSearchIamPoliciesMethod; + if ((getSearchIamPoliciesMethod = AssetServiceGrpc.getSearchIamPoliciesMethod) == null) { + synchronized (AssetServiceGrpc.class) { + if ((getSearchIamPoliciesMethod = AssetServiceGrpc.getSearchIamPoliciesMethod) == null) { + AssetServiceGrpc.getSearchIamPoliciesMethod = + getSearchIamPoliciesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.asset.v1p1beta1.AssetService", "SearchIamPolicies")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new AssetServiceMethodDescriptorSupplier("SearchIamPolicies")) + .build(); + } + } + } + return getSearchIamPoliciesMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getSearchAllResourcesMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse> + METHOD_SEARCH_ALL_RESOURCES = getSearchAllResourcesMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse> + getSearchAllResourcesMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse> + getSearchAllResourcesMethod() { + return getSearchAllResourcesMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse> + getSearchAllResourcesMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse> + getSearchAllResourcesMethod; + if ((getSearchAllResourcesMethod = AssetServiceGrpc.getSearchAllResourcesMethod) == null) { + synchronized (AssetServiceGrpc.class) { + if ((getSearchAllResourcesMethod = AssetServiceGrpc.getSearchAllResourcesMethod) == null) { + AssetServiceGrpc.getSearchAllResourcesMethod = + getSearchAllResourcesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.asset.v1p1beta1.AssetService", "SearchAllResources")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new AssetServiceMethodDescriptorSupplier("SearchAllResources")) + .build(); + } + } + } + return getSearchAllResourcesMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getSearchAllIamPoliciesMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse> + METHOD_SEARCH_ALL_IAM_POLICIES = getSearchAllIamPoliciesMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse> + getSearchAllIamPoliciesMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse> + getSearchAllIamPoliciesMethod() { + return getSearchAllIamPoliciesMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse> + getSearchAllIamPoliciesMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse> + getSearchAllIamPoliciesMethod; + if ((getSearchAllIamPoliciesMethod = AssetServiceGrpc.getSearchAllIamPoliciesMethod) == null) { + synchronized (AssetServiceGrpc.class) { + if ((getSearchAllIamPoliciesMethod = AssetServiceGrpc.getSearchAllIamPoliciesMethod) + == null) { + AssetServiceGrpc.getSearchAllIamPoliciesMethod = + getSearchAllIamPoliciesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.asset.v1p1beta1.AssetService", "SearchAllIamPolicies")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new AssetServiceMethodDescriptorSupplier("SearchAllIamPolicies")) + .build(); + } + } + } + return getSearchAllIamPoliciesMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static AssetServiceStub newStub(io.grpc.Channel channel) { + return new AssetServiceStub(channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static AssetServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + return new AssetServiceBlockingStub(channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static AssetServiceFutureStub newFutureStub(io.grpc.Channel channel) { + return new AssetServiceFutureStub(channel); + } + + /** + * + * + *
+   * Asset service definition.
+   * 
+ */ + public abstract static class AssetServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Searches resources which are accessible with .get permission.
+     * 
+ */ + public void searchResources( + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getSearchResourcesMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Searches IAM policies which are accessible with .getIamPolicy permission.
+     * 
+ */ + public void searchIamPolicies( + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getSearchIamPoliciesMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Searches all the resources under a given accessible CRM scope
+     * (project/folder/organization). This RPC gives callers
+     * especially admins the ability to search all the resources under a scope,
+     * even if they don't have .get permission of all the resources. Callers
+     * should have cloud.assets.SearchAllResources permission on the requested
+     * scope, otherwise it will be rejected.
+     * 
+ */ + public void searchAllResources( + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getSearchAllResourcesMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Searches all the IAM policies under a given accessible CRM scope
+     * (project/folder/organization). This RPC gives callers
+     * especially admins the ability to search all the IAM policies under a scope,
+     * even if they don't have .getIamPolicy permission of all the IAM policies.
+     * Callers should have cloud.assets.SearchAllIamPolicies permission on the
+     * requested scope, otherwise it will be rejected.
+     * 
+ */ + public void searchAllIamPolicies( + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getSearchAllIamPoliciesMethodHelper(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getSearchResourcesMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse>( + this, METHODID_SEARCH_RESOURCES))) + .addMethod( + getSearchIamPoliciesMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse>( + this, METHODID_SEARCH_IAM_POLICIES))) + .addMethod( + getSearchAllResourcesMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse>( + this, METHODID_SEARCH_ALL_RESOURCES))) + .addMethod( + getSearchAllIamPoliciesMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse>( + this, METHODID_SEARCH_ALL_IAM_POLICIES))) + .build(); + } + } + + /** + * + * + *
+   * Asset service definition.
+   * 
+ */ + public static final class AssetServiceStub extends io.grpc.stub.AbstractStub { + private AssetServiceStub(io.grpc.Channel channel) { + super(channel); + } + + private AssetServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected AssetServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new AssetServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Searches resources which are accessible with .get permission.
+     * 
+ */ + public void searchResources( + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getSearchResourcesMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Searches IAM policies which are accessible with .getIamPolicy permission.
+     * 
+ */ + public void searchIamPolicies( + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getSearchIamPoliciesMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Searches all the resources under a given accessible CRM scope
+     * (project/folder/organization). This RPC gives callers
+     * especially admins the ability to search all the resources under a scope,
+     * even if they don't have .get permission of all the resources. Callers
+     * should have cloud.assets.SearchAllResources permission on the requested
+     * scope, otherwise it will be rejected.
+     * 
+ */ + public void searchAllResources( + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getSearchAllResourcesMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Searches all the IAM policies under a given accessible CRM scope
+     * (project/folder/organization). This RPC gives callers
+     * especially admins the ability to search all the IAM policies under a scope,
+     * even if they don't have .getIamPolicy permission of all the IAM policies.
+     * Callers should have cloud.assets.SearchAllIamPolicies permission on the
+     * requested scope, otherwise it will be rejected.
+     * 
+ */ + public void searchAllIamPolicies( + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getSearchAllIamPoliciesMethodHelper(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Asset service definition.
+   * 
+ */ + public static final class AssetServiceBlockingStub + extends io.grpc.stub.AbstractStub { + private AssetServiceBlockingStub(io.grpc.Channel channel) { + super(channel); + } + + private AssetServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected AssetServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new AssetServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Searches resources which are accessible with .get permission.
+     * 
+ */ + public com.google.cloud.asset.v1p1beta1.SearchResourcesResponse searchResources( + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest request) { + return blockingUnaryCall( + getChannel(), getSearchResourcesMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Searches IAM policies which are accessible with .getIamPolicy permission.
+     * 
+ */ + public com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse searchIamPolicies( + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest request) { + return blockingUnaryCall( + getChannel(), getSearchIamPoliciesMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Searches all the resources under a given accessible CRM scope
+     * (project/folder/organization). This RPC gives callers
+     * especially admins the ability to search all the resources under a scope,
+     * even if they don't have .get permission of all the resources. Callers
+     * should have cloud.assets.SearchAllResources permission on the requested
+     * scope, otherwise it will be rejected.
+     * 
+ */ + public com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse searchAllResources( + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest request) { + return blockingUnaryCall( + getChannel(), getSearchAllResourcesMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Searches all the IAM policies under a given accessible CRM scope
+     * (project/folder/organization). This RPC gives callers
+     * especially admins the ability to search all the IAM policies under a scope,
+     * even if they don't have .getIamPolicy permission of all the IAM policies.
+     * Callers should have cloud.assets.SearchAllIamPolicies permission on the
+     * requested scope, otherwise it will be rejected.
+     * 
+ */ + public com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse searchAllIamPolicies( + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest request) { + return blockingUnaryCall( + getChannel(), getSearchAllIamPoliciesMethodHelper(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Asset service definition.
+   * 
+ */ + public static final class AssetServiceFutureStub + extends io.grpc.stub.AbstractStub { + private AssetServiceFutureStub(io.grpc.Channel channel) { + super(channel); + } + + private AssetServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected AssetServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new AssetServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Searches resources which are accessible with .get permission.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse> + searchResources(com.google.cloud.asset.v1p1beta1.SearchResourcesRequest request) { + return futureUnaryCall( + getChannel().newCall(getSearchResourcesMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Searches IAM policies which are accessible with .getIamPolicy permission.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse> + searchIamPolicies(com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest request) { + return futureUnaryCall( + getChannel().newCall(getSearchIamPoliciesMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Searches all the resources under a given accessible CRM scope
+     * (project/folder/organization). This RPC gives callers
+     * especially admins the ability to search all the resources under a scope,
+     * even if they don't have .get permission of all the resources. Callers
+     * should have cloud.assets.SearchAllResources permission on the requested
+     * scope, otherwise it will be rejected.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse> + searchAllResources(com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest request) { + return futureUnaryCall( + getChannel().newCall(getSearchAllResourcesMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Searches all the IAM policies under a given accessible CRM scope
+     * (project/folder/organization). This RPC gives callers
+     * especially admins the ability to search all the IAM policies under a scope,
+     * even if they don't have .getIamPolicy permission of all the IAM policies.
+     * Callers should have cloud.assets.SearchAllIamPolicies permission on the
+     * requested scope, otherwise it will be rejected.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse> + searchAllIamPolicies(com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest request) { + return futureUnaryCall( + getChannel().newCall(getSearchAllIamPoliciesMethodHelper(), getCallOptions()), request); + } + } + + private static final int METHODID_SEARCH_RESOURCES = 0; + private static final int METHODID_SEARCH_IAM_POLICIES = 1; + private static final int METHODID_SEARCH_ALL_RESOURCES = 2; + private static final int METHODID_SEARCH_ALL_IAM_POLICIES = 3; + + 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 AssetServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(AssetServiceImplBase 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_SEARCH_RESOURCES: + serviceImpl.searchResources( + (com.google.cloud.asset.v1p1beta1.SearchResourcesRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse>) + responseObserver); + break; + case METHODID_SEARCH_IAM_POLICIES: + serviceImpl.searchIamPolicies( + (com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse>) + responseObserver); + break; + case METHODID_SEARCH_ALL_RESOURCES: + serviceImpl.searchAllResources( + (com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse>) + responseObserver); + break; + case METHODID_SEARCH_ALL_IAM_POLICIES: + serviceImpl.searchAllIamPolicies( + (com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse>) + 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 AssetServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + AssetServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("AssetService"); + } + } + + private static final class AssetServiceFileDescriptorSupplier + extends AssetServiceBaseDescriptorSupplier { + AssetServiceFileDescriptorSupplier() {} + } + + private static final class AssetServiceMethodDescriptorSupplier + extends AssetServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + AssetServiceMethodDescriptorSupplier(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 (AssetServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new AssetServiceFileDescriptorSupplier()) + .addMethod(getSearchResourcesMethodHelper()) + .addMethod(getSearchIamPoliciesMethodHelper()) + .addMethod(getSearchAllResourcesMethodHelper()) + .addMethod(getSearchAllIamPoliciesMethodHelper()) + .build(); + } + } + } + return result; + } +} diff --git a/pom.xml b/pom.xml index 54d74ff0d..b56b97ca6 100644 --- a/pom.xml +++ b/pom.xml @@ -84,6 +84,11 @@ proto-google-cloud-asset-v1 0.81.2-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-asset-v1p1beta1 + 0.81.2-SNAPSHOT + com.google.api.grpc proto-google-cloud-asset-v1p2beta1 @@ -104,6 +109,11 @@ grpc-google-cloud-asset-v1beta1 0.81.2-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-asset-v1p1beta1 + 0.81.2-SNAPSHOT + com.google.api.grpc grpc-google-cloud-asset-v1p2beta1 @@ -228,10 +238,12 @@ proto-google-cloud-asset-v1 + proto-google-cloud-asset-v1p1beta1 proto-google-cloud-asset-v1p2beta1 proto-google-cloud-asset-v1beta1 grpc-google-cloud-asset-v1 grpc-google-cloud-asset-v1beta1 + grpc-google-cloud-asset-v1p1beta1 grpc-google-cloud-asset-v1p2beta1 google-cloud-asset google-cloud-asset-bom diff --git a/proto-google-cloud-asset-v1/pom.xml b/proto-google-cloud-asset-v1/pom.xml index 5650ef58c..da82eb995 100644 --- a/proto-google-cloud-asset-v1/pom.xml +++ b/proto-google-cloud-asset-v1/pom.xml @@ -33,9 +33,5 @@ com.google.api.grpc proto-google-iam-v1 - - com.google.api.grpc - proto-google-common-protos - \ No newline at end of file diff --git a/proto-google-cloud-asset-v1p1beta1/pom.xml b/proto-google-cloud-asset-v1p1beta1/pom.xml new file mode 100644 index 000000000..f6f3cf040 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-asset-v1p1beta1 + 0.81.2-SNAPSHOT + proto-google-cloud-asset-v1p1beta1 + PROTO library for proto-google-cloud-asset-v1p1beta1 + + com.google.cloud + google-cloud-asset-parent + 0.116.2-beta-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + \ No newline at end of file diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetProto.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetProto.java new file mode 100644 index 000000000..6f143a98c --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetProto.java @@ -0,0 +1,90 @@ +/* + * 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/cloud/asset/v1p1beta1/assets.proto + +package com.google.cloud.asset.v1p1beta1; + +public final class AssetProto { + private AssetProto() {} + + 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_cloud_asset_v1p1beta1_StandardResourceMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_StandardResourceMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n)google/cloud/asset/v1p1beta1/assets.pr" + + "oto\022\034google.cloud.asset.v1p1beta1\032\032googl" + + "e/iam/v1/policy.proto\032\034google/api/annota" + + "tions.proto\"x\n\030StandardResourceMetadata\022" + + "\014\n\004name\030\001 \001(\t\022\022\n\nasset_type\030\002 \001(\t\022\017\n\007pro" + + "ject\030\003 \001(\t\022\024\n\014display_name\030\004 \001(\t\022\023\n\013desc" + + "ription\030\005 \001(\t\"a\n\025IamPolicySearchResult\022\020" + + "\n\010resource\030\001 \001(\t\022\017\n\007project\030\003 \001(\t\022%\n\006pol" + + "icy\030\004 \001(\0132\025.google.iam.v1.PolicyB\264\001\n com" + + ".google.cloud.asset.v1p1beta1B\nAssetProt" + + "oP\001ZAgoogle.golang.org/genproto/googleap" + + "is/cloud/asset/v1p1beta1;asset\370\001\001\252\002\034Goog" + + "le.Cloud.Asset.V1P1Beta1\312\002\034Google\\Cloud\\" + + "Asset\\V1p1beta1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.iam.v1.PolicyProto.getDescriptor(), + com.google.api.AnnotationsProto.getDescriptor(), + }); + internal_static_google_cloud_asset_v1p1beta1_StandardResourceMetadata_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_asset_v1p1beta1_StandardResourceMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_StandardResourceMetadata_descriptor, + new java.lang.String[] { + "Name", "AssetType", "Project", "DisplayName", "Description", + }); + internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_descriptor, + new java.lang.String[] { + "Resource", "Project", "Policy", + }); + com.google.iam.v1.PolicyProto.getDescriptor(); + com.google.api.AnnotationsProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceProto.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceProto.java new file mode 100644 index 000000000..d1c00d749 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceProto.java @@ -0,0 +1,217 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +public final class AssetServiceProto { + private AssetServiceProto() {} + + 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_cloud_asset_v1p1beta1_SearchResourcesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_SearchResourcesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n0google/cloud/asset/v1p1beta1/asset_ser" + + "vice.proto\022\034google.cloud.asset.v1p1beta1" + + "\032\034google/api/annotations.proto\032\037google/a" + + "pi/field_behavior.proto\032)google/cloud/as" + + "set/v1p1beta1/assets.proto\032\027google/api/c" + + "lient.proto\"\213\001\n\026SearchResourcesRequest\022\022" + + "\n\005scope\030\001 \001(\tB\003\340A\002\022\022\n\005query\030\002 \001(\tB\003\340A\001\022\030" + + "\n\013asset_types\030\003 \003(\tB\003\340A\001\022\026\n\tpage_size\030\004 " + + "\001(\005B\003\340A\001\022\027\n\npage_token\030\005 \001(\tB\003\340A\001\"{\n\027Sea" + + "rchResourcesResponse\022G\n\007results\030\001 \003(\01326." + + "google.cloud.asset.v1p1beta1.StandardRes" + + "ourceMetadata\022\027\n\017next_page_token\030\002 \001(\t\"s" + + "\n\030SearchIamPoliciesRequest\022\022\n\005scope\030\004 \001(" + + "\tB\003\340A\002\022\022\n\005query\030\001 \001(\tB\003\340A\001\022\026\n\tpage_size\030" + + "\002 \001(\005B\003\340A\001\022\027\n\npage_token\030\003 \001(\tB\003\340A\001\"z\n\031S" + + "earchIamPoliciesResponse\022D\n\007results\030\001 \003(" + + "\01323.google.cloud.asset.v1p1beta1.IamPoli" + + "cySearchResult\022\027\n\017next_page_token\030\002 \001(\t\"" + + "\216\001\n\031SearchAllResourcesRequest\022\022\n\005scope\030\001" + + " \001(\tB\003\340A\002\022\022\n\005query\030\002 \001(\tB\003\340A\001\022\030\n\013asset_t" + + "ypes\030\003 \003(\tB\003\340A\001\022\026\n\tpage_size\030\004 \001(\005B\003\340A\001\022" + + "\027\n\npage_token\030\005 \001(\tB\003\340A\001\"~\n\032SearchAllRes" + + "ourcesResponse\022G\n\007results\030\001 \003(\01326.google" + + ".cloud.asset.v1p1beta1.StandardResourceM" + + "etadata\022\027\n\017next_page_token\030\002 \001(\t\"v\n\033Sear" + + "chAllIamPoliciesRequest\022\022\n\005scope\030\001 \001(\tB\003" + + "\340A\002\022\022\n\005query\030\002 \001(\tB\003\340A\001\022\026\n\tpage_size\030\003 \001" + + "(\005B\003\340A\001\022\027\n\npage_token\030\004 \001(\tB\003\340A\001\"}\n\034Sear" + + "chAllIamPoliciesResponse\022D\n\007results\030\001 \003(" + + "\01323.google.cloud.asset.v1p1beta1.IamPoli" + + "cySearchResult\022\027\n\017next_page_token\030\002 \001(\t2" + + "\265\006\n\014AssetService\022\243\001\n\017SearchResources\0224.g" + + "oogle.cloud.asset.v1p1beta1.SearchResour" + + "cesRequest\0325.google.cloud.asset.v1p1beta" + + "1.SearchResourcesResponse\"#\202\323\344\223\002\035\022\033/v1p1" + + "beta1/resources:search\022\253\001\n\021SearchIamPoli" + + "cies\0226.google.cloud.asset.v1p1beta1.Sear" + + "chIamPoliciesRequest\0327.google.cloud.asse" + + "t.v1p1beta1.SearchIamPoliciesResponse\"%\202" + + "\323\344\223\002\037\022\035/v1p1beta1/iamPolicies:search\022\273\001\n" + + "\022SearchAllResources\0227.google.cloud.asset" + + ".v1p1beta1.SearchAllResourcesRequest\0328.g" + + "oogle.cloud.asset.v1p1beta1.SearchAllRes" + + "ourcesResponse\"2\202\323\344\223\002,\022*/v1p1beta1/{scop" + + "e=*/*}/resources:searchAll\022\303\001\n\024SearchAll" + + "IamPolicies\0229.google.cloud.asset.v1p1bet" + + "a1.SearchAllIamPoliciesRequest\032:.google." + + "cloud.asset.v1p1beta1.SearchAllIamPolici" + + "esResponse\"4\202\323\344\223\002.\022,/v1p1beta1/{scope=*/" + + "*}/iamPolicies:searchAll\032M\312A\031cloudasset." + + "googleapis.com\322A.https://www.googleapis." + + "com/auth/cloud-platformB\270\001\n com.google.c" + + "loud.asset.v1p1beta1B\021AssetServiceProtoP" + + "\001ZAgoogle.golang.org/genproto/googleapis" + + "/cloud/asset/v1p1beta1;asset\252\002\034Google.Cl" + + "oud.Asset.V1P1Beta1\312\002\034Google\\Cloud\\Asset" + + "\\V1p1beta1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.cloud.asset.v1p1beta1.AssetProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + }); + internal_static_google_cloud_asset_v1p1beta1_SearchResourcesRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_asset_v1p1beta1_SearchResourcesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_SearchResourcesRequest_descriptor, + new java.lang.String[] { + "Scope", "Query", "AssetTypes", "PageSize", "PageToken", + }); + internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_descriptor, + new java.lang.String[] { + "Results", "NextPageToken", + }); + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_descriptor, + new java.lang.String[] { + "Scope", "Query", "PageSize", "PageToken", + }); + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_descriptor, + new java.lang.String[] { + "Results", "NextPageToken", + }); + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_descriptor, + new java.lang.String[] { + "Scope", "Query", "AssetTypes", "PageSize", "PageToken", + }); + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_descriptor, + new java.lang.String[] { + "Results", "NextPageToken", + }); + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_descriptor, + new java.lang.String[] { + "Scope", "Query", "PageSize", "PageToken", + }); + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_descriptor, + new java.lang.String[] { + "Results", "NextPageToken", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + 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.FieldBehaviorProto.getDescriptor(); + com.google.cloud.asset.v1p1beta1.AssetProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/IamPolicySearchResult.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/IamPolicySearchResult.java new file mode 100644 index 000000000..854e725ad --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/IamPolicySearchResult.java @@ -0,0 +1,1128 @@ +/* + * 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/cloud/asset/v1p1beta1/assets.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * The result for a IAM Policy search.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.IamPolicySearchResult} + */ +public final class IamPolicySearchResult extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.IamPolicySearchResult) + IamPolicySearchResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use IamPolicySearchResult.newBuilder() to construct. + private IamPolicySearchResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private IamPolicySearchResult() { + resource_ = ""; + project_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new IamPolicySearchResult(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private IamPolicySearchResult( + 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(); + + resource_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + project_ = s; + break; + } + case 34: + { + com.google.iam.v1.Policy.Builder subBuilder = null; + if (policy_ != null) { + subBuilder = policy_.toBuilder(); + } + policy_ = input.readMessage(com.google.iam.v1.Policy.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(policy_); + policy_ = subBuilder.buildPartial(); + } + + 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.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.class, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder.class); + } + + public static final int RESOURCE_FIELD_NUMBER = 1; + private volatile java.lang.Object resource_; + /** + * + * + *
+   * The [full resource
+   * name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+   * of the resource associated with this IAM policy.
+   * 
+ * + * string resource = 1; + * + * @return The resource. + */ + public java.lang.String getResource() { + java.lang.Object ref = resource_; + 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(); + resource_ = s; + return s; + } + } + /** + * + * + *
+   * The [full resource
+   * name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+   * of the resource associated with this IAM policy.
+   * 
+ * + * string resource = 1; + * + * @return The bytes for resource. + */ + public com.google.protobuf.ByteString getResourceBytes() { + java.lang.Object ref = resource_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PROJECT_FIELD_NUMBER = 3; + private volatile java.lang.Object project_; + /** + * + * + *
+   * The project that the associated GCP resource belongs to, in the form of
+   * `projects/{project_number}`. If an IAM policy is set on a resource (like VM
+   * instance, Cloud Storage bucket), the project field will indicate the
+   * project that contains the resource. If an IAM policy is set on a folder or
+   * orgnization, the project field will be empty.
+   * 
+ * + * string project = 3; + * + * @return The project. + */ + public java.lang.String getProject() { + java.lang.Object ref = project_; + 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(); + project_ = s; + return s; + } + } + /** + * + * + *
+   * The project that the associated GCP resource belongs to, in the form of
+   * `projects/{project_number}`. If an IAM policy is set on a resource (like VM
+   * instance, Cloud Storage bucket), the project field will indicate the
+   * project that contains the resource. If an IAM policy is set on a folder or
+   * orgnization, the project field will be empty.
+   * 
+ * + * string project = 3; + * + * @return The bytes for project. + */ + public com.google.protobuf.ByteString getProjectBytes() { + java.lang.Object ref = project_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + project_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int POLICY_FIELD_NUMBER = 4; + private com.google.iam.v1.Policy policy_; + /** + * + * + *
+   * Representation of the actual Cloud IAM policy set on a cloud resource. For
+   * each resource, there must be at most one Cloud IAM policy set on it.
+   * 
+ * + * .google.iam.v1.Policy policy = 4; + * + * @return Whether the policy field is set. + */ + public boolean hasPolicy() { + return policy_ != null; + } + /** + * + * + *
+   * Representation of the actual Cloud IAM policy set on a cloud resource. For
+   * each resource, there must be at most one Cloud IAM policy set on it.
+   * 
+ * + * .google.iam.v1.Policy policy = 4; + * + * @return The policy. + */ + public com.google.iam.v1.Policy getPolicy() { + return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_; + } + /** + * + * + *
+   * Representation of the actual Cloud IAM policy set on a cloud resource. For
+   * each resource, there must be at most one Cloud IAM policy set on it.
+   * 
+ * + * .google.iam.v1.Policy policy = 4; + */ + public com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder() { + return getPolicy(); + } + + 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 (!getResourceBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, resource_); + } + if (!getProjectBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, project_); + } + if (policy_ != null) { + output.writeMessage(4, getPolicy()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getResourceBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, resource_); + } + if (!getProjectBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, project_); + } + if (policy_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getPolicy()); + } + 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.cloud.asset.v1p1beta1.IamPolicySearchResult)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult other = + (com.google.cloud.asset.v1p1beta1.IamPolicySearchResult) obj; + + if (!getResource().equals(other.getResource())) return false; + if (!getProject().equals(other.getProject())) return false; + if (hasPolicy() != other.hasPolicy()) return false; + if (hasPolicy()) { + if (!getPolicy().equals(other.getPolicy())) 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) + RESOURCE_FIELD_NUMBER; + hash = (53 * hash) + getResource().hashCode(); + hash = (37 * hash) + PROJECT_FIELD_NUMBER; + hash = (53 * hash) + getProject().hashCode(); + if (hasPolicy()) { + hash = (37 * hash) + POLICY_FIELD_NUMBER; + hash = (53 * hash) + getPolicy().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult 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.cloud.asset.v1p1beta1.IamPolicySearchResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult 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.cloud.asset.v1p1beta1.IamPolicySearchResult parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult 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.cloud.asset.v1p1beta1.IamPolicySearchResult parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult 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.cloud.asset.v1p1beta1.IamPolicySearchResult 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; + } + /** + * + * + *
+   * The result for a IAM Policy search.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.IamPolicySearchResult} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.IamPolicySearchResult) + com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.class, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.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(); + resource_ = ""; + + project_ = ""; + + if (policyBuilder_ == null) { + policy_ = null; + } else { + policy_ = null; + policyBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_IamPolicySearchResult_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult build() { + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult buildPartial() { + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult result = + new com.google.cloud.asset.v1p1beta1.IamPolicySearchResult(this); + result.resource_ = resource_; + result.project_ = project_; + if (policyBuilder_ == null) { + result.policy_ = policy_; + } else { + result.policy_ = policyBuilder_.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.cloud.asset.v1p1beta1.IamPolicySearchResult) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.IamPolicySearchResult) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.IamPolicySearchResult other) { + if (other == com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.getDefaultInstance()) + return this; + if (!other.getResource().isEmpty()) { + resource_ = other.resource_; + onChanged(); + } + if (!other.getProject().isEmpty()) { + project_ = other.project_; + onChanged(); + } + if (other.hasPolicy()) { + mergePolicy(other.getPolicy()); + } + 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.cloud.asset.v1p1beta1.IamPolicySearchResult parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.IamPolicySearchResult) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object resource_ = ""; + /** + * + * + *
+     * The [full resource
+     * name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * of the resource associated with this IAM policy.
+     * 
+ * + * string resource = 1; + * + * @return The resource. + */ + public java.lang.String getResource() { + java.lang.Object ref = resource_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resource_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The [full resource
+     * name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * of the resource associated with this IAM policy.
+     * 
+ * + * string resource = 1; + * + * @return The bytes for resource. + */ + public com.google.protobuf.ByteString getResourceBytes() { + java.lang.Object ref = resource_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The [full resource
+     * name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * of the resource associated with this IAM policy.
+     * 
+ * + * string resource = 1; + * + * @param value The resource to set. + * @return This builder for chaining. + */ + public Builder setResource(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + resource_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The [full resource
+     * name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * of the resource associated with this IAM policy.
+     * 
+ * + * string resource = 1; + * + * @return This builder for chaining. + */ + public Builder clearResource() { + + resource_ = getDefaultInstance().getResource(); + onChanged(); + return this; + } + /** + * + * + *
+     * The [full resource
+     * name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * of the resource associated with this IAM policy.
+     * 
+ * + * string resource = 1; + * + * @param value The bytes for resource to set. + * @return This builder for chaining. + */ + public Builder setResourceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + resource_ = value; + onChanged(); + return this; + } + + private java.lang.Object project_ = ""; + /** + * + * + *
+     * The project that the associated GCP resource belongs to, in the form of
+     * `projects/{project_number}`. If an IAM policy is set on a resource (like VM
+     * instance, Cloud Storage bucket), the project field will indicate the
+     * project that contains the resource. If an IAM policy is set on a folder or
+     * orgnization, the project field will be empty.
+     * 
+ * + * string project = 3; + * + * @return The project. + */ + public java.lang.String getProject() { + java.lang.Object ref = project_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + project_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The project that the associated GCP resource belongs to, in the form of
+     * `projects/{project_number}`. If an IAM policy is set on a resource (like VM
+     * instance, Cloud Storage bucket), the project field will indicate the
+     * project that contains the resource. If an IAM policy is set on a folder or
+     * orgnization, the project field will be empty.
+     * 
+ * + * string project = 3; + * + * @return The bytes for project. + */ + public com.google.protobuf.ByteString getProjectBytes() { + java.lang.Object ref = project_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + project_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The project that the associated GCP resource belongs to, in the form of
+     * `projects/{project_number}`. If an IAM policy is set on a resource (like VM
+     * instance, Cloud Storage bucket), the project field will indicate the
+     * project that contains the resource. If an IAM policy is set on a folder or
+     * orgnization, the project field will be empty.
+     * 
+ * + * string project = 3; + * + * @param value The project to set. + * @return This builder for chaining. + */ + public Builder setProject(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + project_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The project that the associated GCP resource belongs to, in the form of
+     * `projects/{project_number}`. If an IAM policy is set on a resource (like VM
+     * instance, Cloud Storage bucket), the project field will indicate the
+     * project that contains the resource. If an IAM policy is set on a folder or
+     * orgnization, the project field will be empty.
+     * 
+ * + * string project = 3; + * + * @return This builder for chaining. + */ + public Builder clearProject() { + + project_ = getDefaultInstance().getProject(); + onChanged(); + return this; + } + /** + * + * + *
+     * The project that the associated GCP resource belongs to, in the form of
+     * `projects/{project_number}`. If an IAM policy is set on a resource (like VM
+     * instance, Cloud Storage bucket), the project field will indicate the
+     * project that contains the resource. If an IAM policy is set on a folder or
+     * orgnization, the project field will be empty.
+     * 
+ * + * string project = 3; + * + * @param value The bytes for project to set. + * @return This builder for chaining. + */ + public Builder setProjectBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + project_ = value; + onChanged(); + return this; + } + + private com.google.iam.v1.Policy policy_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v1.Policy, + com.google.iam.v1.Policy.Builder, + com.google.iam.v1.PolicyOrBuilder> + policyBuilder_; + /** + * + * + *
+     * Representation of the actual Cloud IAM policy set on a cloud resource. For
+     * each resource, there must be at most one Cloud IAM policy set on it.
+     * 
+ * + * .google.iam.v1.Policy policy = 4; + * + * @return Whether the policy field is set. + */ + public boolean hasPolicy() { + return policyBuilder_ != null || policy_ != null; + } + /** + * + * + *
+     * Representation of the actual Cloud IAM policy set on a cloud resource. For
+     * each resource, there must be at most one Cloud IAM policy set on it.
+     * 
+ * + * .google.iam.v1.Policy policy = 4; + * + * @return The policy. + */ + public com.google.iam.v1.Policy getPolicy() { + if (policyBuilder_ == null) { + return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_; + } else { + return policyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Representation of the actual Cloud IAM policy set on a cloud resource. For
+     * each resource, there must be at most one Cloud IAM policy set on it.
+     * 
+ * + * .google.iam.v1.Policy policy = 4; + */ + public Builder setPolicy(com.google.iam.v1.Policy value) { + if (policyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + policy_ = value; + onChanged(); + } else { + policyBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Representation of the actual Cloud IAM policy set on a cloud resource. For
+     * each resource, there must be at most one Cloud IAM policy set on it.
+     * 
+ * + * .google.iam.v1.Policy policy = 4; + */ + public Builder setPolicy(com.google.iam.v1.Policy.Builder builderForValue) { + if (policyBuilder_ == null) { + policy_ = builderForValue.build(); + onChanged(); + } else { + policyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Representation of the actual Cloud IAM policy set on a cloud resource. For
+     * each resource, there must be at most one Cloud IAM policy set on it.
+     * 
+ * + * .google.iam.v1.Policy policy = 4; + */ + public Builder mergePolicy(com.google.iam.v1.Policy value) { + if (policyBuilder_ == null) { + if (policy_ != null) { + policy_ = com.google.iam.v1.Policy.newBuilder(policy_).mergeFrom(value).buildPartial(); + } else { + policy_ = value; + } + onChanged(); + } else { + policyBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Representation of the actual Cloud IAM policy set on a cloud resource. For
+     * each resource, there must be at most one Cloud IAM policy set on it.
+     * 
+ * + * .google.iam.v1.Policy policy = 4; + */ + public Builder clearPolicy() { + if (policyBuilder_ == null) { + policy_ = null; + onChanged(); + } else { + policy_ = null; + policyBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Representation of the actual Cloud IAM policy set on a cloud resource. For
+     * each resource, there must be at most one Cloud IAM policy set on it.
+     * 
+ * + * .google.iam.v1.Policy policy = 4; + */ + public com.google.iam.v1.Policy.Builder getPolicyBuilder() { + + onChanged(); + return getPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Representation of the actual Cloud IAM policy set on a cloud resource. For
+     * each resource, there must be at most one Cloud IAM policy set on it.
+     * 
+ * + * .google.iam.v1.Policy policy = 4; + */ + public com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder() { + if (policyBuilder_ != null) { + return policyBuilder_.getMessageOrBuilder(); + } else { + return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_; + } + } + /** + * + * + *
+     * Representation of the actual Cloud IAM policy set on a cloud resource. For
+     * each resource, there must be at most one Cloud IAM policy set on it.
+     * 
+ * + * .google.iam.v1.Policy policy = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v1.Policy, + com.google.iam.v1.Policy.Builder, + com.google.iam.v1.PolicyOrBuilder> + getPolicyFieldBuilder() { + if (policyBuilder_ == null) { + policyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v1.Policy, + com.google.iam.v1.Policy.Builder, + com.google.iam.v1.PolicyOrBuilder>(getPolicy(), getParentForChildren(), isClean()); + policy_ = null; + } + return policyBuilder_; + } + + @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.cloud.asset.v1p1beta1.IamPolicySearchResult) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.IamPolicySearchResult) + private static final com.google.cloud.asset.v1p1beta1.IamPolicySearchResult DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.IamPolicySearchResult(); + } + + public static com.google.cloud.asset.v1p1beta1.IamPolicySearchResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public IamPolicySearchResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new IamPolicySearchResult(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.cloud.asset.v1p1beta1.IamPolicySearchResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/IamPolicySearchResultOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/IamPolicySearchResultOrBuilder.java new file mode 100644 index 000000000..6c6a03ea3 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/IamPolicySearchResultOrBuilder.java @@ -0,0 +1,125 @@ +/* + * 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/cloud/asset/v1p1beta1/assets.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface IamPolicySearchResultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.IamPolicySearchResult) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The [full resource
+   * name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+   * of the resource associated with this IAM policy.
+   * 
+ * + * string resource = 1; + * + * @return The resource. + */ + java.lang.String getResource(); + /** + * + * + *
+   * The [full resource
+   * name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+   * of the resource associated with this IAM policy.
+   * 
+ * + * string resource = 1; + * + * @return The bytes for resource. + */ + com.google.protobuf.ByteString getResourceBytes(); + + /** + * + * + *
+   * The project that the associated GCP resource belongs to, in the form of
+   * `projects/{project_number}`. If an IAM policy is set on a resource (like VM
+   * instance, Cloud Storage bucket), the project field will indicate the
+   * project that contains the resource. If an IAM policy is set on a folder or
+   * orgnization, the project field will be empty.
+   * 
+ * + * string project = 3; + * + * @return The project. + */ + java.lang.String getProject(); + /** + * + * + *
+   * The project that the associated GCP resource belongs to, in the form of
+   * `projects/{project_number}`. If an IAM policy is set on a resource (like VM
+   * instance, Cloud Storage bucket), the project field will indicate the
+   * project that contains the resource. If an IAM policy is set on a folder or
+   * orgnization, the project field will be empty.
+   * 
+ * + * string project = 3; + * + * @return The bytes for project. + */ + com.google.protobuf.ByteString getProjectBytes(); + + /** + * + * + *
+   * Representation of the actual Cloud IAM policy set on a cloud resource. For
+   * each resource, there must be at most one Cloud IAM policy set on it.
+   * 
+ * + * .google.iam.v1.Policy policy = 4; + * + * @return Whether the policy field is set. + */ + boolean hasPolicy(); + /** + * + * + *
+   * Representation of the actual Cloud IAM policy set on a cloud resource. For
+   * each resource, there must be at most one Cloud IAM policy set on it.
+   * 
+ * + * .google.iam.v1.Policy policy = 4; + * + * @return The policy. + */ + com.google.iam.v1.Policy getPolicy(); + /** + * + * + *
+   * Representation of the actual Cloud IAM policy set on a cloud resource. For
+   * each resource, there must be at most one Cloud IAM policy set on it.
+   * 
+ * + * .google.iam.v1.Policy policy = 4; + */ + com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesRequest.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesRequest.java new file mode 100644 index 000000000..711fd4208 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesRequest.java @@ -0,0 +1,1158 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * Search all IAM policies request.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest} + */ +public final class SearchAllIamPoliciesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) + SearchAllIamPoliciesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchAllIamPoliciesRequest.newBuilder() to construct. + private SearchAllIamPoliciesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchAllIamPoliciesRequest() { + scope_ = ""; + query_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchAllIamPoliciesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchAllIamPoliciesRequest( + 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(); + + scope_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + query_ = s; + break; + } + case 24: + { + pageSize_ = input.readInt32(); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = 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.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest.class, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest.Builder.class); + } + + public static final int SCOPE_FIELD_NUMBER = 1; + private volatile java.lang.Object scope_; + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + public java.lang.String getScope() { + java.lang.Object ref = scope_; + 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(); + scope_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + public com.google.protobuf.ByteString getScopeBytes() { + java.lang.Object ref = scope_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + scope_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QUERY_FIELD_NUMBER = 2; + private volatile java.lang.Object query_; + /** + * + * + *
+   * Optional. The query statement.
+   * Examples:
+   * * "policy:myuser@mydomain.com"
+   * * "policy:(myuser@mydomain.com viewer)"
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + public java.lang.String getQuery() { + java.lang.Object ref = query_; + 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(); + query_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The query statement.
+   * Examples:
+   * * "policy:myuser@mydomain.com"
+   * * "policy:(myuser@mydomain.com viewer)"
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + public com.google.protobuf.ByteString getQueryBytes() { + java.lang.Object ref = query_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + query_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 3; + private int pageSize_; + /** + * + * + *
+   * Optional. The page size for search result pagination. Returned results may be fewer
+   * than requested. The maximum is 2000. If set to the zero value, the server
+   * will pick an appropriate default.
+   * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 4; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. If present, retrieve the next batch of results from the preceding call to
+   * this method. `page_token` must be the value of `next_page_token` from the
+   * previous response. The values of all other method parameters must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + 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(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. If present, retrieve the next batch of results from the preceding call to
+   * this method. `page_token` must be the value of `next_page_token` from the
+   * previous response. The values of all other method parameters must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = 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 (!getScopeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, scope_); + } + if (!getQueryBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, query_); + } + if (pageSize_ != 0) { + output.writeInt32(3, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, pageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getScopeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, scope_); + } + if (!getQueryBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, query_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, pageToken_); + } + 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest other = + (com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) obj; + + if (!getScope().equals(other.getScope())) return false; + if (!getQuery().equals(other.getQuery())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) 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) + SCOPE_FIELD_NUMBER; + hash = (53 * hash) + getScope().hashCode(); + hash = (37 * hash) + QUERY_FIELD_NUMBER; + hash = (53 * hash) + getQuery().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest 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; + } + /** + * + * + *
+   * Search all IAM policies request.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest.class, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest.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(); + scope_ = ""; + + query_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest + getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest build() { + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest buildPartial() { + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest result = + new com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest(this); + result.scope_ = scope_; + result.query_ = query_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest other) { + if (other + == com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest.getDefaultInstance()) + return this; + if (!other.getScope().isEmpty()) { + scope_ = other.scope_; + onChanged(); + } + if (!other.getQuery().isEmpty()) { + query_ = other.query_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object scope_ = ""; + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + public java.lang.String getScope() { + java.lang.Object ref = scope_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + scope_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + public com.google.protobuf.ByteString getScopeBytes() { + java.lang.Object ref = scope_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + scope_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The scope to set. + * @return This builder for chaining. + */ + public Builder setScope(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + scope_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearScope() { + + scope_ = getDefaultInstance().getScope(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for scope to set. + * @return This builder for chaining. + */ + public Builder setScopeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + scope_ = value; + onChanged(); + return this; + } + + private java.lang.Object query_ = ""; + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + public java.lang.String getQuery() { + java.lang.Object ref = query_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + query_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + public com.google.protobuf.ByteString getQueryBytes() { + java.lang.Object ref = query_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + query_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The query to set. + * @return This builder for chaining. + */ + public Builder setQuery(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + query_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearQuery() { + + query_ = getDefaultInstance().getQuery(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for query to set. + * @return This builder for chaining. + */ + public Builder setQueryBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + query_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The maximum is 2000. If set to the zero value, the server
+     * will pick an appropriate default.
+     * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The maximum is 2000. If set to the zero value, the server
+     * will pick an appropriate default.
+     * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The maximum is 2000. If set to the zero value, the server
+     * will pick an appropriate default.
+     * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) + private static final com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest(); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchAllIamPoliciesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchAllIamPoliciesRequest(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.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesRequestOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesRequestOrBuilder.java new file mode 100644 index 000000000..20b97fbad --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesRequestOrBuilder.java @@ -0,0 +1,135 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface SearchAllIamPoliciesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + java.lang.String getScope(); + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + com.google.protobuf.ByteString getScopeBytes(); + + /** + * + * + *
+   * Optional. The query statement.
+   * Examples:
+   * * "policy:myuser@mydomain.com"
+   * * "policy:(myuser@mydomain.com viewer)"
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + java.lang.String getQuery(); + /** + * + * + *
+   * Optional. The query statement.
+   * Examples:
+   * * "policy:myuser@mydomain.com"
+   * * "policy:(myuser@mydomain.com viewer)"
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + com.google.protobuf.ByteString getQueryBytes(); + + /** + * + * + *
+   * Optional. The page size for search result pagination. Returned results may be fewer
+   * than requested. The maximum is 2000. If set to the zero value, the server
+   * will pick an appropriate default.
+   * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. If present, retrieve the next batch of results from the preceding call to
+   * this method. `page_token` must be the value of `next_page_token` from the
+   * previous response. The values of all other method parameters must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. If present, retrieve the next batch of results from the preceding call to
+   * this method. `page_token` must be the value of `next_page_token` from the
+   * previous response. The values of all other method parameters must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesResponse.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesResponse.java new file mode 100644 index 000000000..dea403cf0 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesResponse.java @@ -0,0 +1,1177 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * Search all IAM policies response.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse} + */ +public final class SearchAllIamPoliciesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse) + SearchAllIamPoliciesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchAllIamPoliciesResponse.newBuilder() to construct. + private SearchAllIamPoliciesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchAllIamPoliciesResponse() { + results_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchAllIamPoliciesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchAllIamPoliciesResponse( + 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: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList< + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult>(); + mutable_bitField0_ |= 0x00000001; + } + results_.add( + input.readMessage( + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.parser(), + extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = 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)) { + results_ = java.util.Collections.unmodifiableList(results_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse.class, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse.Builder.class); + } + + public static final int RESULTS_FIELD_NUMBER = 1; + private java.util.List results_; + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List getResultsList() { + return results_; + } + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List + getResultsOrBuilderList() { + return results_; + } + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public int getResultsCount() { + return results_.size(); + } + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult getResults(int index) { + return results_.get(index); + } + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder getResultsOrBuilder( + int index) { + return results_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * Set if there are more results than those appearing in this response; to get
+   * the next set of results, call this method again, using this value as the
+   * `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + 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(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Set if there are more results than those appearing in this response; to get
+   * the next set of results, call this method again, using this value as the
+   * `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = 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 { + for (int i = 0; i < results_.size(); i++) { + output.writeMessage(1, results_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < results_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, results_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse other = + (com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse) obj; + + if (!getResultsList().equals(other.getResultsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) 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 (getResultsCount() > 0) { + hash = (37 * hash) + RESULTS_FIELD_NUMBER; + hash = (53 * hash) + getResultsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse 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; + } + /** + * + * + *
+   * Search all IAM policies response.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse) + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse.class, + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResultsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + resultsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllIamPoliciesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse + getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse build() { + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse buildPartial() { + com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse result = + new com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse(this); + int from_bitField0_ = bitField0_; + if (resultsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.results_ = results_; + } else { + result.results_ = resultsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse other) { + if (other + == com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse.getDefaultInstance()) + return this; + if (resultsBuilder_ == null) { + if (!other.results_.isEmpty()) { + if (results_.isEmpty()) { + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResultsIsMutable(); + results_.addAll(other.results_); + } + onChanged(); + } + } else { + if (!other.results_.isEmpty()) { + if (resultsBuilder_.isEmpty()) { + resultsBuilder_.dispose(); + resultsBuilder_ = null; + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + resultsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResultsFieldBuilder() + : null; + } else { + resultsBuilder_.addAllMessages(other.results_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List results_ = + java.util.Collections.emptyList(); + + private void ensureResultsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList( + results_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder> + resultsBuilder_; + + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List getResultsList() { + if (resultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(results_); + } else { + return resultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public int getResultsCount() { + if (resultsBuilder_ == null) { + return results_.size(); + } else { + return resultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult getResults(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder setResults( + int index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.set(index, value); + onChanged(); + } else { + resultsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder setResults( + int index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.set(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addResults(com.google.cloud.asset.v1p1beta1.IamPolicySearchResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(value); + onChanged(); + } else { + resultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addResults( + int index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(index, value); + onChanged(); + } else { + resultsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addResults( + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addResults( + int index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addAllResults( + java.lang.Iterable + values) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, results_); + onChanged(); + } else { + resultsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder clearResults() { + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resultsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder removeResults(int index) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.remove(index); + onChanged(); + } else { + resultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder getResultsBuilder( + int index) { + return getResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder getResultsOrBuilder( + int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List + getResultsOrBuilderList() { + if (resultsBuilder_ != null) { + return resultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(results_); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder(com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.getDefaultInstance()); + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder addResultsBuilder( + int index) { + return getResultsFieldBuilder() + .addBuilder( + index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.getDefaultInstance()); + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List + getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder>( + results_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + results_ = null; + } + return resultsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = 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.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse) + private static final com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse(); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchAllIamPoliciesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchAllIamPoliciesResponse(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.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesResponseOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesResponseOrBuilder.java new file mode 100644 index 000000000..6407224fc --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesResponseOrBuilder.java @@ -0,0 +1,111 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface SearchAllIamPoliciesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + java.util.List getResultsList(); + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult getResults(int index); + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + int getResultsCount(); + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + java.util.List + getResultsOrBuilderList(); + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder getResultsOrBuilder(int index); + + /** + * + * + *
+   * Set if there are more results than those appearing in this response; to get
+   * the next set of results, call this method again, using this value as the
+   * `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * Set if there are more results than those appearing in this response; to get
+   * the next set of results, call this method again, using this value as the
+   * `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesRequest.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesRequest.java new file mode 100644 index 000000000..8acdc7cee --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesRequest.java @@ -0,0 +1,1427 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * Search all resources request.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchAllResourcesRequest} + */ +public final class SearchAllResourcesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.SearchAllResourcesRequest) + SearchAllResourcesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchAllResourcesRequest.newBuilder() to construct. + private SearchAllResourcesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchAllResourcesRequest() { + scope_ = ""; + query_ = ""; + assetTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchAllResourcesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchAllResourcesRequest( + 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(); + + scope_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + query_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + assetTypes_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + assetTypes_.add(s); + break; + } + case 32: + { + pageSize_ = input.readInt32(); + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = 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)) { + assetTypes_ = assetTypes_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest.class, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest.Builder.class); + } + + public static final int SCOPE_FIELD_NUMBER = 1; + private volatile java.lang.Object scope_; + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + public java.lang.String getScope() { + java.lang.Object ref = scope_; + 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(); + scope_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + public com.google.protobuf.ByteString getScopeBytes() { + java.lang.Object ref = scope_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + scope_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QUERY_FIELD_NUMBER = 2; + private volatile java.lang.Object query_; + /** + * + * + *
+   * Optional. The query statement.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + public java.lang.String getQuery() { + java.lang.Object ref = query_; + 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(); + query_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The query statement.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + public com.google.protobuf.ByteString getQueryBytes() { + java.lang.Object ref = query_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + query_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ASSET_TYPES_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList assetTypes_; + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the assetTypes. + */ + public com.google.protobuf.ProtocolStringList getAssetTypesList() { + return assetTypes_; + } + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of assetTypes. + */ + public int getAssetTypesCount() { + return assetTypes_.size(); + } + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The assetTypes at the given index. + */ + public java.lang.String getAssetTypes(int index) { + return assetTypes_.get(index); + } + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the assetTypes at the given index. + */ + public com.google.protobuf.ByteString getAssetTypesBytes(int index) { + return assetTypes_.getByteString(index); + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 4; + private int pageSize_; + /** + * + * + *
+   * Optional. The page size for search result pagination. Returned results may be fewer
+   * than requested. The value of this field is capped at 2000.  If set to the
+   * zero value, server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 5; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. If present, then retrieve the next batch of results from the preceding call
+   * to this method.  `page_token` must be the value of `next_page_token` from
+   * the previous response. The values of all other method parameters, must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + 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(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. If present, then retrieve the next batch of results from the preceding call
+   * to this method.  `page_token` must be the value of `next_page_token` from
+   * the previous response. The values of all other method parameters, must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = 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 (!getScopeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, scope_); + } + if (!getQueryBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, query_); + } + for (int i = 0; i < assetTypes_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, assetTypes_.getRaw(i)); + } + if (pageSize_ != 0) { + output.writeInt32(4, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, pageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getScopeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, scope_); + } + if (!getQueryBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, query_); + } + { + int dataSize = 0; + for (int i = 0; i < assetTypes_.size(); i++) { + dataSize += computeStringSizeNoTag(assetTypes_.getRaw(i)); + } + size += dataSize; + size += 1 * getAssetTypesList().size(); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, pageToken_); + } + 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.cloud.asset.v1p1beta1.SearchAllResourcesRequest)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest other = + (com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest) obj; + + if (!getScope().equals(other.getScope())) return false; + if (!getQuery().equals(other.getQuery())) return false; + if (!getAssetTypesList().equals(other.getAssetTypesList())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) 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) + SCOPE_FIELD_NUMBER; + hash = (53 * hash) + getScope().hashCode(); + hash = (37 * hash) + QUERY_FIELD_NUMBER; + hash = (53 * hash) + getQuery().hashCode(); + if (getAssetTypesCount() > 0) { + hash = (37 * hash) + ASSET_TYPES_FIELD_NUMBER; + hash = (53 * hash) + getAssetTypesList().hashCode(); + } + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest 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.cloud.asset.v1p1beta1.SearchAllResourcesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest 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.cloud.asset.v1p1beta1.SearchAllResourcesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest 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.cloud.asset.v1p1beta1.SearchAllResourcesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest 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.cloud.asset.v1p1beta1.SearchAllResourcesRequest 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; + } + /** + * + * + *
+   * Search all resources request.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchAllResourcesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.SearchAllResourcesRequest) + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest.class, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest.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(); + scope_ = ""; + + query_ = ""; + + assetTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest build() { + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest buildPartial() { + com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest result = + new com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest(this); + int from_bitField0_ = bitField0_; + result.scope_ = scope_; + result.query_ = query_; + if (((bitField0_ & 0x00000001) != 0)) { + assetTypes_ = assetTypes_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.assetTypes_ = assetTypes_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + 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.cloud.asset.v1p1beta1.SearchAllResourcesRequest) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest other) { + if (other == com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest.getDefaultInstance()) + return this; + if (!other.getScope().isEmpty()) { + scope_ = other.scope_; + onChanged(); + } + if (!other.getQuery().isEmpty()) { + query_ = other.query_; + onChanged(); + } + if (!other.assetTypes_.isEmpty()) { + if (assetTypes_.isEmpty()) { + assetTypes_ = other.assetTypes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAssetTypesIsMutable(); + assetTypes_.addAll(other.assetTypes_); + } + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + 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.cloud.asset.v1p1beta1.SearchAllResourcesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object scope_ = ""; + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + public java.lang.String getScope() { + java.lang.Object ref = scope_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + scope_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + public com.google.protobuf.ByteString getScopeBytes() { + java.lang.Object ref = scope_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + scope_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The scope to set. + * @return This builder for chaining. + */ + public Builder setScope(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + scope_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearScope() { + + scope_ = getDefaultInstance().getScope(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for scope to set. + * @return This builder for chaining. + */ + public Builder setScopeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + scope_ = value; + onChanged(); + return this; + } + + private java.lang.Object query_ = ""; + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + public java.lang.String getQuery() { + java.lang.Object ref = query_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + query_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + public com.google.protobuf.ByteString getQueryBytes() { + java.lang.Object ref = query_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + query_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The query to set. + * @return This builder for chaining. + */ + public Builder setQuery(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + query_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearQuery() { + + query_ = getDefaultInstance().getQuery(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for query to set. + * @return This builder for chaining. + */ + public Builder setQueryBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + query_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList assetTypes_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureAssetTypesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + assetTypes_ = new com.google.protobuf.LazyStringArrayList(assetTypes_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the assetTypes. + */ + public com.google.protobuf.ProtocolStringList getAssetTypesList() { + return assetTypes_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of assetTypes. + */ + public int getAssetTypesCount() { + return assetTypes_.size(); + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The assetTypes at the given index. + */ + public java.lang.String getAssetTypes(int index) { + return assetTypes_.get(index); + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the assetTypes at the given index. + */ + public com.google.protobuf.ByteString getAssetTypesBytes(int index) { + return assetTypes_.getByteString(index); + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The assetTypes to set. + * @return This builder for chaining. + */ + public Builder setAssetTypes(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAssetTypesIsMutable(); + assetTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The assetTypes to add. + * @return This builder for chaining. + */ + public Builder addAssetTypes(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAssetTypesIsMutable(); + assetTypes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The assetTypes to add. + * @return This builder for chaining. + */ + public Builder addAllAssetTypes(java.lang.Iterable values) { + ensureAssetTypesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, assetTypes_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearAssetTypes() { + assetTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the assetTypes to add. + * @return This builder for chaining. + */ + public Builder addAssetTypesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAssetTypesIsMutable(); + assetTypes_.add(value); + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The value of this field is capped at 2000.  If set to the
+     * zero value, server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The value of this field is capped at 2000.  If set to the
+     * zero value, server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The value of this field is capped at 2000.  If set to the
+     * zero value, server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = 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.cloud.asset.v1p1beta1.SearchAllResourcesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.SearchAllResourcesRequest) + private static final com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest(); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchAllResourcesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchAllResourcesRequest(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.cloud.asset.v1p1beta1.SearchAllResourcesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesRequestOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesRequestOrBuilder.java new file mode 100644 index 000000000..29d63cb8d --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesRequestOrBuilder.java @@ -0,0 +1,184 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface SearchAllResourcesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.SearchAllResourcesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + java.lang.String getScope(); + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + com.google.protobuf.ByteString getScopeBytes(); + + /** + * + * + *
+   * Optional. The query statement.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + java.lang.String getQuery(); + /** + * + * + *
+   * Optional. The query statement.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + com.google.protobuf.ByteString getQueryBytes(); + + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the assetTypes. + */ + java.util.List getAssetTypesList(); + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of assetTypes. + */ + int getAssetTypesCount(); + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The assetTypes at the given index. + */ + java.lang.String getAssetTypes(int index); + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the assetTypes at the given index. + */ + com.google.protobuf.ByteString getAssetTypesBytes(int index); + + /** + * + * + *
+   * Optional. The page size for search result pagination. Returned results may be fewer
+   * than requested. The value of this field is capped at 2000.  If set to the
+   * zero value, server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. If present, then retrieve the next batch of results from the preceding call
+   * to this method.  `page_token` must be the value of `next_page_token` from
+   * the previous response. The values of all other method parameters, must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. If present, then retrieve the next batch of results from the preceding call
+   * to this method.  `page_token` must be the value of `next_page_token` from
+   * the previous response. The values of all other method parameters, must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesResponse.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesResponse.java new file mode 100644 index 000000000..3361999c2 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesResponse.java @@ -0,0 +1,1158 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * Search all resources response.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchAllResourcesResponse} + */ +public final class SearchAllResourcesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.SearchAllResourcesResponse) + SearchAllResourcesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchAllResourcesResponse.newBuilder() to construct. + private SearchAllResourcesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchAllResourcesResponse() { + results_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchAllResourcesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchAllResourcesResponse( + 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: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList< + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata>(); + mutable_bitField0_ |= 0x00000001; + } + results_.add( + input.readMessage( + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.parser(), + extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = 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)) { + results_ = java.util.Collections.unmodifiableList(results_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse.class, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse.Builder.class); + } + + public static final int RESULTS_FIELD_NUMBER = 1; + private java.util.List results_; + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List + getResultsList() { + return results_; + } + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List< + ? extends com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder> + getResultsOrBuilderList() { + return results_; + } + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public int getResultsCount() { + return results_.size(); + } + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata getResults(int index) { + return results_.get(index); + } + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder getResultsOrBuilder( + int index) { + return results_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included.  To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + 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(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included.  To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = 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 { + for (int i = 0; i < results_.size(); i++) { + output.writeMessage(1, results_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < results_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, results_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + 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.cloud.asset.v1p1beta1.SearchAllResourcesResponse)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse other = + (com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse) obj; + + if (!getResultsList().equals(other.getResultsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) 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 (getResultsCount() > 0) { + hash = (37 * hash) + RESULTS_FIELD_NUMBER; + hash = (53 * hash) + getResultsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse 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.cloud.asset.v1p1beta1.SearchAllResourcesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse 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.cloud.asset.v1p1beta1.SearchAllResourcesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse 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.cloud.asset.v1p1beta1.SearchAllResourcesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse 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.cloud.asset.v1p1beta1.SearchAllResourcesResponse 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; + } + /** + * + * + *
+   * Search all resources response.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchAllResourcesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.SearchAllResourcesResponse) + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse.class, + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResultsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + resultsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchAllResourcesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse build() { + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse buildPartial() { + com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse result = + new com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse(this); + int from_bitField0_ = bitField0_; + if (resultsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.results_ = results_; + } else { + result.results_ = resultsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + 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.cloud.asset.v1p1beta1.SearchAllResourcesResponse) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse other) { + if (other == com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse.getDefaultInstance()) + return this; + if (resultsBuilder_ == null) { + if (!other.results_.isEmpty()) { + if (results_.isEmpty()) { + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResultsIsMutable(); + results_.addAll(other.results_); + } + onChanged(); + } + } else { + if (!other.results_.isEmpty()) { + if (resultsBuilder_.isEmpty()) { + resultsBuilder_.dispose(); + resultsBuilder_ = null; + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + resultsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResultsFieldBuilder() + : null; + } else { + resultsBuilder_.addAllMessages(other.results_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + 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.cloud.asset.v1p1beta1.SearchAllResourcesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List results_ = + java.util.Collections.emptyList(); + + private void ensureResultsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList( + results_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder> + resultsBuilder_; + + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List + getResultsList() { + if (resultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(results_); + } else { + return resultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public int getResultsCount() { + if (resultsBuilder_ == null) { + return results_.size(); + } else { + return resultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata getResults(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder setResults( + int index, com.google.cloud.asset.v1p1beta1.StandardResourceMetadata value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.set(index, value); + onChanged(); + } else { + resultsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder setResults( + int index, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.set(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addResults(com.google.cloud.asset.v1p1beta1.StandardResourceMetadata value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(value); + onChanged(); + } else { + resultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addResults( + int index, com.google.cloud.asset.v1p1beta1.StandardResourceMetadata value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(index, value); + onChanged(); + } else { + resultsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addResults( + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addResults( + int index, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addAllResults( + java.lang.Iterable + values) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, results_); + onChanged(); + } else { + resultsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder clearResults() { + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resultsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder removeResults(int index) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.remove(index); + onChanged(); + } else { + resultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder getResultsBuilder( + int index) { + return getResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder getResultsOrBuilder( + int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List< + ? extends com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder> + getResultsOrBuilderList() { + if (resultsBuilder_ != null) { + return resultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(results_); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder( + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.getDefaultInstance()); + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder addResultsBuilder( + int index) { + return getResultsFieldBuilder() + .addBuilder( + index, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.getDefaultInstance()); + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List + getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder>( + results_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + results_ = null; + } + return resultsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = 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.cloud.asset.v1p1beta1.SearchAllResourcesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.SearchAllResourcesResponse) + private static final com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse(); + } + + public static com.google.cloud.asset.v1p1beta1.SearchAllResourcesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchAllResourcesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchAllResourcesResponse(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.cloud.asset.v1p1beta1.SearchAllResourcesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesResponseOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesResponseOrBuilder.java new file mode 100644 index 000000000..183a1d699 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesResponseOrBuilder.java @@ -0,0 +1,106 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface SearchAllResourcesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.SearchAllResourcesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + java.util.List getResultsList(); + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata getResults(int index); + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + int getResultsCount(); + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + java.util.List + getResultsOrBuilderList(); + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder getResultsOrBuilder(int index); + + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included.  To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included.  To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesRequest.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesRequest.java new file mode 100644 index 000000000..277089bfd --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesRequest.java @@ -0,0 +1,1155 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * Search IAM policies request.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest} + */ +public final class SearchIamPoliciesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) + SearchIamPoliciesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchIamPoliciesRequest.newBuilder() to construct. + private SearchIamPoliciesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchIamPoliciesRequest() { + scope_ = ""; + query_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchIamPoliciesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchIamPoliciesRequest( + 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(); + + query_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + scope_ = 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.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest.class, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest.Builder.class); + } + + public static final int SCOPE_FIELD_NUMBER = 4; + private volatile java.lang.Object scope_; + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + public java.lang.String getScope() { + java.lang.Object ref = scope_; + 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(); + scope_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + public com.google.protobuf.ByteString getScopeBytes() { + java.lang.Object ref = scope_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + scope_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QUERY_FIELD_NUMBER = 1; + private volatile java.lang.Object query_; + /** + * + * + *
+   * Optional. The query statement.
+   * Examples:
+   * * "policy:myuser@mydomain.com"
+   * * "policy:(myuser@mydomain.com viewer)"
+   * 
+ * + * string query = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + public java.lang.String getQuery() { + java.lang.Object ref = query_; + 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(); + query_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The query statement.
+   * Examples:
+   * * "policy:myuser@mydomain.com"
+   * * "policy:(myuser@mydomain.com viewer)"
+   * 
+ * + * string query = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + public com.google.protobuf.ByteString getQueryBytes() { + java.lang.Object ref = query_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + query_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Optional. The page size for search result pagination. Returned results may be fewer
+   * than requested. The maximum is 2000. If set to the zero value, the server
+   * will pick an appropriate default.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. If present, retrieve the next batch of results from the preceding call to
+   * this method. `page_token` must be the value of `next_page_token` from the
+   * previous response. The values of all other method parameters must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + 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(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. If present, retrieve the next batch of results from the preceding call to
+   * this method. `page_token` must be the value of `next_page_token` from the
+   * previous response. The values of all other method parameters must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = 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 (!getQueryBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, query_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (!getScopeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, scope_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getQueryBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, query_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (!getScopeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, scope_); + } + 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.cloud.asset.v1p1beta1.SearchIamPoliciesRequest)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest other = + (com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) obj; + + if (!getScope().equals(other.getScope())) return false; + if (!getQuery().equals(other.getQuery())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) 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) + SCOPE_FIELD_NUMBER; + hash = (53 * hash) + getScope().hashCode(); + hash = (37 * hash) + QUERY_FIELD_NUMBER; + hash = (53 * hash) + getQuery().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest 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.cloud.asset.v1p1beta1.SearchIamPoliciesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest 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.cloud.asset.v1p1beta1.SearchIamPoliciesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest 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.cloud.asset.v1p1beta1.SearchIamPoliciesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest 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.cloud.asset.v1p1beta1.SearchIamPoliciesRequest 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; + } + /** + * + * + *
+   * Search IAM policies request.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest.class, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest.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(); + scope_ = ""; + + query_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest build() { + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest buildPartial() { + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest result = + new com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest(this); + result.scope_ = scope_; + result.query_ = query_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + 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.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest other) { + if (other == com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest.getDefaultInstance()) + return this; + if (!other.getScope().isEmpty()) { + scope_ = other.scope_; + onChanged(); + } + if (!other.getQuery().isEmpty()) { + query_ = other.query_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + 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.cloud.asset.v1p1beta1.SearchIamPoliciesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object scope_ = ""; + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + public java.lang.String getScope() { + java.lang.Object ref = scope_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + scope_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + public com.google.protobuf.ByteString getScopeBytes() { + java.lang.Object ref = scope_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + scope_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The scope to set. + * @return This builder for chaining. + */ + public Builder setScope(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + scope_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearScope() { + + scope_ = getDefaultInstance().getScope(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for scope to set. + * @return This builder for chaining. + */ + public Builder setScopeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + scope_ = value; + onChanged(); + return this; + } + + private java.lang.Object query_ = ""; + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + public java.lang.String getQuery() { + java.lang.Object ref = query_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + query_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + public com.google.protobuf.ByteString getQueryBytes() { + java.lang.Object ref = query_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + query_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The query to set. + * @return This builder for chaining. + */ + public Builder setQuery(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + query_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearQuery() { + + query_ = getDefaultInstance().getQuery(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The query statement.
+     * Examples:
+     * * "policy:myuser@mydomain.com"
+     * * "policy:(myuser@mydomain.com viewer)"
+     * 
+ * + * string query = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for query to set. + * @return This builder for chaining. + */ + public Builder setQueryBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + query_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The maximum is 2000. If set to the zero value, the server
+     * will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The maximum is 2000. If set to the zero value, the server
+     * will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The maximum is 2000. If set to the zero value, the server
+     * will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, retrieve the next batch of results from the preceding call to
+     * this method. `page_token` must be the value of `next_page_token` from the
+     * previous response. The values of all other method parameters must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = 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.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) + private static final com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest(); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchIamPoliciesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchIamPoliciesRequest(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.cloud.asset.v1p1beta1.SearchIamPoliciesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesRequestOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesRequestOrBuilder.java new file mode 100644 index 000000000..236b92dc7 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesRequestOrBuilder.java @@ -0,0 +1,135 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface SearchIamPoliciesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.SearchIamPoliciesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + java.lang.String getScope(); + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + com.google.protobuf.ByteString getScopeBytes(); + + /** + * + * + *
+   * Optional. The query statement.
+   * Examples:
+   * * "policy:myuser@mydomain.com"
+   * * "policy:(myuser@mydomain.com viewer)"
+   * 
+ * + * string query = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + java.lang.String getQuery(); + /** + * + * + *
+   * Optional. The query statement.
+   * Examples:
+   * * "policy:myuser@mydomain.com"
+   * * "policy:(myuser@mydomain.com viewer)"
+   * 
+ * + * string query = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + com.google.protobuf.ByteString getQueryBytes(); + + /** + * + * + *
+   * Optional. The page size for search result pagination. Returned results may be fewer
+   * than requested. The maximum is 2000. If set to the zero value, the server
+   * will pick an appropriate default.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. If present, retrieve the next batch of results from the preceding call to
+   * this method. `page_token` must be the value of `next_page_token` from the
+   * previous response. The values of all other method parameters must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. If present, retrieve the next batch of results from the preceding call to
+   * this method. `page_token` must be the value of `next_page_token` from the
+   * previous response. The values of all other method parameters must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesResponse.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesResponse.java new file mode 100644 index 000000000..85dda83eb --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesResponse.java @@ -0,0 +1,1173 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * Search IAM policies response.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse} + */ +public final class SearchIamPoliciesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse) + SearchIamPoliciesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchIamPoliciesResponse.newBuilder() to construct. + private SearchIamPoliciesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchIamPoliciesResponse() { + results_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchIamPoliciesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchIamPoliciesResponse( + 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: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList< + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult>(); + mutable_bitField0_ |= 0x00000001; + } + results_.add( + input.readMessage( + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.parser(), + extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = 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)) { + results_ = java.util.Collections.unmodifiableList(results_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse.class, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse.Builder.class); + } + + public static final int RESULTS_FIELD_NUMBER = 1; + private java.util.List results_; + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List getResultsList() { + return results_; + } + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List + getResultsOrBuilderList() { + return results_; + } + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public int getResultsCount() { + return results_.size(); + } + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult getResults(int index) { + return results_.get(index); + } + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder getResultsOrBuilder( + int index) { + return results_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * Set if there are more results than those appearing in this response; to get
+   * the next set of results, call this method again, using this value as the
+   * `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + 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(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Set if there are more results than those appearing in this response; to get
+   * the next set of results, call this method again, using this value as the
+   * `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = 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 { + for (int i = 0; i < results_.size(); i++) { + output.writeMessage(1, results_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < results_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, results_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + 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.cloud.asset.v1p1beta1.SearchIamPoliciesResponse)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse other = + (com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse) obj; + + if (!getResultsList().equals(other.getResultsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) 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 (getResultsCount() > 0) { + hash = (37 * hash) + RESULTS_FIELD_NUMBER; + hash = (53 * hash) + getResultsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse 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.cloud.asset.v1p1beta1.SearchIamPoliciesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse 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.cloud.asset.v1p1beta1.SearchIamPoliciesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse 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.cloud.asset.v1p1beta1.SearchIamPoliciesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse 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.cloud.asset.v1p1beta1.SearchIamPoliciesResponse 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; + } + /** + * + * + *
+   * Search IAM policies response.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse) + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse.class, + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResultsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + resultsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchIamPoliciesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse build() { + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse buildPartial() { + com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse result = + new com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse(this); + int from_bitField0_ = bitField0_; + if (resultsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.results_ = results_; + } else { + result.results_ = resultsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + 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.cloud.asset.v1p1beta1.SearchIamPoliciesResponse) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse other) { + if (other == com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse.getDefaultInstance()) + return this; + if (resultsBuilder_ == null) { + if (!other.results_.isEmpty()) { + if (results_.isEmpty()) { + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResultsIsMutable(); + results_.addAll(other.results_); + } + onChanged(); + } + } else { + if (!other.results_.isEmpty()) { + if (resultsBuilder_.isEmpty()) { + resultsBuilder_.dispose(); + resultsBuilder_ = null; + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + resultsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResultsFieldBuilder() + : null; + } else { + resultsBuilder_.addAllMessages(other.results_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + 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.cloud.asset.v1p1beta1.SearchIamPoliciesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List results_ = + java.util.Collections.emptyList(); + + private void ensureResultsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList( + results_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder> + resultsBuilder_; + + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List getResultsList() { + if (resultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(results_); + } else { + return resultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public int getResultsCount() { + if (resultsBuilder_ == null) { + return results_.size(); + } else { + return resultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult getResults(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder setResults( + int index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.set(index, value); + onChanged(); + } else { + resultsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder setResults( + int index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.set(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addResults(com.google.cloud.asset.v1p1beta1.IamPolicySearchResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(value); + onChanged(); + } else { + resultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addResults( + int index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(index, value); + onChanged(); + } else { + resultsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addResults( + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addResults( + int index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder addAllResults( + java.lang.Iterable + values) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, results_); + onChanged(); + } else { + resultsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder clearResults() { + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resultsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public Builder removeResults(int index) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.remove(index); + onChanged(); + } else { + resultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder getResultsBuilder( + int index) { + return getResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder getResultsOrBuilder( + int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List + getResultsOrBuilderList() { + if (resultsBuilder_ != null) { + return resultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(results_); + } + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder(com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.getDefaultInstance()); + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder addResultsBuilder( + int index) { + return getResultsFieldBuilder() + .addBuilder( + index, com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.getDefaultInstance()); + } + /** + * + * + *
+     * A list of IamPolicy that match the search query. Related information such
+     * as the associated resource is returned along with the policy.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + public java.util.List + getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult.Builder, + com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder>( + results_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + results_ = null; + } + return resultsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Set if there are more results than those appearing in this response; to get
+     * the next set of results, call this method again, using this value as the
+     * `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = 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.cloud.asset.v1p1beta1.SearchIamPoliciesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse) + private static final com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse(); + } + + public static com.google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchIamPoliciesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchIamPoliciesResponse(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.cloud.asset.v1p1beta1.SearchIamPoliciesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesResponseOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesResponseOrBuilder.java new file mode 100644 index 000000000..55ddfc598 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesResponseOrBuilder.java @@ -0,0 +1,111 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface SearchIamPoliciesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.SearchIamPoliciesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + java.util.List getResultsList(); + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + com.google.cloud.asset.v1p1beta1.IamPolicySearchResult getResults(int index); + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + int getResultsCount(); + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + java.util.List + getResultsOrBuilderList(); + /** + * + * + *
+   * A list of IamPolicy that match the search query. Related information such
+   * as the associated resource is returned along with the policy.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.IamPolicySearchResult results = 1; + */ + com.google.cloud.asset.v1p1beta1.IamPolicySearchResultOrBuilder getResultsOrBuilder(int index); + + /** + * + * + *
+   * Set if there are more results than those appearing in this response; to get
+   * the next set of results, call this method again, using this value as the
+   * `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * Set if there are more results than those appearing in this response; to get
+   * the next set of results, call this method again, using this value as the
+   * `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesRequest.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesRequest.java new file mode 100644 index 000000000..8ce052689 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesRequest.java @@ -0,0 +1,1427 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * Search resource request.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchResourcesRequest} + */ +public final class SearchResourcesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.SearchResourcesRequest) + SearchResourcesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchResourcesRequest.newBuilder() to construct. + private SearchResourcesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchResourcesRequest() { + scope_ = ""; + query_ = ""; + assetTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchResourcesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchResourcesRequest( + 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(); + + scope_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + query_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + assetTypes_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + assetTypes_.add(s); + break; + } + case 32: + { + pageSize_ = input.readInt32(); + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = 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)) { + assetTypes_ = assetTypes_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest.class, + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest.Builder.class); + } + + public static final int SCOPE_FIELD_NUMBER = 1; + private volatile java.lang.Object scope_; + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + public java.lang.String getScope() { + java.lang.Object ref = scope_; + 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(); + scope_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + public com.google.protobuf.ByteString getScopeBytes() { + java.lang.Object ref = scope_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + scope_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int QUERY_FIELD_NUMBER = 2; + private volatile java.lang.Object query_; + /** + * + * + *
+   * Optional. The query statement.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + public java.lang.String getQuery() { + java.lang.Object ref = query_; + 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(); + query_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The query statement.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + public com.google.protobuf.ByteString getQueryBytes() { + java.lang.Object ref = query_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + query_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ASSET_TYPES_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList assetTypes_; + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the assetTypes. + */ + public com.google.protobuf.ProtocolStringList getAssetTypesList() { + return assetTypes_; + } + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of assetTypes. + */ + public int getAssetTypesCount() { + return assetTypes_.size(); + } + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The assetTypes at the given index. + */ + public java.lang.String getAssetTypes(int index) { + return assetTypes_.get(index); + } + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the assetTypes at the given index. + */ + public com.google.protobuf.ByteString getAssetTypesBytes(int index) { + return assetTypes_.getByteString(index); + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 4; + private int pageSize_; + /** + * + * + *
+   * Optional. The page size for search result pagination. Returned results may be fewer
+   * than requested. The value of this field is capped at 2000.  If set to the
+   * zero value, server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 5; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. If present, then retrieve the next batch of results from the preceding call
+   * to this method.  `page_token` must be the value of `next_page_token` from
+   * the previous response. The values of all other method parameters, must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + 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(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. If present, then retrieve the next batch of results from the preceding call
+   * to this method.  `page_token` must be the value of `next_page_token` from
+   * the previous response. The values of all other method parameters, must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = 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 (!getScopeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, scope_); + } + if (!getQueryBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, query_); + } + for (int i = 0; i < assetTypes_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, assetTypes_.getRaw(i)); + } + if (pageSize_ != 0) { + output.writeInt32(4, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, pageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getScopeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, scope_); + } + if (!getQueryBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, query_); + } + { + int dataSize = 0; + for (int i = 0; i < assetTypes_.size(); i++) { + dataSize += computeStringSizeNoTag(assetTypes_.getRaw(i)); + } + size += dataSize; + size += 1 * getAssetTypesList().size(); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, pageToken_); + } + 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.cloud.asset.v1p1beta1.SearchResourcesRequest)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest other = + (com.google.cloud.asset.v1p1beta1.SearchResourcesRequest) obj; + + if (!getScope().equals(other.getScope())) return false; + if (!getQuery().equals(other.getQuery())) return false; + if (!getAssetTypesList().equals(other.getAssetTypesList())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) 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) + SCOPE_FIELD_NUMBER; + hash = (53 * hash) + getScope().hashCode(); + hash = (37 * hash) + QUERY_FIELD_NUMBER; + hash = (53 * hash) + getQuery().hashCode(); + if (getAssetTypesCount() > 0) { + hash = (37 * hash) + ASSET_TYPES_FIELD_NUMBER; + hash = (53 * hash) + getAssetTypesList().hashCode(); + } + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest 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.cloud.asset.v1p1beta1.SearchResourcesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest 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.cloud.asset.v1p1beta1.SearchResourcesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest 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.cloud.asset.v1p1beta1.SearchResourcesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest 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.cloud.asset.v1p1beta1.SearchResourcesRequest 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; + } + /** + * + * + *
+   * Search resource request.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchResourcesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.SearchResourcesRequest) + com.google.cloud.asset.v1p1beta1.SearchResourcesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest.class, + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.SearchResourcesRequest.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(); + scope_ = ""; + + query_ = ""; + + assetTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchResourcesRequest getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.SearchResourcesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchResourcesRequest build() { + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchResourcesRequest buildPartial() { + com.google.cloud.asset.v1p1beta1.SearchResourcesRequest result = + new com.google.cloud.asset.v1p1beta1.SearchResourcesRequest(this); + int from_bitField0_ = bitField0_; + result.scope_ = scope_; + result.query_ = query_; + if (((bitField0_ & 0x00000001) != 0)) { + assetTypes_ = assetTypes_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.assetTypes_ = assetTypes_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + 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.cloud.asset.v1p1beta1.SearchResourcesRequest) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.SearchResourcesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.SearchResourcesRequest other) { + if (other == com.google.cloud.asset.v1p1beta1.SearchResourcesRequest.getDefaultInstance()) + return this; + if (!other.getScope().isEmpty()) { + scope_ = other.scope_; + onChanged(); + } + if (!other.getQuery().isEmpty()) { + query_ = other.query_; + onChanged(); + } + if (!other.assetTypes_.isEmpty()) { + if (assetTypes_.isEmpty()) { + assetTypes_ = other.assetTypes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAssetTypesIsMutable(); + assetTypes_.addAll(other.assetTypes_); + } + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + 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.cloud.asset.v1p1beta1.SearchResourcesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.SearchResourcesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object scope_ = ""; + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + public java.lang.String getScope() { + java.lang.Object ref = scope_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + scope_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + public com.google.protobuf.ByteString getScopeBytes() { + java.lang.Object ref = scope_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + scope_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The scope to set. + * @return This builder for chaining. + */ + public Builder setScope(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + scope_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearScope() { + + scope_ = getDefaultInstance().getScope(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The relative name of an asset. The search is limited to the resources
+     * within the `scope`. The allowed value must be:
+     * * Organization number (such as "organizations/123")
+     * * Folder number(such as "folders/1234")
+     * * Project number (such as "projects/12345")
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for scope to set. + * @return This builder for chaining. + */ + public Builder setScopeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + scope_ = value; + onChanged(); + return this; + } + + private java.lang.Object query_ = ""; + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + public java.lang.String getQuery() { + java.lang.Object ref = query_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + query_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + public com.google.protobuf.ByteString getQueryBytes() { + java.lang.Object ref = query_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + query_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The query to set. + * @return This builder for chaining. + */ + public Builder setQuery(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + query_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearQuery() { + + query_ = getDefaultInstance().getQuery(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The query statement.
+     * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for query to set. + * @return This builder for chaining. + */ + public Builder setQueryBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + query_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList assetTypes_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureAssetTypesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + assetTypes_ = new com.google.protobuf.LazyStringArrayList(assetTypes_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the assetTypes. + */ + public com.google.protobuf.ProtocolStringList getAssetTypesList() { + return assetTypes_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of assetTypes. + */ + public int getAssetTypesCount() { + return assetTypes_.size(); + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The assetTypes at the given index. + */ + public java.lang.String getAssetTypes(int index) { + return assetTypes_.get(index); + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the assetTypes at the given index. + */ + public com.google.protobuf.ByteString getAssetTypesBytes(int index) { + return assetTypes_.getByteString(index); + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The assetTypes to set. + * @return This builder for chaining. + */ + public Builder setAssetTypes(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAssetTypesIsMutable(); + assetTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The assetTypes to add. + * @return This builder for chaining. + */ + public Builder addAssetTypes(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAssetTypesIsMutable(); + assetTypes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The assetTypes to add. + * @return This builder for chaining. + */ + public Builder addAllAssetTypes(java.lang.Iterable values) { + ensureAssetTypesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, assetTypes_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearAssetTypes() { + assetTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of asset types that this request searches for. If empty, it will
+     * search all the supported asset types.
+     * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the assetTypes to add. + * @return This builder for chaining. + */ + public Builder addAssetTypesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAssetTypesIsMutable(); + assetTypes_.add(value); + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The value of this field is capped at 2000.  If set to the
+     * zero value, server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The value of this field is capped at 2000.  If set to the
+     * zero value, server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The page size for search result pagination. Returned results may be fewer
+     * than requested. The value of this field is capped at 2000.  If set to the
+     * zero value, server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, then retrieve the next batch of results from the preceding call
+     * to this method.  `page_token` must be the value of `next_page_token` from
+     * the previous response. The values of all other method parameters, must be
+     * identical to those in the previous call.
+     * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = 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.cloud.asset.v1p1beta1.SearchResourcesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.SearchResourcesRequest) + private static final com.google.cloud.asset.v1p1beta1.SearchResourcesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.SearchResourcesRequest(); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchResourcesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchResourcesRequest(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.cloud.asset.v1p1beta1.SearchResourcesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesRequestOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesRequestOrBuilder.java new file mode 100644 index 000000000..ea226bf72 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesRequestOrBuilder.java @@ -0,0 +1,184 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface SearchResourcesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.SearchResourcesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + java.lang.String getScope(); + /** + * + * + *
+   * Required. The relative name of an asset. The search is limited to the resources
+   * within the `scope`. The allowed value must be:
+   * * Organization number (such as "organizations/123")
+   * * Folder number(such as "folders/1234")
+   * * Project number (such as "projects/12345")
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + com.google.protobuf.ByteString getScopeBytes(); + + /** + * + * + *
+   * Optional. The query statement.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + java.lang.String getQuery(); + /** + * + * + *
+   * Optional. The query statement.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for query. + */ + com.google.protobuf.ByteString getQueryBytes(); + + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the assetTypes. + */ + java.util.List getAssetTypesList(); + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of assetTypes. + */ + int getAssetTypesCount(); + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The assetTypes at the given index. + */ + java.lang.String getAssetTypes(int index); + /** + * + * + *
+   * Optional. A list of asset types that this request searches for. If empty, it will
+   * search all the supported asset types.
+   * 
+ * + * repeated string asset_types = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the assetTypes at the given index. + */ + com.google.protobuf.ByteString getAssetTypesBytes(int index); + + /** + * + * + *
+   * Optional. The page size for search result pagination. Returned results may be fewer
+   * than requested. The value of this field is capped at 2000.  If set to the
+   * zero value, server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. If present, then retrieve the next batch of results from the preceding call
+   * to this method.  `page_token` must be the value of `next_page_token` from
+   * the previous response. The values of all other method parameters, must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. If present, then retrieve the next batch of results from the preceding call
+   * to this method.  `page_token` must be the value of `next_page_token` from
+   * the previous response. The values of all other method parameters, must be
+   * identical to those in the previous call.
+   * 
+ * + * string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesResponse.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesResponse.java new file mode 100644 index 000000000..2b646d60c --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesResponse.java @@ -0,0 +1,1158 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * Search resource response.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchResourcesResponse} + */ +public final class SearchResourcesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.SearchResourcesResponse) + SearchResourcesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use SearchResourcesResponse.newBuilder() to construct. + private SearchResourcesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SearchResourcesResponse() { + results_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SearchResourcesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SearchResourcesResponse( + 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: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList< + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata>(); + mutable_bitField0_ |= 0x00000001; + } + results_.add( + input.readMessage( + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.parser(), + extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = 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)) { + results_ = java.util.Collections.unmodifiableList(results_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse.class, + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse.Builder.class); + } + + public static final int RESULTS_FIELD_NUMBER = 1; + private java.util.List results_; + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List + getResultsList() { + return results_; + } + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List< + ? extends com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder> + getResultsOrBuilderList() { + return results_; + } + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public int getResultsCount() { + return results_.size(); + } + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata getResults(int index) { + return results_.get(index); + } + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder getResultsOrBuilder( + int index) { + return results_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included.  To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + 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(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included.  To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = 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 { + for (int i = 0; i < results_.size(); i++) { + output.writeMessage(1, results_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < results_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, results_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + 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.cloud.asset.v1p1beta1.SearchResourcesResponse)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse other = + (com.google.cloud.asset.v1p1beta1.SearchResourcesResponse) obj; + + if (!getResultsList().equals(other.getResultsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) 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 (getResultsCount() > 0) { + hash = (37 * hash) + RESULTS_FIELD_NUMBER; + hash = (53 * hash) + getResultsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse 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.cloud.asset.v1p1beta1.SearchResourcesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse 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.cloud.asset.v1p1beta1.SearchResourcesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse 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.cloud.asset.v1p1beta1.SearchResourcesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse 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.cloud.asset.v1p1beta1.SearchResourcesResponse 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; + } + /** + * + * + *
+   * Search resource response.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.SearchResourcesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.SearchResourcesResponse) + com.google.cloud.asset.v1p1beta1.SearchResourcesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse.class, + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.SearchResourcesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResultsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + resultsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetServiceProto + .internal_static_google_cloud_asset_v1p1beta1_SearchResourcesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchResourcesResponse getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.SearchResourcesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchResourcesResponse build() { + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.SearchResourcesResponse buildPartial() { + com.google.cloud.asset.v1p1beta1.SearchResourcesResponse result = + new com.google.cloud.asset.v1p1beta1.SearchResourcesResponse(this); + int from_bitField0_ = bitField0_; + if (resultsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + results_ = java.util.Collections.unmodifiableList(results_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.results_ = results_; + } else { + result.results_ = resultsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + 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.cloud.asset.v1p1beta1.SearchResourcesResponse) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.SearchResourcesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.SearchResourcesResponse other) { + if (other == com.google.cloud.asset.v1p1beta1.SearchResourcesResponse.getDefaultInstance()) + return this; + if (resultsBuilder_ == null) { + if (!other.results_.isEmpty()) { + if (results_.isEmpty()) { + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResultsIsMutable(); + results_.addAll(other.results_); + } + onChanged(); + } + } else { + if (!other.results_.isEmpty()) { + if (resultsBuilder_.isEmpty()) { + resultsBuilder_.dispose(); + resultsBuilder_ = null; + results_ = other.results_; + bitField0_ = (bitField0_ & ~0x00000001); + resultsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResultsFieldBuilder() + : null; + } else { + resultsBuilder_.addAllMessages(other.results_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + 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.cloud.asset.v1p1beta1.SearchResourcesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.SearchResourcesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List results_ = + java.util.Collections.emptyList(); + + private void ensureResultsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + results_ = + new java.util.ArrayList( + results_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder> + resultsBuilder_; + + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List + getResultsList() { + if (resultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(results_); + } else { + return resultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public int getResultsCount() { + if (resultsBuilder_ == null) { + return results_.size(); + } else { + return resultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata getResults(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder setResults( + int index, com.google.cloud.asset.v1p1beta1.StandardResourceMetadata value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.set(index, value); + onChanged(); + } else { + resultsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder setResults( + int index, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.set(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addResults(com.google.cloud.asset.v1p1beta1.StandardResourceMetadata value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(value); + onChanged(); + } else { + resultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addResults( + int index, com.google.cloud.asset.v1p1beta1.StandardResourceMetadata value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(index, value); + onChanged(); + } else { + resultsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addResults( + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addResults( + int index, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder addAllResults( + java.lang.Iterable + values) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, results_); + onChanged(); + } else { + resultsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder clearResults() { + if (resultsBuilder_ == null) { + results_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resultsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public Builder removeResults(int index) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.remove(index); + onChanged(); + } else { + resultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder getResultsBuilder( + int index) { + return getResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder getResultsOrBuilder( + int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List< + ? extends com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder> + getResultsOrBuilderList() { + if (resultsBuilder_ != null) { + return resultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(results_); + } + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder( + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.getDefaultInstance()); + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder addResultsBuilder( + int index) { + return getResultsFieldBuilder() + .addBuilder( + index, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.getDefaultInstance()); + } + /** + * + * + *
+     * A list of resource that match the search query.
+     * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + public java.util.List + getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder>( + results_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + results_ = null; + } + return resultsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included.  To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = 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.cloud.asset.v1p1beta1.SearchResourcesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.SearchResourcesResponse) + private static final com.google.cloud.asset.v1p1beta1.SearchResourcesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.SearchResourcesResponse(); + } + + public static com.google.cloud.asset.v1p1beta1.SearchResourcesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SearchResourcesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SearchResourcesResponse(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.cloud.asset.v1p1beta1.SearchResourcesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesResponseOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesResponseOrBuilder.java new file mode 100644 index 000000000..1a74e4c62 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesResponseOrBuilder.java @@ -0,0 +1,106 @@ +/* + * 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/cloud/asset/v1p1beta1/asset_service.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface SearchResourcesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.SearchResourcesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + java.util.List getResultsList(); + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata getResults(int index); + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + int getResultsCount(); + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + java.util.List + getResultsOrBuilderList(); + /** + * + * + *
+   * A list of resource that match the search query.
+   * 
+ * + * repeated .google.cloud.asset.v1p1beta1.StandardResourceMetadata results = 1; + */ + com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder getResultsOrBuilder(int index); + + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included.  To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included.  To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/StandardResourceMetadata.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/StandardResourceMetadata.java new file mode 100644 index 000000000..a9532b812 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/StandardResourceMetadata.java @@ -0,0 +1,1392 @@ +/* + * 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/cloud/asset/v1p1beta1/assets.proto + +package com.google.cloud.asset.v1p1beta1; + +/** + * + * + *
+ * The standard metadata of a cloud resource.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.StandardResourceMetadata} + */ +public final class StandardResourceMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1p1beta1.StandardResourceMetadata) + StandardResourceMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use StandardResourceMetadata.newBuilder() to construct. + private StandardResourceMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StandardResourceMetadata() { + name_ = ""; + assetType_ = ""; + project_ = ""; + displayName_ = ""; + description_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StandardResourceMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private StandardResourceMetadata( + 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(); + + assetType_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + project_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + description_ = 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.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_StandardResourceMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_StandardResourceMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.class, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The full resource name. For example:
+   * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
+   * See [Resource
+   * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+   * for more information.
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + 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 full resource name. For example:
+   * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
+   * See [Resource
+   * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+   * for more information.
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + 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 ASSET_TYPE_FIELD_NUMBER = 2; + private volatile java.lang.Object assetType_; + /** + * + * + *
+   * The type of this resource.
+   * For example: "compute.googleapis.com/Disk".
+   * 
+ * + * string asset_type = 2; + * + * @return The assetType. + */ + public java.lang.String getAssetType() { + java.lang.Object ref = assetType_; + 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(); + assetType_ = s; + return s; + } + } + /** + * + * + *
+   * The type of this resource.
+   * For example: "compute.googleapis.com/Disk".
+   * 
+ * + * string asset_type = 2; + * + * @return The bytes for assetType. + */ + public com.google.protobuf.ByteString getAssetTypeBytes() { + java.lang.Object ref = assetType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + assetType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PROJECT_FIELD_NUMBER = 3; + private volatile java.lang.Object project_; + /** + * + * + *
+   * The project that this resource belongs to, in the form of
+   * `projects/{project_number}`.
+   * 
+ * + * string project = 3; + * + * @return The project. + */ + public java.lang.String getProject() { + java.lang.Object ref = project_; + 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(); + project_ = s; + return s; + } + } + /** + * + * + *
+   * The project that this resource belongs to, in the form of
+   * `projects/{project_number}`.
+   * 
+ * + * string project = 3; + * + * @return The bytes for project. + */ + public com.google.protobuf.ByteString getProjectBytes() { + java.lang.Object ref = project_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + project_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 4; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * The display name of this resource.
+   * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + 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(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * The display name of this resource.
+   * 
+ * + * string display_name = 4; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 5; + private volatile java.lang.Object description_; + /** + * + * + *
+   * One or more paragraphs of text description of this resource. Maximum length
+   * could be up to 1M bytes.
+   * 
+ * + * string description = 5; + * + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + 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(); + description_ = s; + return s; + } + } + /** + * + * + *
+   * One or more paragraphs of text description of this resource. Maximum length
+   * could be up to 1M bytes.
+   * 
+ * + * string description = 5; + * + * @return The bytes for description. + */ + public com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + description_ = 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 (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!getAssetTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, assetType_); + } + if (!getProjectBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, project_); + } + if (!getDisplayNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, displayName_); + } + if (!getDescriptionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, description_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!getAssetTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, assetType_); + } + if (!getProjectBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, project_); + } + if (!getDisplayNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, displayName_); + } + if (!getDescriptionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, description_); + } + 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.cloud.asset.v1p1beta1.StandardResourceMetadata)) { + return super.equals(obj); + } + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata other = + (com.google.cloud.asset.v1p1beta1.StandardResourceMetadata) obj; + + if (!getName().equals(other.getName())) return false; + if (!getAssetType().equals(other.getAssetType())) return false; + if (!getProject().equals(other.getProject())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (!getDescription().equals(other.getDescription())) 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) + ASSET_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getAssetType().hashCode(); + hash = (37 * hash) + PROJECT_FIELD_NUMBER; + hash = (53 * hash) + getProject().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata 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.cloud.asset.v1p1beta1.StandardResourceMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata 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.cloud.asset.v1p1beta1.StandardResourceMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata 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.cloud.asset.v1p1beta1.StandardResourceMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata 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.cloud.asset.v1p1beta1.StandardResourceMetadata 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; + } + /** + * + * + *
+   * The standard metadata of a cloud resource.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1p1beta1.StandardResourceMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1p1beta1.StandardResourceMetadata) + com.google.cloud.asset.v1p1beta1.StandardResourceMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_StandardResourceMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_StandardResourceMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.class, + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.Builder.class); + } + + // Construct using com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.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_ = ""; + + assetType_ = ""; + + project_ = ""; + + displayName_ = ""; + + description_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1p1beta1.AssetProto + .internal_static_google_cloud_asset_v1p1beta1_StandardResourceMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata getDefaultInstanceForType() { + return com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata build() { + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1p1beta1.StandardResourceMetadata buildPartial() { + com.google.cloud.asset.v1p1beta1.StandardResourceMetadata result = + new com.google.cloud.asset.v1p1beta1.StandardResourceMetadata(this); + result.name_ = name_; + result.assetType_ = assetType_; + result.project_ = project_; + result.displayName_ = displayName_; + result.description_ = description_; + 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.cloud.asset.v1p1beta1.StandardResourceMetadata) { + return mergeFrom((com.google.cloud.asset.v1p1beta1.StandardResourceMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1p1beta1.StandardResourceMetadata other) { + if (other == com.google.cloud.asset.v1p1beta1.StandardResourceMetadata.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getAssetType().isEmpty()) { + assetType_ = other.assetType_; + onChanged(); + } + if (!other.getProject().isEmpty()) { + project_ = other.project_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + 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.cloud.asset.v1p1beta1.StandardResourceMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1p1beta1.StandardResourceMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The full resource name. For example:
+     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
+     * See [Resource
+     * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * for more information.
+     * 
+ * + * 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 full resource name. For example:
+     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
+     * See [Resource
+     * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * for more information.
+     * 
+ * + * 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 full resource name. For example:
+     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
+     * See [Resource
+     * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * for more information.
+     * 
+ * + * 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 full resource name. For example:
+     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
+     * See [Resource
+     * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * for more information.
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The full resource name. For example:
+     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
+     * See [Resource
+     * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+     * for more information.
+     * 
+ * + * 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 assetType_ = ""; + /** + * + * + *
+     * The type of this resource.
+     * For example: "compute.googleapis.com/Disk".
+     * 
+ * + * string asset_type = 2; + * + * @return The assetType. + */ + public java.lang.String getAssetType() { + java.lang.Object ref = assetType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + assetType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The type of this resource.
+     * For example: "compute.googleapis.com/Disk".
+     * 
+ * + * string asset_type = 2; + * + * @return The bytes for assetType. + */ + public com.google.protobuf.ByteString getAssetTypeBytes() { + java.lang.Object ref = assetType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + assetType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The type of this resource.
+     * For example: "compute.googleapis.com/Disk".
+     * 
+ * + * string asset_type = 2; + * + * @param value The assetType to set. + * @return This builder for chaining. + */ + public Builder setAssetType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + assetType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The type of this resource.
+     * For example: "compute.googleapis.com/Disk".
+     * 
+ * + * string asset_type = 2; + * + * @return This builder for chaining. + */ + public Builder clearAssetType() { + + assetType_ = getDefaultInstance().getAssetType(); + onChanged(); + return this; + } + /** + * + * + *
+     * The type of this resource.
+     * For example: "compute.googleapis.com/Disk".
+     * 
+ * + * string asset_type = 2; + * + * @param value The bytes for assetType to set. + * @return This builder for chaining. + */ + public Builder setAssetTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + assetType_ = value; + onChanged(); + return this; + } + + private java.lang.Object project_ = ""; + /** + * + * + *
+     * The project that this resource belongs to, in the form of
+     * `projects/{project_number}`.
+     * 
+ * + * string project = 3; + * + * @return The project. + */ + public java.lang.String getProject() { + java.lang.Object ref = project_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + project_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The project that this resource belongs to, in the form of
+     * `projects/{project_number}`.
+     * 
+ * + * string project = 3; + * + * @return The bytes for project. + */ + public com.google.protobuf.ByteString getProjectBytes() { + java.lang.Object ref = project_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + project_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The project that this resource belongs to, in the form of
+     * `projects/{project_number}`.
+     * 
+ * + * string project = 3; + * + * @param value The project to set. + * @return This builder for chaining. + */ + public Builder setProject(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + project_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The project that this resource belongs to, in the form of
+     * `projects/{project_number}`.
+     * 
+ * + * string project = 3; + * + * @return This builder for chaining. + */ + public Builder clearProject() { + + project_ = getDefaultInstance().getProject(); + onChanged(); + return this; + } + /** + * + * + *
+     * The project that this resource belongs to, in the form of
+     * `projects/{project_number}`.
+     * 
+ * + * string project = 3; + * + * @param value The bytes for project to set. + * @return This builder for chaining. + */ + public Builder setProjectBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + project_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * The display name of this resource.
+     * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The display name of this resource.
+     * 
+ * + * string display_name = 4; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The display name of this resource.
+     * 
+ * + * string display_name = 4; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The display name of this resource.
+     * 
+ * + * string display_name = 4; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The display name of this resource.
+     * 
+ * + * string display_name = 4; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + * + * + *
+     * One or more paragraphs of text description of this resource. Maximum length
+     * could be up to 1M bytes.
+     * 
+ * + * string description = 5; + * + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * One or more paragraphs of text description of this resource. Maximum length
+     * could be up to 1M bytes.
+     * 
+ * + * string description = 5; + * + * @return The bytes for description. + */ + public com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * One or more paragraphs of text description of this resource. Maximum length
+     * could be up to 1M bytes.
+     * 
+ * + * string description = 5; + * + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + description_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * One or more paragraphs of text description of this resource. Maximum length
+     * could be up to 1M bytes.
+     * 
+ * + * string description = 5; + * + * @return This builder for chaining. + */ + public Builder clearDescription() { + + description_ = getDefaultInstance().getDescription(); + onChanged(); + return this; + } + /** + * + * + *
+     * One or more paragraphs of text description of this resource. Maximum length
+     * could be up to 1M bytes.
+     * 
+ * + * string description = 5; + * + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + description_ = 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.cloud.asset.v1p1beta1.StandardResourceMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1p1beta1.StandardResourceMetadata) + private static final com.google.cloud.asset.v1p1beta1.StandardResourceMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1p1beta1.StandardResourceMetadata(); + } + + public static com.google.cloud.asset.v1p1beta1.StandardResourceMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StandardResourceMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new StandardResourceMetadata(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.cloud.asset.v1p1beta1.StandardResourceMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/StandardResourceMetadataOrBuilder.java b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/StandardResourceMetadataOrBuilder.java new file mode 100644 index 000000000..11bd02167 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/StandardResourceMetadataOrBuilder.java @@ -0,0 +1,164 @@ +/* + * 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/cloud/asset/v1p1beta1/assets.proto + +package com.google.cloud.asset.v1p1beta1; + +public interface StandardResourceMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1p1beta1.StandardResourceMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The full resource name. For example:
+   * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
+   * See [Resource
+   * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+   * for more information.
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The full resource name. For example:
+   * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
+   * See [Resource
+   * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
+   * for more information.
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The type of this resource.
+   * For example: "compute.googleapis.com/Disk".
+   * 
+ * + * string asset_type = 2; + * + * @return The assetType. + */ + java.lang.String getAssetType(); + /** + * + * + *
+   * The type of this resource.
+   * For example: "compute.googleapis.com/Disk".
+   * 
+ * + * string asset_type = 2; + * + * @return The bytes for assetType. + */ + com.google.protobuf.ByteString getAssetTypeBytes(); + + /** + * + * + *
+   * The project that this resource belongs to, in the form of
+   * `projects/{project_number}`.
+   * 
+ * + * string project = 3; + * + * @return The project. + */ + java.lang.String getProject(); + /** + * + * + *
+   * The project that this resource belongs to, in the form of
+   * `projects/{project_number}`.
+   * 
+ * + * string project = 3; + * + * @return The bytes for project. + */ + com.google.protobuf.ByteString getProjectBytes(); + + /** + * + * + *
+   * The display name of this resource.
+   * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * The display name of this resource.
+   * 
+ * + * string display_name = 4; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * One or more paragraphs of text description of this resource. Maximum length
+   * could be up to 1M bytes.
+   * 
+ * + * string description = 5; + * + * @return The description. + */ + java.lang.String getDescription(); + /** + * + * + *
+   * One or more paragraphs of text description of this resource. Maximum length
+   * could be up to 1M bytes.
+   * 
+ * + * string description = 5; + * + * @return The bytes for description. + */ + com.google.protobuf.ByteString getDescriptionBytes(); +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/proto/google/cloud/asset/v1p1beta1/asset_service.proto b/proto-google-cloud-asset-v1p1beta1/src/main/proto/google/cloud/asset/v1p1beta1/asset_service.proto new file mode 100644 index 000000000..f8f42dab9 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/proto/google/cloud/asset/v1p1beta1/asset_service.proto @@ -0,0 +1,230 @@ +// Copyright 2019 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.cloud.asset.v1p1beta1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/asset/v1p1beta1/assets.proto"; +import "google/api/client.proto"; + +option csharp_namespace = "Google.Cloud.Asset.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p1beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetServiceProto"; +option java_package = "com.google.cloud.asset.v1p1beta1"; +option php_namespace = "Google\\Cloud\\Asset\\V1p1beta1"; + +// Asset service definition. +service AssetService { + option (google.api.default_host) = "cloudasset.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Searches resources which are accessible with .get permission. + rpc SearchResources(SearchResourcesRequest) returns (SearchResourcesResponse) { + option (google.api.http) = { + get: "/v1p1beta1/resources:search" + }; + } + + // Searches IAM policies which are accessible with .getIamPolicy permission. + rpc SearchIamPolicies(SearchIamPoliciesRequest) returns (SearchIamPoliciesResponse) { + option (google.api.http) = { + get: "/v1p1beta1/iamPolicies:search" + }; + } + + // Searches all the resources under a given accessible CRM scope + // (project/folder/organization). This RPC gives callers + // especially admins the ability to search all the resources under a scope, + // even if they don't have .get permission of all the resources. Callers + // should have cloud.assets.SearchAllResources permission on the requested + // scope, otherwise it will be rejected. + rpc SearchAllResources(SearchAllResourcesRequest) returns (SearchAllResourcesResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{scope=*/*}/resources:searchAll" + }; + } + + // Searches all the IAM policies under a given accessible CRM scope + // (project/folder/organization). This RPC gives callers + // especially admins the ability to search all the IAM policies under a scope, + // even if they don't have .getIamPolicy permission of all the IAM policies. + // Callers should have cloud.assets.SearchAllIamPolicies permission on the + // requested scope, otherwise it will be rejected. + rpc SearchAllIamPolicies(SearchAllIamPoliciesRequest) returns (SearchAllIamPoliciesResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{scope=*/*}/iamPolicies:searchAll" + }; + } +} + +// Search resource request. +message SearchResourcesRequest { + // Required. The relative name of an asset. The search is limited to the resources + // within the `scope`. The allowed value must be: + // * Organization number (such as "organizations/123") + // * Folder number(such as "folders/1234") + // * Project number (such as "projects/12345") + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. + string query = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of asset types that this request searches for. If empty, it will + // search all the supported asset types. + repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The page size for search result pagination. Returned results may be fewer + // than requested. The value of this field is capped at 2000. If set to the + // zero value, server will pick an appropriate default. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, then retrieve the next batch of results from the preceding call + // to this method. `page_token` must be the value of `next_page_token` from + // the previous response. The values of all other method parameters, must be + // identical to those in the previous call. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search resource response. +message SearchResourcesResponse { + // A list of resource that match the search query. + repeated StandardResourceMetadata results = 1; + + // If there are more results than those appearing in this response, then + // `next_page_token` is included. To get the next set of results, call this + // method again using the value of `next_page_token` as `page_token`. + string next_page_token = 2; +} + +// Search IAM policies request. +message SearchIamPoliciesRequest { + // Required. The relative name of an asset. The search is limited to the resources + // within the `scope`. The allowed value must be: + // * Organization number (such as "organizations/123") + // * Folder number(such as "folders/1234") + // * Project number (such as "projects/12345") + string scope = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. + // Examples: + // * "policy:myuser@mydomain.com" + // * "policy:(myuser@mydomain.com viewer)" + string query = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The page size for search result pagination. Returned results may be fewer + // than requested. The maximum is 2000. If set to the zero value, the server + // will pick an appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, retrieve the next batch of results from the preceding call to + // this method. `page_token` must be the value of `next_page_token` from the + // previous response. The values of all other method parameters must be + // identical to those in the previous call. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search IAM policies response. +message SearchIamPoliciesResponse { + // A list of IamPolicy that match the search query. Related information such + // as the associated resource is returned along with the policy. + repeated IamPolicySearchResult results = 1; + + // Set if there are more results than those appearing in this response; to get + // the next set of results, call this method again, using this value as the + // `page_token`. + string next_page_token = 2; +} + +// Search all resources request. +message SearchAllResourcesRequest { + // Required. The relative name of an asset. The search is limited to the resources + // within the `scope`. The allowed value must be: + // * Organization number (such as "organizations/123") + // * Folder number(such as "folders/1234") + // * Project number (such as "projects/12345") + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. + string query = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of asset types that this request searches for. If empty, it will + // search all the supported asset types. + repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The page size for search result pagination. Returned results may be fewer + // than requested. The value of this field is capped at 2000. If set to the + // zero value, server will pick an appropriate default. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, then retrieve the next batch of results from the preceding call + // to this method. `page_token` must be the value of `next_page_token` from + // the previous response. The values of all other method parameters, must be + // identical to those in the previous call. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search all resources response. +message SearchAllResourcesResponse { + // A list of resource that match the search query. + repeated StandardResourceMetadata results = 1; + + // If there are more results than those appearing in this response, then + // `next_page_token` is included. To get the next set of results, call this + // method again using the value of `next_page_token` as `page_token`. + string next_page_token = 2; +} + +// Search all IAM policies request. +message SearchAllIamPoliciesRequest { + // Required. The relative name of an asset. The search is limited to the resources + // within the `scope`. The allowed value must be: + // * Organization number (such as "organizations/123") + // * Folder number(such as "folders/1234") + // * Project number (such as "projects/12345") + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. + // Examples: + // * "policy:myuser@mydomain.com" + // * "policy:(myuser@mydomain.com viewer)" + string query = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The page size for search result pagination. Returned results may be fewer + // than requested. The maximum is 2000. If set to the zero value, the server + // will pick an appropriate default. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, retrieve the next batch of results from the preceding call to + // this method. `page_token` must be the value of `next_page_token` from the + // previous response. The values of all other method parameters must be + // identical to those in the previous call. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search all IAM policies response. +message SearchAllIamPoliciesResponse { + // A list of IamPolicy that match the search query. Related information such + // as the associated resource is returned along with the policy. + repeated IamPolicySearchResult results = 1; + + // Set if there are more results than those appearing in this response; to get + // the next set of results, call this method again, using this value as the + // `page_token`. + string next_page_token = 2; +} diff --git a/proto-google-cloud-asset-v1p1beta1/src/main/proto/google/cloud/asset/v1p1beta1/assets.proto b/proto-google-cloud-asset-v1p1beta1/src/main/proto/google/cloud/asset/v1p1beta1/assets.proto new file mode 100644 index 000000000..47ab0c278 --- /dev/null +++ b/proto-google-cloud-asset-v1p1beta1/src/main/proto/google/cloud/asset/v1p1beta1/assets.proto @@ -0,0 +1,73 @@ +// Copyright 2019 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.cloud.asset.v1p1beta1; + +import "google/iam/v1/policy.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Asset.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p1beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetProto"; +option java_package = "com.google.cloud.asset.v1p1beta1"; +option php_namespace = "Google\\Cloud\\Asset\\V1p1beta1"; + +// The standard metadata of a cloud resource. +message StandardResourceMetadata { + // The full resource name. For example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + // See [Resource + // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + string name = 1; + + // The type of this resource. + // For example: "compute.googleapis.com/Disk". + string asset_type = 2; + + // The project that this resource belongs to, in the form of + // `projects/{project_number}`. + string project = 3; + + // The display name of this resource. + string display_name = 4; + + // One or more paragraphs of text description of this resource. Maximum length + // could be up to 1M bytes. + string description = 5; +} + +// The result for a IAM Policy search. +message IamPolicySearchResult { + // The [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // of the resource associated with this IAM policy. + string resource = 1; + + // The project that the associated GCP resource belongs to, in the form of + // `projects/{project_number}`. If an IAM policy is set on a resource (like VM + // instance, Cloud Storage bucket), the project field will indicate the + // project that contains the resource. If an IAM policy is set on a folder or + // orgnization, the project field will be empty. + string project = 3; + + // Representation of the actual Cloud IAM policy set on a cloud resource. For + // each resource, there must be at most one Cloud IAM policy set on it. + google.iam.v1.Policy policy = 4; +} diff --git a/synth.metadata b/synth.metadata index 1839c8381..34e1951bd 100644 --- a/synth.metadata +++ b/synth.metadata @@ -12,9 +12,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8d16f76de065f530d395a4c7eabbf766d6a120fd", - "internalRef": "291008516", - "log": "8d16f76de065f530d395a4c7eabbf766d6a120fd\nGenerate Memcache v1beta2 API protos and gRPC ServiceConfig files\n\nPiperOrigin-RevId: 291008516\n\n3af1dabd93df9a9f17bf3624d3b875c11235360b\ngrafeas: Add containeranalysis default_host to Grafeas service\n\nPiperOrigin-RevId: 290965849\n\nbe2663fa95e31cba67d0cd62611a6674db9f74b7\nfix(google/maps/roads): add missing opening bracket\n\nPiperOrigin-RevId: 290964086\n\nfacc26550a0af0696e0534bc9cae9df14275aa7c\nUpdating v2 protos with the latest inline documentation (in comments) and adding a per-service .yaml file.\n\nPiperOrigin-RevId: 290952261\n\ncda99c1f7dc5e4ca9b1caeae1dc330838cbc1461\nChange api_name to 'asset' for v1p1beta1\n\nPiperOrigin-RevId: 290800639\n\n94e9e90c303a820ce40643d9129e7f0d2054e8a1\nAdds Google Maps Road service\n\nPiperOrigin-RevId: 290795667\n\na3b23dcb2eaecce98c600c7d009451bdec52dbda\nrpc: new message ErrorInfo, other comment updates\n\nPiperOrigin-RevId: 290781668\n\n26420ef4e46c37f193c0fbe53d6ebac481de460e\nAdd proto definition for Org Policy v1.\n\nPiperOrigin-RevId: 290771923\n\n7f0dab8177cf371ae019a082e2512de7ac102888\nPublish Routes Preferred API v1 service definitions.\n\nPiperOrigin-RevId: 290326986\n\nad6e508d0728e1d1bca6e3f328cd562718cb772d\nFix: Qualify resource type references with \"jobs.googleapis.com/\"\n\nPiperOrigin-RevId: 290285762\n\n58e770d568a2b78168ddc19a874178fee8265a9d\ncts client library\n\nPiperOrigin-RevId: 290146169\n\naf9daa4c3b4c4a8b7133b81588dd9ffd37270af2\nAdd more programming language options to public proto\n\nPiperOrigin-RevId: 290144091\n\nd9f2bbf2df301ef84641d4cec7c828736a0bd907\ntalent: add missing resource.proto dep to Bazel build target\n\nPiperOrigin-RevId: 290143164\n\n3b3968237451d027b42471cd28884a5a1faed6c7\nAnnotate Talent API.\nAdd gRPC service config for retry.\nUpdate bazel file with google.api.resource dependency.\n\nPiperOrigin-RevId: 290125172\n\n" + "sha": "fead959b0dcc7b36c6ed74ebf905f5bcb3c0d521", + "log": "fead959b0dcc7b36c6ed74ebf905f5bcb3c0d521\nMerge branch 'master' of github.com:googleapis/googleapis\n\n8d16f76de065f530d395a4c7eabbf766d6a120fd\nGenerate Memcache v1beta2 API protos and gRPC ServiceConfig files\n\nPiperOrigin-RevId: 291008516\n\n3af1dabd93df9a9f17bf3624d3b875c11235360b\ngrafeas: Add containeranalysis default_host to Grafeas service\n\nPiperOrigin-RevId: 290965849\n\nbe2663fa95e31cba67d0cd62611a6674db9f74b7\nfix(google/maps/roads): add missing opening bracket\n\nPiperOrigin-RevId: 290964086\n\nfacc26550a0af0696e0534bc9cae9df14275aa7c\nUpdating v2 protos with the latest inline documentation (in comments) and adding a per-service .yaml file.\n\nPiperOrigin-RevId: 290952261\n\n" } }, { @@ -55,6 +54,16 @@ "generator": "gapic", "config": "google/cloud/asset/artman_cloudasset_v1p2beta1.yaml" } + }, + { + "client": { + "source": "googleapis", + "apiName": "asset", + "apiVersion": "v1p1beta1", + "language": "java", + "generator": "gapic", + "config": "google/cloud/asset/v1p1beta1/artman_cloudasset_v1p1beta1.yaml" + } } ], "newFiles": [ @@ -73,9 +82,6 @@ { "path": ".github/release-please.yml" }, - { - "path": ".gitignore" - }, { "path": ".kokoro/build.bat" }, @@ -241,12 +247,6 @@ { "path": ".kokoro/trampoline.sh" }, - { - "path": ".repo-metadata.json" - }, - { - "path": "CHANGELOG.md" - }, { "path": "CODE_OF_CONDUCT.md" }, @@ -256,18 +256,9 @@ { "path": "LICENSE" }, - { - "path": "README.md" - }, { "path": "codecov.yaml" }, - { - "path": "google-cloud-asset-bom/pom.xml" - }, - { - "path": "google-cloud-asset/pom.xml" - }, { "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java" }, @@ -310,6 +301,27 @@ { "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1beta1/stub/GrpcAssetServiceStub.java" }, + { + "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceClient.java" + }, + { + "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceSettings.java" + }, + { + "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/package-info.java" + }, + { + "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/AssetServiceStub.java" + }, + { + "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/AssetServiceStubSettings.java" + }, + { + "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/GrpcAssetServiceCallableFactory.java" + }, + { + "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1p1beta1/stub/GrpcAssetServiceStub.java" + }, { "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceClient.java" }, @@ -331,9 +343,6 @@ { "path": "google-cloud-asset/src/main/java/com/google/cloud/asset/v1p2beta1/stub/GrpcAssetServiceStub.java" }, - { - "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/it/ITSystemTest.java" - }, { "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1/AssetServiceClientTest.java" }, @@ -343,9 +352,6 @@ { "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1/MockAssetServiceImpl.java" }, - { - "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1/VPCServiceControlTest.java" - }, { "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1beta1/AssetServiceClientTest.java" }, @@ -356,28 +362,31 @@ "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1beta1/MockAssetServiceImpl.java" }, { - "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1p2beta1/AssetServiceClientTest.java" + "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/AssetServiceClientTest.java" }, { - "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1p2beta1/MockAssetService.java" + "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/MockAssetService.java" }, { - "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1p2beta1/MockAssetServiceImpl.java" + "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1p1beta1/MockAssetServiceImpl.java" }, { - "path": "grpc-google-cloud-asset-v1/pom.xml" + "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1p2beta1/AssetServiceClientTest.java" }, { - "path": "grpc-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceGrpc.java" + "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1p2beta1/MockAssetService.java" }, { - "path": "grpc-google-cloud-asset-v1beta1/pom.xml" + "path": "google-cloud-asset/src/test/java/com/google/cloud/asset/v1p2beta1/MockAssetServiceImpl.java" + }, + { + "path": "grpc-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceGrpc.java" }, { "path": "grpc-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/AssetServiceGrpc.java" }, { - "path": "grpc-google-cloud-asset-v1p2beta1/pom.xml" + "path": "grpc-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceGrpc.java" }, { "path": "grpc-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceGrpc.java" @@ -388,15 +397,6 @@ { "path": "license-checks.xml" }, - { - "path": "pom.xml" - }, - { - "path": "proto-google-cloud-asset-v1/clirr-ignored-differences.xml" - }, - { - "path": "proto-google-cloud-asset-v1/pom.xml" - }, { "path": "proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/Asset.java" }, @@ -473,7 +473,7 @@ "path": "proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/GcsDestination.java" }, { - "path": "proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/GcsDestinationOrBuilder.java" + "path": "proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ExportAssetsResponse.java" }, { "path": "proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/GetFeedRequest.java" @@ -516,9 +516,10 @@ }, { "path": "proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/TemporalAsset.java" + }, { - "path": "proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/TemporalAssetOrBuilder.java" + "path": "proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ListFeedsResponseOrBuilder.java" }, { "path": "proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/TimeWindow.java" @@ -538,9 +539,6 @@ { "path": "proto-google-cloud-asset-v1/src/main/proto/google/cloud/asset/v1/assets.proto" }, - { - "path": "proto-google-cloud-asset-v1beta1/pom.xml" - }, { "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/Asset.java" }, @@ -575,7 +573,7 @@ "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/ExportAssetsRequestOrBuilder.java" }, { - "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/ExportAssetsResponse.java" + "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/AssetOrBuilder.java" }, { "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/ExportAssetsResponseOrBuilder.java" @@ -596,7 +594,7 @@ "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/ProjectName.java" }, { - "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/Resource.java" + "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/BatchGetAssetsHistoryRequestOrBuilder.java" }, { "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/ResourceOrBuilder.java" @@ -608,10 +606,10 @@ "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/TemporalAssetOrBuilder.java" }, { - "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/TimeWindow.java" + "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/ContentType.java" }, { - "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/TimeWindowOrBuilder.java" + "path": "proto-google-cloud-asset-v1beta1/src/main/java/com/google/cloud/asset/v1beta1/ExportAssetsRequest.java" }, { "path": "proto-google-cloud-asset-v1beta1/src/main/proto/google/cloud/asset/v1beta1/asset_service.proto" @@ -620,7 +618,76 @@ "path": "proto-google-cloud-asset-v1beta1/src/main/proto/google/cloud/asset/v1beta1/assets.proto" }, { - "path": "proto-google-cloud-asset-v1p2beta1/pom.xml" + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetProto.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/AssetServiceProto.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/IamPolicySearchResult.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/IamPolicySearchResultOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesRequest.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesResponse.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllIamPoliciesResponseOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesRequest.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesResponse.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchAllResourcesResponseOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesRequest.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesResponse.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchIamPoliciesResponseOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesRequest.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesResponse.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/SearchResourcesResponseOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/StandardResourceMetadata.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/java/com/google/cloud/asset/v1p1beta1/StandardResourceMetadataOrBuilder.java" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/proto/google/cloud/asset/v1p1beta1/asset_service.proto" + }, + { + "path": "proto-google-cloud-asset-v1p1beta1/src/main/proto/google/cloud/asset/v1p1beta1/assets.proto" }, { "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/Asset.java" @@ -629,7 +696,7 @@ "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/AssetOrBuilder.java" }, { - "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/AssetProto.java" + "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/BatchGetAssetsHistoryResponse.java" }, { "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/AssetServiceProto.java" @@ -647,7 +714,10 @@ "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/BatchGetAssetsHistoryResponseOrBuilder.java" }, { - "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/BigQueryDestination.java" + "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/ContentType.java" + }, + { + "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/CreateFeedRequest.java" }, { "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/BigQueryDestinationOrBuilder.java" @@ -680,7 +750,7 @@ "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/ExportAssetsResponseOrBuilder.java" }, { - "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/Feed.java" + "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/FeedOutputConfig.java" }, { "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/FeedName.java" @@ -716,7 +786,7 @@ "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/ListFeedsResponse.java" }, { - "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/ListFeedsResponseOrBuilder.java" + "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/PubsubDestinationOrBuilder.java" }, { "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/OutputConfig.java" @@ -755,22 +825,13 @@ "path": "proto-google-cloud-asset-v1p2beta1/src/main/java/com/google/cloud/asset/v1p2beta1/UpdateFeedRequestOrBuilder.java" }, { - "path": "proto-google-cloud-asset-v1p2beta1/src/main/proto/google/cloud/asset/v1p2beta1/asset_service.proto" + "path": "synth.py" }, { "path": "proto-google-cloud-asset-v1p2beta1/src/main/proto/google/cloud/asset/v1p2beta1/assets.proto" }, { "path": "renovate.json" - }, - { - "path": "synth.metadata" - }, - { - "path": "synth.py" - }, - { - "path": "versions.txt" } ] } \ No newline at end of file diff --git a/synth.py b/synth.py index 2f23e546b..eee92a90c 100644 --- a/synth.py +++ b/synth.py @@ -25,23 +25,22 @@ config_pattern = '/google/cloud/asset/artman_cloudasset_{version}.yaml' for version in versions: - library = gapic.java_library( + java.gapic_library( service=service, version=version, - config_path=config_pattern.format(version=version), - artman_output_name='') + config_pattern='/google/cloud/asset/artman_cloudasset_{version}.yaml', + package_pattern='com.google.cloud.{service}.{version}', + gapic=gapic, + ) + +java.gapic_library( + service=service, + version='v1p1beta1', + config_pattern='/google/cloud/asset/{version}/artman_cloudasset_{version}.yaml', + package_pattern='com.google.cloud.{service}.{version}', + gapic=gapic, +) - package_name = f'com.google.cloud.{service}.{version}' - java.fix_proto_headers(library / f'proto-google-cloud-{service}-{version}') - java.fix_grpc_headers(library / f'grpc-google-cloud-{service}-{version}', package_name) - - s.copy(library / f'gapic-google-cloud-{service}-{version}/src', f'google-cloud-{service}/src') - s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'grpc-google-cloud-{service}-{version}/src') - s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'proto-google-cloud-{service}-{version}/src') - - java.format_code(f'google-cloud-{service}/src') - java.format_code(f'grpc-google-cloud-{service}-{version}/src') - java.format_code(f'proto-google-cloud-{service}-{version}/src') common_templates = gcp.CommonTemplates() templates = common_templates.java_library()