From 6127fa0a61bb9182458293eb9b453861952126b4 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 26 May 2020 14:52:10 -0700 Subject: [PATCH] feat(v1): add SearchAllResources and SearchAllIamPolicies RPCs (#180) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/7a562538-f49e-491d-91f9-0726c779942e/targets PiperOrigin-RevId: 311601348 Source-Link: https://github.com/googleapis/googleapis/commit/2433bd50656264a2ef9f684bf646fb4d250d39ff --- .../cloud/asset/v1/AssetServiceClient.java | 476 +++ .../cloud/asset/v1/AssetServiceSettings.java | 36 + .../cloud/asset/v1/stub/AssetServiceStub.java | 27 + .../v1/stub/AssetServiceStubSettings.java | 221 +- .../asset/v1/stub/GrpcAssetServiceStub.java | 103 + .../asset/v1/AssetServiceClientTest.java | 111 + .../cloud/asset/v1/MockAssetServiceImpl.java | 32 + .../cloud/asset/v1/AssetServiceGrpc.java | 286 +- .../com/google/cloud/asset/v1/AssetProto.java | 155 +- .../cloud/asset/v1/AssetServiceProto.java | 143 +- .../cloud/asset/v1/CreateFeedRequest.java | 60 +- .../asset/v1/CreateFeedRequestOrBuilder.java | 15 +- .../cloud/asset/v1/ExportAssetsResponse.java | 12 +- .../cloud/asset/v1/IamPolicySearchResult.java | 3435 +++++++++++++++++ .../v1/IamPolicySearchResultOrBuilder.java | 207 + .../com/google/cloud/asset/v1/Resource.java | 184 + .../cloud/asset/v1/ResourceOrBuilder.java | 27 + .../cloud/asset/v1/ResourceSearchResult.java | 2780 +++++++++++++ .../v1/ResourceSearchResultOrBuilder.java | 443 +++ .../asset/v1/SearchAllIamPoliciesRequest.java | 1275 ++++++ .../SearchAllIamPoliciesRequestOrBuilder.java | 169 + .../v1/SearchAllIamPoliciesResponse.java | 1162 ++++++ ...SearchAllIamPoliciesResponseOrBuilder.java | 111 + .../asset/v1/SearchAllResourcesRequest.java | 1869 +++++++++ .../SearchAllResourcesRequestOrBuilder.java | 285 ++ .../asset/v1/SearchAllResourcesResponse.java | 1161 ++++++ .../SearchAllResourcesResponseOrBuilder.java | 111 + .../cloud/asset/v1/UpdateFeedRequest.java | 48 +- .../asset/v1/UpdateFeedRequestOrBuilder.java | 12 +- .../google/cloud/asset/v1/asset_service.proto | 212 +- .../proto/google/cloud/asset/v1/assets.proto | 164 +- synth.metadata | 20 +- 32 files changed, 15176 insertions(+), 176 deletions(-) create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/IamPolicySearchResult.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/IamPolicySearchResultOrBuilder.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceSearchResult.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceSearchResultOrBuilder.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesRequest.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesRequestOrBuilder.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesResponse.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesResponseOrBuilder.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesRequest.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesRequestOrBuilder.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesResponse.java create mode 100644 proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesResponseOrBuilder.java diff --git a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java index aeae7a024..0beab6f53 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceClient.java @@ -15,17 +15,26 @@ */ package com.google.cloud.asset.v1; +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.longrunning.OperationFuture; +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.OperationCallable; +import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.asset.v1.stub.AssetServiceStub; import com.google.cloud.asset.v1.stub.AssetServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import java.io.IOException; +import java.util.List; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -704,6 +713,291 @@ public final UnaryCallable updateFeedCallable() { return stub.updateFeedCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the resources within the given accessible scope (e.g., a project, a folder or an + * organization). Callers should have cloud.assets.SearchAllResources permission upon the + * requested scope, otherwise the request will be rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   String query = "";
+   *   List<String> assetTypes = new ArrayList<>();
+   *   for (ResourceSearchResult element : assetServiceClient.searchAllResources(scope, query, assetTypes).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param scope Required. A scope can be a project, a folder or an organization. The search is + * limited to the resources within the `scope`. + *

The allowed values are: + *

* projects/{PROJECT_ID} * projects/{PROJECT_NUMBER} * + * folders/{FOLDER_NUMBER} * organizations/{ORGANIZATION_NUMBER} + * @param query Optional. The query statement. An empty query can be specified to search all the + * resources of certain `asset_types` within the given `scope`. + *

Examples: + *

* `name : "Important"` to find Cloud resources whose name contains "Important" as a + * word. * `displayName : "Impor*"` to find Cloud resources whose display name + * contains "Impor" as a word prefix. * `description : "*por*"` to find Cloud + * resources whose description contains "por" as a substring. * `location : + * "us-west*"` to find Cloud resources whose location is prefixed with "us-west". * + * `labels : "prod"` to find Cloud resources whose labels contain "prod" as a key or value. + * * `labels.env : "prod"` to find Cloud resources which have a label "env" and its value + * is "prod". * `labels.env : *` to find Cloud resources which have a label "env". + * * `"Important"` to find Cloud resources which contain "Important" as a word in any of + * the searchable fields. * `"Impor*"` to find Cloud resources which contain "Impor" + * as a word prefix in any of the searchable fields. * `"*por*"` to find Cloud + * resources which contain "por" as a substring in any of the searchable fields. * + * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud resources which + * contain "Important" as a word in any of the searchable fields and are also located in the + * "us-west1" region or the "global" location. + *

See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + * for more details. + * @param assetTypes Optional. A list of asset types that this request searches for. If empty, it + * will search all the [searchable asset + * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 within the given accessible scope (e.g., a project, a folder or an + * organization). Callers should have cloud.assets.SearchAllResources permission upon the + * requested scope, otherwise the request will be rejected. + * + *

Sample code: + * + *


+   * try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
+   *   String scope = "";
+   *   SearchAllResourcesRequest request = SearchAllResourcesRequest.newBuilder()
+   *     .setScope(scope)
+   *     .build();
+   *   for (ResourceSearchResult 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 within the given accessible scope (e.g., a project, a folder or an + * organization). Callers should have cloud.assets.SearchAllResources permission upon the + * requested scope, otherwise the request 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 (ResourceSearchResult element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + searchAllResourcesPagedCallable() { + return stub.searchAllResourcesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Searches all the resources within the given accessible scope (e.g., a project, a folder or an + * organization). Callers should have cloud.assets.SearchAllResources permission upon the + * requested scope, otherwise the request 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 (ResourceSearchResult 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 within the given accessible scope (e.g., a project, a folder or + * an organization). Callers should have cloud.assets.SearchAllIamPolicies permission upon the + * requested scope, otherwise the request 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. A scope can be a project, a folder or an organization. The search is + * limited to the IAM policies within the `scope`. + *

The allowed values are: + *

* projects/{PROJECT_ID} * projects/{PROJECT_NUMBER} * + * folders/{FOLDER_NUMBER} * organizations/{ORGANIZATION_NUMBER} + * @param query Optional. The query statement. An empty query can be specified to search all the + * IAM policies within the given `scope`. + *

Examples: + *

* `policy : "amy{@literal @}gmail.com"` to find Cloud IAM policy bindings that + * specify user "amy{@literal @}gmail.com". * `policy : "roles/compute.admin"` to find + * Cloud IAM policy bindings that specify the Compute Admin role. * + * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM policy bindings that + * specify a role containing "storage.buckets.update" permission. * `resource : + * "organizations/123"` to find Cloud IAM policy bindings that are set on "organizations/123". + * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")` to find + * Cloud IAM policy bindings that are set on "organizations/123" or "folders/1234", and also + * specify user "amy". + *

See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query) + * for more details. + * @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 within the given accessible scope (e.g., a project, a folder or + * an organization). Callers should have cloud.assets.SearchAllIamPolicies permission upon the + * requested scope, otherwise the request 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 within the given accessible scope (e.g., a project, a folder or + * an organization). Callers should have cloud.assets.SearchAllIamPolicies permission upon the + * requested scope, otherwise the request 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 within the given accessible scope (e.g., a project, a folder or + * an organization). Callers should have cloud.assets.SearchAllIamPolicies permission upon the + * requested scope, otherwise the request 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(); @@ -733,4 +1027,186 @@ public void shutdownNow() { public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } + + public static class SearchAllResourcesPagedResponse + extends AbstractPagedListResponse< + SearchAllResourcesRequest, + SearchAllResourcesResponse, + ResourceSearchResult, + 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, + ResourceSearchResult, + 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, + ResourceSearchResult, + 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/v1/AssetServiceSettings.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceSettings.java index 3ac13ed15..5349ac51b 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceSettings.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/AssetServiceSettings.java @@ -15,6 +15,9 @@ */ package com.google.cloud.asset.v1; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllResourcesPagedResponse; + import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; import com.google.api.gax.core.GoogleCredentialsProvider; @@ -24,6 +27,7 @@ import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; import com.google.api.gax.rpc.OperationCallSettings; +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.v1.stub.AssetServiceStubSettings; @@ -111,6 +115,22 @@ public UnaryCallSettings updateFeedSettings() { return ((AssetServiceStubSettings) getStubSettings()).updateFeedSettings(); } + /** 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(); @@ -253,6 +273,22 @@ public UnaryCallSettings.Builder updateFeedSettings() { return getStubSettingsBuilder().updateFeedSettings(); } + /** 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/v1/stub/AssetServiceStub.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStub.java index 8bbde5cb9..0a3c4a82c 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStub.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStub.java @@ -15,6 +15,9 @@ */ package com.google.cloud.asset.v1.stub; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllResourcesPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -29,6 +32,10 @@ import com.google.cloud.asset.v1.GetFeedRequest; import com.google.cloud.asset.v1.ListFeedsRequest; import com.google.cloud.asset.v1.ListFeedsResponse; +import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest; +import com.google.cloud.asset.v1.SearchAllIamPoliciesResponse; +import com.google.cloud.asset.v1.SearchAllResourcesRequest; +import com.google.cloud.asset.v1.SearchAllResourcesResponse; import com.google.cloud.asset.v1.UpdateFeedRequest; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; @@ -85,6 +92,26 @@ public UnaryCallable updateFeedCallable() { throw new UnsupportedOperationException("Not implemented: updateFeedCallable()"); } + 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/v1/stub/AssetServiceStubSettings.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java index c6ae2d998..8d8dc29b3 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/AssetServiceStubSettings.java @@ -15,7 +15,11 @@ */ package com.google.cloud.asset.v1.stub; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllResourcesPagedResponse; + 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; @@ -27,13 +31,19 @@ import com.google.api.gax.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; 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.OperationCallSettings; +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.v1.BatchGetAssetsHistoryRequest; import com.google.cloud.asset.v1.BatchGetAssetsHistoryResponse; import com.google.cloud.asset.v1.CreateFeedRequest; @@ -42,8 +52,14 @@ import com.google.cloud.asset.v1.ExportAssetsResponse; import com.google.cloud.asset.v1.Feed; import com.google.cloud.asset.v1.GetFeedRequest; +import com.google.cloud.asset.v1.IamPolicySearchResult; import com.google.cloud.asset.v1.ListFeedsRequest; import com.google.cloud.asset.v1.ListFeedsResponse; +import com.google.cloud.asset.v1.ResourceSearchResult; +import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest; +import com.google.cloud.asset.v1.SearchAllIamPoliciesResponse; +import com.google.cloud.asset.v1.SearchAllResourcesRequest; +import com.google.cloud.asset.v1.SearchAllResourcesResponse; import com.google.cloud.asset.v1.UpdateFeedRequest; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -105,6 +121,14 @@ public class AssetServiceStubSettings extends StubSettings getFeedSettings; private final UnaryCallSettings listFeedsSettings; private final UnaryCallSettings updateFeedSettings; + private final PagedCallSettings< + SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse> + searchAllResourcesSettings; + private final PagedCallSettings< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse> + searchAllIamPoliciesSettings; /** Returns the object with the settings used for calls to deleteFeed. */ public UnaryCallSettings deleteFeedSettings() { @@ -149,6 +173,22 @@ public UnaryCallSettings updateFeedSettings() { return updateFeedSettings; } + /** 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() @@ -226,8 +266,140 @@ protected AssetServiceStubSettings(Builder settingsBuilder) throws IOException { getFeedSettings = settingsBuilder.getFeedSettings().build(); listFeedsSettings = settingsBuilder.listFeedsSettings().build(); updateFeedSettings = settingsBuilder.updateFeedSettings().build(); + searchAllResourcesSettings = settingsBuilder.searchAllResourcesSettings().build(); + searchAllIamPoliciesSettings = settingsBuilder.searchAllIamPoliciesSettings().build(); } + private static final PagedListDescriptor< + SearchAllResourcesRequest, SearchAllResourcesResponse, ResourceSearchResult> + SEARCH_ALL_RESOURCES_PAGE_STR_DESC = + new PagedListDescriptor< + SearchAllResourcesRequest, SearchAllResourcesResponse, ResourceSearchResult>() { + @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< + 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, ResourceSearchResult> + 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; @@ -244,6 +416,14 @@ public static class Builder extends StubSettings.Builder getFeedSettings; private final UnaryCallSettings.Builder listFeedsSettings; private final UnaryCallSettings.Builder updateFeedSettings; + private final PagedCallSettings.Builder< + SearchAllResourcesRequest, SearchAllResourcesResponse, SearchAllResourcesPagedResponse> + searchAllResourcesSettings; + private final PagedCallSettings.Builder< + SearchAllIamPoliciesRequest, + SearchAllIamPoliciesResponse, + SearchAllIamPoliciesPagedResponse> + searchAllIamPoliciesSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -302,6 +482,11 @@ protected Builder(ClientContext clientContext) { updateFeedSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + searchAllResourcesSettings = PagedCallSettings.newBuilder(SEARCH_ALL_RESOURCES_PAGE_STR_FACT); + + searchAllIamPoliciesSettings = + PagedCallSettings.newBuilder(SEARCH_ALL_IAM_POLICIES_PAGE_STR_FACT); + unaryMethodSettingsBuilders = ImmutableList.>of( deleteFeedSettings, @@ -310,7 +495,9 @@ protected Builder(ClientContext clientContext) { createFeedSettings, getFeedSettings, listFeedsSettings, - updateFeedSettings); + updateFeedSettings, + searchAllResourcesSettings, + searchAllIamPoliciesSettings); initDefaults(this); } @@ -360,6 +547,16 @@ private static Builder initDefaults(Builder builder) { .updateFeedSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_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")); builder .exportAssetsOperationSettings() .setInitialCallSettings( @@ -398,6 +595,8 @@ protected Builder(AssetServiceStubSettings settings) { getFeedSettings = settings.getFeedSettings.toBuilder(); listFeedsSettings = settings.listFeedsSettings.toBuilder(); updateFeedSettings = settings.updateFeedSettings.toBuilder(); + searchAllResourcesSettings = settings.searchAllResourcesSettings.toBuilder(); + searchAllIamPoliciesSettings = settings.searchAllIamPoliciesSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -407,7 +606,9 @@ protected Builder(AssetServiceStubSettings settings) { createFeedSettings, getFeedSettings, listFeedsSettings, - updateFeedSettings); + updateFeedSettings, + searchAllResourcesSettings, + searchAllIamPoliciesSettings); } // NEXT_MAJOR_VER: remove 'throws Exception' @@ -471,6 +672,22 @@ public UnaryCallSettings.Builder updateFeedSettings() { return updateFeedSettings; } + /** 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/v1/stub/GrpcAssetServiceStub.java b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/GrpcAssetServiceStub.java index 5bc73e50a..3fd6e8541 100644 --- a/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/GrpcAssetServiceStub.java +++ b/google-cloud-asset/src/main/java/com/google/cloud/asset/v1/stub/GrpcAssetServiceStub.java @@ -15,6 +15,9 @@ */ package com.google.cloud.asset.v1.stub; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllResourcesPagedResponse; + import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -34,6 +37,10 @@ import com.google.cloud.asset.v1.GetFeedRequest; import com.google.cloud.asset.v1.ListFeedsRequest; import com.google.cloud.asset.v1.ListFeedsResponse; +import com.google.cloud.asset.v1.SearchAllIamPoliciesRequest; +import com.google.cloud.asset.v1.SearchAllIamPoliciesResponse; +import com.google.cloud.asset.v1.SearchAllResourcesRequest; +import com.google.cloud.asset.v1.SearchAllResourcesResponse; import com.google.cloud.asset.v1.UpdateFeedRequest; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; @@ -110,6 +117,26 @@ public class GrpcAssetServiceStub extends AssetServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdateFeedRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Feed.getDefaultInstance())) .build(); + private static final MethodDescriptor + searchAllResourcesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.asset.v1.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.v1.AssetService/SearchAllIamPolicies") + .setRequestMarshaller( + ProtoUtils.marshaller(SearchAllIamPoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(SearchAllIamPoliciesResponse.getDefaultInstance())) + .build(); private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -124,6 +151,14 @@ public class GrpcAssetServiceStub extends AssetServiceStub { private final UnaryCallable getFeedCallable; private final UnaryCallable listFeedsCallable; private final UnaryCallable updateFeedCallable; + private final UnaryCallable + searchAllResourcesCallable; + private final UnaryCallable + searchAllResourcesPagedCallable; + private final UnaryCallable + searchAllIamPoliciesCallable; + private final UnaryCallable + searchAllIamPoliciesPagedCallable; private final GrpcStubCallableFactory callableFactory; @@ -258,6 +293,34 @@ public Map extract(UpdateFeedRequest request) { } }) .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.deleteFeedCallable = callableFactory.createUnaryCallable( @@ -288,6 +351,26 @@ public Map extract(UpdateFeedRequest request) { this.updateFeedCallable = callableFactory.createUnaryCallable( updateFeedTransportSettings, settings.updateFeedSettings(), 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()); } @@ -332,6 +415,26 @@ public UnaryCallable updateFeedCallable() { return updateFeedCallable; } + 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(); diff --git a/google-cloud-asset/src/test/java/com/google/cloud/asset/v1/AssetServiceClientTest.java b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1/AssetServiceClientTest.java index ffb406e03..b962984cb 100644 --- a/google-cloud-asset/src/test/java/com/google/cloud/asset/v1/AssetServiceClientTest.java +++ b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1/AssetServiceClientTest.java @@ -15,6 +15,9 @@ */ package com.google.cloud.asset.v1; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllIamPoliciesPagedResponse; +import static com.google.cloud.asset.v1.AssetServiceClient.SearchAllResourcesPagedResponse; + import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.testing.LocalChannelProvider; @@ -23,6 +26,7 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; import com.google.protobuf.Any; @@ -30,6 +34,7 @@ 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.Objects; @@ -374,4 +379,110 @@ public void updateFeedExceptionTest() throws Exception { // Expected exception } } + + @Test + @SuppressWarnings("all") + public void searchAllResourcesTest() { + String nextPageToken = ""; + ResourceSearchResult resultsElement = ResourceSearchResult.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/v1/MockAssetServiceImpl.java b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1/MockAssetServiceImpl.java index cdff23e4f..14a7b94fb 100644 --- a/google-cloud-asset/src/test/java/com/google/cloud/asset/v1/MockAssetServiceImpl.java +++ b/google-cloud-asset/src/test/java/com/google/cloud/asset/v1/MockAssetServiceImpl.java @@ -159,4 +159,36 @@ public void deleteFeed(DeleteFeedRequest request, StreamObserver response 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-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceGrpc.java b/grpc-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceGrpc.java index fc77173b4..7be17b545 100644 --- a/grpc-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceGrpc.java +++ b/grpc-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceGrpc.java @@ -330,6 +330,102 @@ private AssetServiceGrpc() {} return getDeleteFeedMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.asset.v1.SearchAllResourcesRequest, + com.google.cloud.asset.v1.SearchAllResourcesResponse> + getSearchAllResourcesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SearchAllResources", + requestType = com.google.cloud.asset.v1.SearchAllResourcesRequest.class, + responseType = com.google.cloud.asset.v1.SearchAllResourcesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1.SearchAllResourcesRequest, + com.google.cloud.asset.v1.SearchAllResourcesResponse> + getSearchAllResourcesMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.asset.v1.SearchAllResourcesRequest, + com.google.cloud.asset.v1.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(SERVICE_NAME, "SearchAllResources")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1.SearchAllResourcesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1.SearchAllResourcesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new AssetServiceMethodDescriptorSupplier("SearchAllResources")) + .build(); + } + } + } + return getSearchAllResourcesMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse> + getSearchAllIamPoliciesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SearchAllIamPolicies", + requestType = com.google.cloud.asset.v1.SearchAllIamPoliciesRequest.class, + responseType = com.google.cloud.asset.v1.SearchAllIamPoliciesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse> + getSearchAllIamPoliciesMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1.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(SERVICE_NAME, "SearchAllIamPolicies")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.asset.v1.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) { io.grpc.stub.AbstractStub.StubFactory factory = @@ -386,8 +482,9 @@ public abstract static class AssetServiceImplBase implements io.grpc.BindableSer *
      * Exports assets with time and resource types to a given Cloud Storage
      * location. The output format is newline-delimited JSON.
-     * This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
-     * to keep track of the export.
+     * This API implements the
+     * [google.longrunning.Operation][google.longrunning.Operation] API allowing
+     * you to keep track of the export.
      * 
*/ public void exportAssets( @@ -482,6 +579,40 @@ public void deleteFeed( asyncUnimplementedUnaryCall(getDeleteFeedMethod(), responseObserver); } + /** + * + * + *
+     * Searches all the resources within the given accessible scope (e.g., a
+     * project, a folder or an organization). Callers should have
+     * cloud.assets.SearchAllResources permission upon the requested scope,
+     * otherwise the request will be rejected.
+     * 
+ */ + public void searchAllResources( + com.google.cloud.asset.v1.SearchAllResourcesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getSearchAllResourcesMethod(), responseObserver); + } + + /** + * + * + *
+     * Searches all the IAM policies within the given accessible scope (e.g., a
+     * project, a folder or an organization). Callers should have
+     * cloud.assets.SearchAllIamPolicies permission upon the requested scope,
+     * otherwise the request will be rejected.
+     * 
+ */ + public void searchAllIamPolicies( + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getSearchAllIamPoliciesMethod(), responseObserver); + } + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) @@ -528,6 +659,20 @@ public final io.grpc.ServerServiceDefinition bindService() { new MethodHandlers< com.google.cloud.asset.v1.DeleteFeedRequest, com.google.protobuf.Empty>( this, METHODID_DELETE_FEED))) + .addMethod( + getSearchAllResourcesMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.asset.v1.SearchAllResourcesRequest, + com.google.cloud.asset.v1.SearchAllResourcesResponse>( + this, METHODID_SEARCH_ALL_RESOURCES))) + .addMethod( + getSearchAllIamPoliciesMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest, + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse>( + this, METHODID_SEARCH_ALL_IAM_POLICIES))) .build(); } } @@ -556,8 +701,9 @@ protected AssetServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions ca *
      * Exports assets with time and resource types to a given Cloud Storage
      * location. The output format is newline-delimited JSON.
-     * This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
-     * to keep track of the export.
+     * This API implements the
+     * [google.longrunning.Operation][google.longrunning.Operation] API allowing
+     * you to keep track of the export.
      * 
*/ public void exportAssets( @@ -662,6 +808,46 @@ public void deleteFeed( asyncUnaryCall( getChannel().newCall(getDeleteFeedMethod(), getCallOptions()), request, responseObserver); } + + /** + * + * + *
+     * Searches all the resources within the given accessible scope (e.g., a
+     * project, a folder or an organization). Callers should have
+     * cloud.assets.SearchAllResources permission upon the requested scope,
+     * otherwise the request will be rejected.
+     * 
+ */ + public void searchAllResources( + com.google.cloud.asset.v1.SearchAllResourcesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getSearchAllResourcesMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Searches all the IAM policies within the given accessible scope (e.g., a
+     * project, a folder or an organization). Callers should have
+     * cloud.assets.SearchAllIamPolicies permission upon the requested scope,
+     * otherwise the request will be rejected.
+     * 
+ */ + public void searchAllIamPolicies( + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getSearchAllIamPoliciesMethod(), getCallOptions()), + request, + responseObserver); + } } /** @@ -689,8 +875,9 @@ protected AssetServiceBlockingStub build( *
      * Exports assets with time and resource types to a given Cloud Storage
      * location. The output format is newline-delimited JSON.
-     * This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
-     * to keep track of the export.
+     * This API implements the
+     * [google.longrunning.Operation][google.longrunning.Operation] API allowing
+     * you to keep track of the export.
      * 
*/ public com.google.longrunning.Operation exportAssets( @@ -777,6 +964,38 @@ public com.google.protobuf.Empty deleteFeed( com.google.cloud.asset.v1.DeleteFeedRequest request) { return blockingUnaryCall(getChannel(), getDeleteFeedMethod(), getCallOptions(), request); } + + /** + * + * + *
+     * Searches all the resources within the given accessible scope (e.g., a
+     * project, a folder or an organization). Callers should have
+     * cloud.assets.SearchAllResources permission upon the requested scope,
+     * otherwise the request will be rejected.
+     * 
+ */ + public com.google.cloud.asset.v1.SearchAllResourcesResponse searchAllResources( + com.google.cloud.asset.v1.SearchAllResourcesRequest request) { + return blockingUnaryCall( + getChannel(), getSearchAllResourcesMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Searches all the IAM policies within the given accessible scope (e.g., a
+     * project, a folder or an organization). Callers should have
+     * cloud.assets.SearchAllIamPolicies permission upon the requested scope,
+     * otherwise the request will be rejected.
+     * 
+ */ + public com.google.cloud.asset.v1.SearchAllIamPoliciesResponse searchAllIamPolicies( + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest request) { + return blockingUnaryCall( + getChannel(), getSearchAllIamPoliciesMethod(), getCallOptions(), request); + } } /** @@ -804,8 +1023,9 @@ protected AssetServiceFutureStub build( *
      * Exports assets with time and resource types to a given Cloud Storage
      * location. The output format is newline-delimited JSON.
-     * This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
-     * to keep track of the export.
+     * This API implements the
+     * [google.longrunning.Operation][google.longrunning.Operation] API allowing
+     * you to keep track of the export.
      * 
*/ public com.google.common.util.concurrent.ListenableFuture @@ -898,6 +1118,40 @@ public com.google.common.util.concurrent.ListenableFuture + * Searches all the resources within the given accessible scope (e.g., a + * project, a folder or an organization). Callers should have + * cloud.assets.SearchAllResources permission upon the requested scope, + * otherwise the request will be rejected. + * + */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.asset.v1.SearchAllResourcesResponse> + searchAllResources(com.google.cloud.asset.v1.SearchAllResourcesRequest request) { + return futureUnaryCall( + getChannel().newCall(getSearchAllResourcesMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Searches all the IAM policies within the given accessible scope (e.g., a
+     * project, a folder or an organization). Callers should have
+     * cloud.assets.SearchAllIamPolicies permission upon the requested scope,
+     * otherwise the request will be rejected.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse> + searchAllIamPolicies(com.google.cloud.asset.v1.SearchAllIamPoliciesRequest request) { + return futureUnaryCall( + getChannel().newCall(getSearchAllIamPoliciesMethod(), getCallOptions()), request); + } } private static final int METHODID_EXPORT_ASSETS = 0; @@ -907,6 +1161,8 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -962,6 +1218,18 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (com.google.cloud.asset.v1.DeleteFeedRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_SEARCH_ALL_RESOURCES: + serviceImpl.searchAllResources( + (com.google.cloud.asset.v1.SearchAllResourcesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_SEARCH_ALL_IAM_POLICIES: + serviceImpl.searchAllIamPolicies( + (com.google.cloud.asset.v1.SearchAllIamPoliciesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; default: throw new AssertionError(); } @@ -1033,6 +1301,8 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getListFeedsMethod()) .addMethod(getUpdateFeedMethod()) .addMethod(getDeleteFeedMethod()) + .addMethod(getSearchAllResourcesMethod()) + .addMethod(getSearchAllIamPoliciesMethod()) .build(); } } diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetProto.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetProto.java index 431a8c286..5fa6f411e 100644 --- a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetProto.java +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetProto.java @@ -43,6 +43,30 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_asset_v1_Resource_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_asset_v1_Resource_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_ResourceSearchResult_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_ResourceSearchResult_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_ResourceSearchResult_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_ResourceSearchResult_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_IamPolicySearchResult_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_IamPolicySearchResult_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_MatchedPermissionsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_MatchedPermissionsEntry_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -53,17 +77,17 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\"google/cloud/asset/v1/assets.proto\022\025go" - + "ogle.cloud.asset.v1\032\031google/api/resource" - + ".proto\032)google/cloud/orgpolicy/v1/orgpol" - + "icy.proto\032\032google/iam/v1/policy.proto\032:g" - + "oogle/identity/accesscontextmanager/v1/a" - + "ccess_level.proto\032;google/identity/acces" - + "scontextmanager/v1/access_policy.proto\032?" - + "google/identity/accesscontextmanager/v1/" - + "service_perimeter.proto\032\031google/protobuf" - + "/any.proto\032\034google/protobuf/struct.proto" - + "\032\037google/protobuf/timestamp.proto\032\034googl" - + "e/api/annotations.proto\"\200\001\n\rTemporalAsse" + + "ogle.cloud.asset.v1\032\034google/api/annotati" + + "ons.proto\032\031google/api/resource.proto\032)go" + + "ogle/cloud/orgpolicy/v1/orgpolicy.proto\032" + + "\032google/iam/v1/policy.proto\032:google/iden" + + "tity/accesscontextmanager/v1/access_leve" + + "l.proto\032;google/identity/accesscontextma" + + "nager/v1/access_policy.proto\032?google/ide" + + "ntity/accesscontextmanager/v1/service_pe" + + "rimeter.proto\032\031google/protobuf/any.proto" + + "\032\034google/protobuf/struct.proto\032\037google/p" + + "rotobuf/timestamp.proto\"\200\001\n\rTemporalAsse" + "t\0221\n\006window\030\001 \001(\0132!.google.cloud.asset.v" + "1.TimeWindow\022\017\n\007deleted\030\002 \001(\010\022+\n\005asset\030\003" + " \001(\0132\034.google.cloud.asset.v1.Asset\"j\n\nTi" @@ -82,20 +106,42 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "29.google.identity.accesscontextmanager." + "v1.ServicePerimeterH\000\022\021\n\tancestors\030\n \003(\t" + ":\'\352A$\n\037cloudasset.googleapis.com/Asset\022\001" - + "*B\027\n\025access_context_policy\"\240\001\n\010Resource\022" + + "*B\027\n\025access_context_policy\"\262\001\n\010Resource\022" + "\017\n\007version\030\001 \001(\t\022\036\n\026discovery_document_u" + "ri\030\002 \001(\t\022\026\n\016discovery_name\030\003 \001(\t\022\024\n\014reso" + "urce_url\030\004 \001(\t\022\016\n\006parent\030\005 \001(\t\022%\n\004data\030\006" - + " \001(\0132\027.google.protobuf.StructB\230\001\n\031com.go" - + "ogle.cloud.asset.v1B\nAssetProtoP\001Z:googl" - + "e.golang.org/genproto/googleapis/cloud/a" - + "sset/v1;asset\370\001\001\252\002\025Google.Cloud.Asset.V1" - + "\312\002\025Google\\Cloud\\Asset\\V1b\006proto3" + + " \001(\0132\027.google.protobuf.Struct\022\020\n\010locatio" + + "n\030\010 \001(\t\"\314\002\n\024ResourceSearchResult\022\014\n\004name" + + "\030\001 \001(\t\022\022\n\nasset_type\030\002 \001(\t\022\017\n\007project\030\003 " + + "\001(\t\022\024\n\014display_name\030\004 \001(\t\022\023\n\013description" + + "\030\005 \001(\t\022\020\n\010location\030\006 \001(\t\022G\n\006labels\030\007 \003(\013" + + "27.google.cloud.asset.v1.ResourceSearchR" + + "esult.LabelsEntry\022\024\n\014network_tags\030\010 \003(\t\022" + + "6\n\025additional_attributes\030\t \001(\0132\027.google." + + "protobuf.Struct\032-\n\013LabelsEntry\022\013\n\003key\030\001 " + + "\001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\324\003\n\025IamPolicySear" + + "chResult\022\020\n\010resource\030\001 \001(\t\022\017\n\007project\030\002 " + + "\001(\t\022%\n\006policy\030\003 \001(\0132\025.google.iam.v1.Poli" + + "cy\022M\n\013explanation\030\004 \001(\01328.google.cloud.a" + + "sset.v1.IamPolicySearchResult.Explanatio" + + "n\032\241\002\n\013Explanation\022m\n\023matched_permissions" + + "\030\001 \003(\0132P.google.cloud.asset.v1.IamPolicy" + + "SearchResult.Explanation.MatchedPermissi" + + "onsEntry\032\"\n\013Permissions\022\023\n\013permissions\030\001" + + " \003(\t\032\177\n\027MatchedPermissionsEntry\022\013\n\003key\030\001" + + " \001(\t\022S\n\005value\030\002 \001(\0132D.google.cloud.asset" + + ".v1.IamPolicySearchResult.Explanation.Pe" + + "rmissions:\0028\001B\230\001\n\031com.google.cloud.asset" + + ".v1B\nAssetProtoP\001Z:google.golang.org/gen" + + "proto/googleapis/cloud/asset/v1;asset\370\001\001" + + "\252\002\025Google.Cloud.Asset.V1\312\002\025Google\\Cloud\\" + + "Asset\\V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.cloud.orgpolicy.v1.OrgPolicyProto.getDescriptor(), com.google.iam.v1.PolicyProto.getDescriptor(), @@ -105,7 +151,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.AnyProto.getDescriptor(), com.google.protobuf.StructProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_cloud_asset_v1_TemporalAsset_descriptor = getDescriptor().getMessageTypes().get(0); @@ -146,13 +191,84 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_asset_v1_Resource_descriptor, new java.lang.String[] { - "Version", "DiscoveryDocumentUri", "DiscoveryName", "ResourceUrl", "Parent", "Data", + "Version", + "DiscoveryDocumentUri", + "DiscoveryName", + "ResourceUrl", + "Parent", + "Data", + "Location", + }); + internal_static_google_cloud_asset_v1_ResourceSearchResult_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_asset_v1_ResourceSearchResult_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_ResourceSearchResult_descriptor, + new java.lang.String[] { + "Name", + "AssetType", + "Project", + "DisplayName", + "Description", + "Location", + "Labels", + "NetworkTags", + "AdditionalAttributes", + }); + internal_static_google_cloud_asset_v1_ResourceSearchResult_LabelsEntry_descriptor = + internal_static_google_cloud_asset_v1_ResourceSearchResult_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_asset_v1_ResourceSearchResult_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_ResourceSearchResult_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_asset_v1_IamPolicySearchResult_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_asset_v1_IamPolicySearchResult_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_IamPolicySearchResult_descriptor, + new java.lang.String[] { + "Resource", "Project", "Policy", "Explanation", + }); + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor = + internal_static_google_cloud_asset_v1_IamPolicySearchResult_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor, + new java.lang.String[] { + "MatchedPermissions", + }); + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_descriptor = + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_descriptor, + new java.lang.String[] { + "Permissions", + }); + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_MatchedPermissionsEntry_descriptor = + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor + .getNestedTypes() + .get(1); + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_MatchedPermissionsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_MatchedPermissionsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.ResourceProto.resource); com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); com.google.cloud.orgpolicy.v1.OrgPolicyProto.getDescriptor(); com.google.iam.v1.PolicyProto.getDescriptor(); @@ -162,7 +278,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.AnyProto.getDescriptor(); com.google.protobuf.StructProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceProto.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceProto.java index aeeca1f2c..3f7a21dba 100644 --- a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceProto.java +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/AssetServiceProto.java @@ -91,6 +91,22 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_asset_v1_Feed_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_asset_v1_Feed_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_asset_v1_SearchAllIamPoliciesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_asset_v1_SearchAllIamPoliciesResponse_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -160,42 +176,65 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + ".googleapis.com/Feed\022\037projects/{project}" + "/feeds/{feed}\022\035folders/{folder}/feeds/{f" + "eed}\022)organizations/{organization}/feeds" - + "/{feed} \001*l\n\013ContentType\022\034\n\030CONTENT_TYPE" - + "_UNSPECIFIED\020\000\022\014\n\010RESOURCE\020\001\022\016\n\nIAM_POLI" - + "CY\020\002\022\016\n\nORG_POLICY\020\004\022\021\n\rACCESS_POLICY\020\0052" - + "\360\010\n\014AssetService\022\336\001\n\014ExportAssets\022*.goog" - + "le.cloud.asset.v1.ExportAssetsRequest\032\035." - + "google.longrunning.Operation\"\202\001\202\323\344\223\002\"\"\035/" - + "v1/{parent=*/*}:exportAssets:\001*\312AW\n*goog" - + "le.cloud.asset.v1.ExportAssetsResponse\022)" - + "google.cloud.asset.v1.ExportAssetsReques" - + "t\022\262\001\n\025BatchGetAssetsHistory\0223.google.clo" - + "ud.asset.v1.BatchGetAssetsHistoryRequest" - + "\0324.google.cloud.asset.v1.BatchGetAssetsH" - + "istoryResponse\".\202\323\344\223\002(\022&/v1/{parent=*/*}" - + ":batchGetAssetsHistory\022\177\n\nCreateFeed\022(.g" - + "oogle.cloud.asset.v1.CreateFeedRequest\032\033" - + ".google.cloud.asset.v1.Feed\"*\202\323\344\223\002\033\"\026/v1" - + "/{parent=*/*}/feeds:\001*\332A\006parent\022t\n\007GetFe" - + "ed\022%.google.cloud.asset.v1.GetFeedReques" - + "t\032\033.google.cloud.asset.v1.Feed\"%\202\323\344\223\002\030\022\026" - + "/v1/{name=*/*/feeds/*}\332A\004name\022\207\001\n\tListFe" - + "eds\022\'.google.cloud.asset.v1.ListFeedsReq" - + "uest\032(.google.cloud.asset.v1.ListFeedsRe" - + "sponse\"\'\202\323\344\223\002\030\022\026/v1/{parent=*/*}/feeds\332A" - + "\006parent\022\202\001\n\nUpdateFeed\022(.google.cloud.as" - + "set.v1.UpdateFeedRequest\032\033.google.cloud." - + "asset.v1.Feed\"-\202\323\344\223\002 2\033/v1/{feed.name=*/" - + "*/feeds/*}:\001*\332A\004feed\022u\n\nDeleteFeed\022(.goo" - + "gle.cloud.asset.v1.DeleteFeedRequest\032\026.g" - + "oogle.protobuf.Empty\"%\202\323\344\223\002\030*\026/v1/{name=" - + "*/*/feeds/*}\332A\004name\032M\312A\031cloudasset.googl" - + "eapis.com\322A.https://www.googleapis.com/a" - + "uth/cloud-platformB\234\001\n\031com.google.cloud." - + "asset.v1B\021AssetServiceProtoP\001Z:google.go" - + "lang.org/genproto/googleapis/cloud/asset" - + "/v1;asset\252\002\025Google.Cloud.Asset.V1\312\002\025Goog" - + "le\\Cloud\\Asset\\V1b\006proto3" + + "/{feed} \001\"\245\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_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\022\025\n\010or" + + "der_by\030\006 \001(\tB\003\340A\001\"s\n\032SearchAllResourcesR" + + "esponse\022<\n\007results\030\001 \003(\0132+.google.cloud." + + "asset.v1.ResourceSearchResult\022\027\n\017next_pa" + + "ge_token\030\002 \001(\t\"v\n\033SearchAllIamPoliciesRe" + + "quest\022\022\n\005scope\030\001 \001(\tB\003\340A\002\022\022\n\005query\030\002 \001(\t" + + "B\003\340A\001\022\026\n\tpage_size\030\003 \001(\005B\003\340A\001\022\027\n\npage_to" + + "ken\030\004 \001(\tB\003\340A\001\"v\n\034SearchAllIamPoliciesRe" + + "sponse\022=\n\007results\030\001 \003(\0132,.google.cloud.a" + + "sset.v1.IamPolicySearchResult\022\027\n\017next_pa" + + "ge_token\030\002 \001(\t*l\n\013ContentType\022\034\n\030CONTENT" + + "_TYPE_UNSPECIFIED\020\000\022\014\n\010RESOURCE\020\001\022\016\n\nIAM" + + "_POLICY\020\002\022\016\n\nORG_POLICY\020\004\022\021\n\rACCESS_POLI" + + "CY\020\0052\360\013\n\014AssetService\022\336\001\n\014ExportAssets\022*" + + ".google.cloud.asset.v1.ExportAssetsReque" + + "st\032\035.google.longrunning.Operation\"\202\001\202\323\344\223" + + "\002\"\"\035/v1/{parent=*/*}:exportAssets:\001*\312AW\n" + + "*google.cloud.asset.v1.ExportAssetsRespo" + + "nse\022)google.cloud.asset.v1.ExportAssetsR" + + "equest\022\262\001\n\025BatchGetAssetsHistory\0223.googl" + + "e.cloud.asset.v1.BatchGetAssetsHistoryRe" + + "quest\0324.google.cloud.asset.v1.BatchGetAs" + + "setsHistoryResponse\".\202\323\344\223\002(\022&/v1/{parent" + + "=*/*}:batchGetAssetsHistory\022\177\n\nCreateFee" + + "d\022(.google.cloud.asset.v1.CreateFeedRequ" + + "est\032\033.google.cloud.asset.v1.Feed\"*\202\323\344\223\002\033" + + "\"\026/v1/{parent=*/*}/feeds:\001*\332A\006parent\022t\n\007" + + "GetFeed\022%.google.cloud.asset.v1.GetFeedR" + + "equest\032\033.google.cloud.asset.v1.Feed\"%\202\323\344" + + "\223\002\030\022\026/v1/{name=*/*/feeds/*}\332A\004name\022\207\001\n\tL" + + "istFeeds\022\'.google.cloud.asset.v1.ListFee" + + "dsRequest\032(.google.cloud.asset.v1.ListFe" + + "edsResponse\"\'\202\323\344\223\002\030\022\026/v1/{parent=*/*}/fe" + + "eds\332A\006parent\022\202\001\n\nUpdateFeed\022(.google.clo" + + "ud.asset.v1.UpdateFeedRequest\032\033.google.c" + + "loud.asset.v1.Feed\"-\202\323\344\223\002 2\033/v1/{feed.na" + + "me=*/*/feeds/*}:\001*\332A\004feed\022u\n\nDeleteFeed\022" + + "(.google.cloud.asset.v1.DeleteFeedReques" + + "t\032\026.google.protobuf.Empty\"%\202\323\344\223\002\030*\026/v1/{" + + "name=*/*/feeds/*}\332A\004name\022\277\001\n\022SearchAllRe" + + "sources\0220.google.cloud.asset.v1.SearchAl" + + "lResourcesRequest\0321.google.cloud.asset.v" + + "1.SearchAllResourcesResponse\"D\202\323\344\223\002$\022\"/v" + + "1/{scope=*/*}:searchAllResources\332A\027scope" + + ",query,asset_types\022\273\001\n\024SearchAllIamPolic" + + "ies\0222.google.cloud.asset.v1.SearchAllIam" + + "PoliciesRequest\0323.google.cloud.asset.v1." + + "SearchAllIamPoliciesResponse\":\202\323\344\223\002&\022$/v" + + "1/{scope=*/*}:searchAllIamPolicies\332A\013sco" + + "pe,query\032M\312A\031cloudasset.googleapis.com\322A" + + ".https://www.googleapis.com/auth/cloud-p" + + "latformB\234\001\n\031com.google.cloud.asset.v1B\021A" + + "ssetServiceProtoP\001Z:google.golang.org/ge" + + "nproto/googleapis/cloud/asset/v1;asset\252\002" + + "\025Google.Cloud.Asset.V1\312\002\025Google\\Cloud\\As" + + "set\\V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -340,6 +379,38 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Name", "AssetNames", "AssetTypes", "ContentType", "FeedOutputConfig", }); + internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_descriptor = + getDescriptor().getMessageTypes().get(16); + internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_descriptor, + new java.lang.String[] { + "Scope", "Query", "AssetTypes", "PageSize", "PageToken", "OrderBy", + }); + internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_descriptor = + getDescriptor().getMessageTypes().get(17); + internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_descriptor, + new java.lang.String[] { + "Results", "NextPageToken", + }); + internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_descriptor = + getDescriptor().getMessageTypes().get(18); + internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_descriptor, + new java.lang.String[] { + "Scope", "Query", "PageSize", "PageToken", + }); + internal_static_google_cloud_asset_v1_SearchAllIamPoliciesResponse_descriptor = + getDescriptor().getMessageTypes().get(19); + internal_static_google_cloud_asset_v1_SearchAllIamPoliciesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_asset_v1_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); diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/CreateFeedRequest.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/CreateFeedRequest.java index 9921e9d91..567b537f8 100644 --- a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/CreateFeedRequest.java +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/CreateFeedRequest.java @@ -243,9 +243,8 @@ public com.google.protobuf.ByteString getFeedIdBytes() { * * *
-   * Required. The feed details. The field `name` must be empty and it will be generated
-   * in the format of:
-   * projects/project_number/feeds/feed_id
+   * Required. The feed details. The field `name` must be empty and it will be
+   * generated in the format of: projects/project_number/feeds/feed_id
    * folders/folder_number/feeds/feed_id
    * organizations/organization_number/feeds/feed_id
    * 
@@ -261,9 +260,8 @@ public boolean hasFeed() { * * *
-   * Required. The feed details. The field `name` must be empty and it will be generated
-   * in the format of:
-   * projects/project_number/feeds/feed_id
+   * Required. The feed details. The field `name` must be empty and it will be
+   * generated in the format of: projects/project_number/feeds/feed_id
    * folders/folder_number/feeds/feed_id
    * organizations/organization_number/feeds/feed_id
    * 
@@ -279,9 +277,8 @@ public com.google.cloud.asset.v1.Feed getFeed() { * * *
-   * Required. The feed details. The field `name` must be empty and it will be generated
-   * in the format of:
-   * projects/project_number/feeds/feed_id
+   * Required. The feed details. The field `name` must be empty and it will be
+   * generated in the format of: projects/project_number/feeds/feed_id
    * folders/folder_number/feeds/feed_id
    * organizations/organization_number/feeds/feed_id
    * 
@@ -899,9 +896,8 @@ public Builder setFeedIdBytes(com.google.protobuf.ByteString value) { * * *
-     * Required. The feed details. The field `name` must be empty and it will be generated
-     * in the format of:
-     * projects/project_number/feeds/feed_id
+     * Required. The feed details. The field `name` must be empty and it will be
+     * generated in the format of: projects/project_number/feeds/feed_id
      * folders/folder_number/feeds/feed_id
      * organizations/organization_number/feeds/feed_id
      * 
@@ -917,9 +913,8 @@ public boolean hasFeed() { * * *
-     * Required. The feed details. The field `name` must be empty and it will be generated
-     * in the format of:
-     * projects/project_number/feeds/feed_id
+     * Required. The feed details. The field `name` must be empty and it will be
+     * generated in the format of: projects/project_number/feeds/feed_id
      * folders/folder_number/feeds/feed_id
      * organizations/organization_number/feeds/feed_id
      * 
@@ -939,9 +934,8 @@ public com.google.cloud.asset.v1.Feed getFeed() { * * *
-     * Required. The feed details. The field `name` must be empty and it will be generated
-     * in the format of:
-     * projects/project_number/feeds/feed_id
+     * Required. The feed details. The field `name` must be empty and it will be
+     * generated in the format of: projects/project_number/feeds/feed_id
      * folders/folder_number/feeds/feed_id
      * organizations/organization_number/feeds/feed_id
      * 
@@ -965,9 +959,8 @@ public Builder setFeed(com.google.cloud.asset.v1.Feed value) { * * *
-     * Required. The feed details. The field `name` must be empty and it will be generated
-     * in the format of:
-     * projects/project_number/feeds/feed_id
+     * Required. The feed details. The field `name` must be empty and it will be
+     * generated in the format of: projects/project_number/feeds/feed_id
      * folders/folder_number/feeds/feed_id
      * organizations/organization_number/feeds/feed_id
      * 
@@ -988,9 +981,8 @@ public Builder setFeed(com.google.cloud.asset.v1.Feed.Builder builderForValue) { * * *
-     * Required. The feed details. The field `name` must be empty and it will be generated
-     * in the format of:
-     * projects/project_number/feeds/feed_id
+     * Required. The feed details. The field `name` must be empty and it will be
+     * generated in the format of: projects/project_number/feeds/feed_id
      * folders/folder_number/feeds/feed_id
      * organizations/organization_number/feeds/feed_id
      * 
@@ -1015,9 +1007,8 @@ public Builder mergeFeed(com.google.cloud.asset.v1.Feed value) { * * *
-     * Required. The feed details. The field `name` must be empty and it will be generated
-     * in the format of:
-     * projects/project_number/feeds/feed_id
+     * Required. The feed details. The field `name` must be empty and it will be
+     * generated in the format of: projects/project_number/feeds/feed_id
      * folders/folder_number/feeds/feed_id
      * organizations/organization_number/feeds/feed_id
      * 
@@ -1039,9 +1030,8 @@ public Builder clearFeed() { * * *
-     * Required. The feed details. The field `name` must be empty and it will be generated
-     * in the format of:
-     * projects/project_number/feeds/feed_id
+     * Required. The feed details. The field `name` must be empty and it will be
+     * generated in the format of: projects/project_number/feeds/feed_id
      * folders/folder_number/feeds/feed_id
      * organizations/organization_number/feeds/feed_id
      * 
@@ -1057,9 +1047,8 @@ public com.google.cloud.asset.v1.Feed.Builder getFeedBuilder() { * * *
-     * Required. The feed details. The field `name` must be empty and it will be generated
-     * in the format of:
-     * projects/project_number/feeds/feed_id
+     * Required. The feed details. The field `name` must be empty and it will be
+     * generated in the format of: projects/project_number/feeds/feed_id
      * folders/folder_number/feeds/feed_id
      * organizations/organization_number/feeds/feed_id
      * 
@@ -1077,9 +1066,8 @@ public com.google.cloud.asset.v1.FeedOrBuilder getFeedOrBuilder() { * * *
-     * Required. The feed details. The field `name` must be empty and it will be generated
-     * in the format of:
-     * projects/project_number/feeds/feed_id
+     * Required. The feed details. The field `name` must be empty and it will be
+     * generated in the format of: projects/project_number/feeds/feed_id
      * folders/folder_number/feeds/feed_id
      * organizations/organization_number/feeds/feed_id
      * 
diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/CreateFeedRequestOrBuilder.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/CreateFeedRequestOrBuilder.java index 50a62037b..8b873ad91 100644 --- a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/CreateFeedRequestOrBuilder.java +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/CreateFeedRequestOrBuilder.java @@ -87,9 +87,8 @@ public interface CreateFeedRequestOrBuilder * * *
-   * Required. The feed details. The field `name` must be empty and it will be generated
-   * in the format of:
-   * projects/project_number/feeds/feed_id
+   * Required. The feed details. The field `name` must be empty and it will be
+   * generated in the format of: projects/project_number/feeds/feed_id
    * folders/folder_number/feeds/feed_id
    * organizations/organization_number/feeds/feed_id
    * 
@@ -103,9 +102,8 @@ public interface CreateFeedRequestOrBuilder * * *
-   * Required. The feed details. The field `name` must be empty and it will be generated
-   * in the format of:
-   * projects/project_number/feeds/feed_id
+   * Required. The feed details. The field `name` must be empty and it will be
+   * generated in the format of: projects/project_number/feeds/feed_id
    * folders/folder_number/feeds/feed_id
    * organizations/organization_number/feeds/feed_id
    * 
@@ -119,9 +117,8 @@ public interface CreateFeedRequestOrBuilder * * *
-   * Required. The feed details. The field `name` must be empty and it will be generated
-   * in the format of:
-   * projects/project_number/feeds/feed_id
+   * Required. The feed details. The field `name` must be empty and it will be
+   * generated in the format of: projects/project_number/feeds/feed_id
    * folders/folder_number/feeds/feed_id
    * organizations/organization_number/feeds/feed_id
    * 
diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ExportAssetsResponse.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ExportAssetsResponse.java index 8f5eb46c0..e263452ff 100644 --- a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ExportAssetsResponse.java +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ExportAssetsResponse.java @@ -23,8 +23,10 @@ * *
  * The export asset response. This message is returned by the
- * [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned
- * [google.longrunning.Operation.response][google.longrunning.Operation.response] field.
+ * [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation]
+ * method in the returned
+ * [google.longrunning.Operation.response][google.longrunning.Operation.response]
+ * field.
  * 
* * Protobuf type {@code google.cloud.asset.v1.ExportAssetsResponse} @@ -409,8 +411,10 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * *
    * The export asset response. This message is returned by the
-   * [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned
-   * [google.longrunning.Operation.response][google.longrunning.Operation.response] field.
+   * [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation]
+   * method in the returned
+   * [google.longrunning.Operation.response][google.longrunning.Operation.response]
+   * field.
    * 
* * Protobuf type {@code google.cloud.asset.v1.ExportAssetsResponse} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/IamPolicySearchResult.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/IamPolicySearchResult.java new file mode 100644 index 000000000..123aa2de0 --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/IamPolicySearchResult.java @@ -0,0 +1,3435 @@ +/* + * 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/v1/assets.proto + +package com.google.cloud.asset.v1; + +/** + * + * + *
+ * A result of IAM Policy search, containing information of an IAM policy.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult} + */ +public final class IamPolicySearchResult extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.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 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + project_ = s; + break; + } + case 26: + { + 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; + } + case 34: + { + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder subBuilder = null; + if (explanation_ != null) { + subBuilder = explanation_.toBuilder(); + } + explanation_ = + input.readMessage( + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(explanation_); + explanation_ = 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.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.IamPolicySearchResult.class, + com.google.cloud.asset.v1.IamPolicySearchResult.Builder.class); + } + + public interface ExplanationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.IamPolicySearchResult.Explanation) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The map from roles to their included permissions that match the
+     * permission query (i.e., a query containing `policy.role.permissions:`).
+     * Example: if query `policy.role.permissions : "compute.disk.get"`
+     * matches a policy binding that contains owner role, the
+     * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+     * roles can also be found in the returned `policy` bindings. Note that the
+     * map is populated only for requests with permission queries.
+     * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + int getMatchedPermissionsCount(); + /** + * + * + *
+     * The map from roles to their included permissions that match the
+     * permission query (i.e., a query containing `policy.role.permissions:`).
+     * Example: if query `policy.role.permissions : "compute.disk.get"`
+     * matches a policy binding that contains owner role, the
+     * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+     * roles can also be found in the returned `policy` bindings. Note that the
+     * map is populated only for requests with permission queries.
+     * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + boolean containsMatchedPermissions(java.lang.String key); + /** Use {@link #getMatchedPermissionsMap()} instead. */ + @java.lang.Deprecated + java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + getMatchedPermissions(); + /** + * + * + *
+     * The map from roles to their included permissions that match the
+     * permission query (i.e., a query containing `policy.role.permissions:`).
+     * Example: if query `policy.role.permissions : "compute.disk.get"`
+     * matches a policy binding that contains owner role, the
+     * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+     * roles can also be found in the returned `policy` bindings. Note that the
+     * map is populated only for requests with permission queries.
+     * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + getMatchedPermissionsMap(); + /** + * + * + *
+     * The map from roles to their included permissions that match the
+     * permission query (i.e., a query containing `policy.role.permissions:`).
+     * Example: if query `policy.role.permissions : "compute.disk.get"`
+     * matches a policy binding that contains owner role, the
+     * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+     * roles can also be found in the returned `policy` bindings. Note that the
+     * map is populated only for requests with permission queries.
+     * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + getMatchedPermissionsOrDefault( + java.lang.String key, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions defaultValue); + /** + * + * + *
+     * The map from roles to their included permissions that match the
+     * permission query (i.e., a query containing `policy.role.permissions:`).
+     * Example: if query `policy.role.permissions : "compute.disk.get"`
+     * matches a policy binding that contains owner role, the
+     * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+     * roles can also be found in the returned `policy` bindings. Note that the
+     * map is populated only for requests with permission queries.
+     * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + getMatchedPermissionsOrThrow(java.lang.String key); + } + /** + * + * + *
+   * Explanation about the IAM policy search result.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult.Explanation} + */ + public static final class Explanation extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.IamPolicySearchResult.Explanation) + ExplanationOrBuilder { + private static final long serialVersionUID = 0L; + // Use Explanation.newBuilder() to construct. + private Explanation(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Explanation() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Explanation(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Explanation( + 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)) { + matchedPermissions_ = + com.google.protobuf.MapField.newMapField( + MatchedPermissionsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + matchedPermissions__ = + input.readMessage( + MatchedPermissionsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + matchedPermissions_ + .getMutableMap() + .put(matchedPermissions__.getKey(), matchedPermissions__.getValue()); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetMatchedPermissions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.class, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder.class); + } + + public interface PermissionsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+       * A list of permissions. A sample permission string: "compute.disk.get".
+       * 
+ * + * repeated string permissions = 1; + * + * @return A list containing the permissions. + */ + java.util.List getPermissionsList(); + /** + * + * + *
+       * A list of permissions. A sample permission string: "compute.disk.get".
+       * 
+ * + * repeated string permissions = 1; + * + * @return The count of permissions. + */ + int getPermissionsCount(); + /** + * + * + *
+       * A list of permissions. A sample permission string: "compute.disk.get".
+       * 
+ * + * repeated string permissions = 1; + * + * @param index The index of the element to return. + * @return The permissions at the given index. + */ + java.lang.String getPermissions(int index); + /** + * + * + *
+       * A list of permissions. A sample permission string: "compute.disk.get".
+       * 
+ * + * repeated string permissions = 1; + * + * @param index The index of the value to return. + * @return The bytes of the permissions at the given index. + */ + com.google.protobuf.ByteString getPermissionsBytes(int index); + } + /** + * + * + *
+     * IAM permissions
+     * 
+ * + * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions} + */ + public static final class Permissions extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) + PermissionsOrBuilder { + private static final long serialVersionUID = 0L; + // Use Permissions.newBuilder() to construct. + private Permissions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Permissions() { + permissions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Permissions(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Permissions( + 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(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + permissions_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + permissions_.add(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)) { + permissions_ = permissions_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.class, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.Builder + .class); + } + + public static final int PERMISSIONS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList permissions_; + /** + * + * + *
+       * A list of permissions. A sample permission string: "compute.disk.get".
+       * 
+ * + * repeated string permissions = 1; + * + * @return A list containing the permissions. + */ + public com.google.protobuf.ProtocolStringList getPermissionsList() { + return permissions_; + } + /** + * + * + *
+       * A list of permissions. A sample permission string: "compute.disk.get".
+       * 
+ * + * repeated string permissions = 1; + * + * @return The count of permissions. + */ + public int getPermissionsCount() { + return permissions_.size(); + } + /** + * + * + *
+       * A list of permissions. A sample permission string: "compute.disk.get".
+       * 
+ * + * repeated string permissions = 1; + * + * @param index The index of the element to return. + * @return The permissions at the given index. + */ + public java.lang.String getPermissions(int index) { + return permissions_.get(index); + } + /** + * + * + *
+       * A list of permissions. A sample permission string: "compute.disk.get".
+       * 
+ * + * repeated string permissions = 1; + * + * @param index The index of the value to return. + * @return The bytes of the permissions at the given index. + */ + public com.google.protobuf.ByteString getPermissionsBytes(int index) { + return permissions_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < permissions_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, permissions_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < permissions_.size(); i++) { + dataSize += computeStringSizeNoTag(permissions_.getRaw(i)); + } + size += dataSize; + size += 1 * getPermissionsList().size(); + } + 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.v1.IamPolicySearchResult.Explanation.Permissions)) { + return super.equals(obj); + } + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions other = + (com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) obj; + + if (!getPermissionsList().equals(other.getPermissionsList())) 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 (getPermissionsCount() > 0) { + hash = (37 * hash) + PERMISSIONS_FIELD_NUMBER; + hash = (53 * hash) + getPermissionsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + 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.v1.IamPolicySearchResult.Explanation.Permissions + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + 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.v1.IamPolicySearchResult.Explanation.Permissions + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + 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.v1.IamPolicySearchResult.Explanation.Permissions + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + 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.v1.IamPolicySearchResult.Explanation.Permissions + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + 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.v1.IamPolicySearchResult.Explanation.Permissions 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; + } + /** + * + * + *
+       * IAM permissions
+       * 
+ * + * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.PermissionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.class, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.Builder + .class); + } + + // Construct using + // com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.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(); + permissions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + getDefaultInstanceForType() { + return com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions build() { + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + buildPartial() { + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions result = + new com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + permissions_ = permissions_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.permissions_ = permissions_; + 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.v1.IamPolicySearchResult.Explanation.Permissions) { + return mergeFrom( + (com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions other) { + if (other + == com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + .getDefaultInstance()) return this; + if (!other.permissions_.isEmpty()) { + if (permissions_.isEmpty()) { + permissions_ = other.permissions_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePermissionsIsMutable(); + permissions_.addAll(other.permissions_); + } + 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.v1.IamPolicySearchResult.Explanation.Permissions parsedMessage = + null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList permissions_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensurePermissionsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + permissions_ = new com.google.protobuf.LazyStringArrayList(permissions_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+         * A list of permissions. A sample permission string: "compute.disk.get".
+         * 
+ * + * repeated string permissions = 1; + * + * @return A list containing the permissions. + */ + public com.google.protobuf.ProtocolStringList getPermissionsList() { + return permissions_.getUnmodifiableView(); + } + /** + * + * + *
+         * A list of permissions. A sample permission string: "compute.disk.get".
+         * 
+ * + * repeated string permissions = 1; + * + * @return The count of permissions. + */ + public int getPermissionsCount() { + return permissions_.size(); + } + /** + * + * + *
+         * A list of permissions. A sample permission string: "compute.disk.get".
+         * 
+ * + * repeated string permissions = 1; + * + * @param index The index of the element to return. + * @return The permissions at the given index. + */ + public java.lang.String getPermissions(int index) { + return permissions_.get(index); + } + /** + * + * + *
+         * A list of permissions. A sample permission string: "compute.disk.get".
+         * 
+ * + * repeated string permissions = 1; + * + * @param index The index of the value to return. + * @return The bytes of the permissions at the given index. + */ + public com.google.protobuf.ByteString getPermissionsBytes(int index) { + return permissions_.getByteString(index); + } + /** + * + * + *
+         * A list of permissions. A sample permission string: "compute.disk.get".
+         * 
+ * + * repeated string permissions = 1; + * + * @param index The index to set the value at. + * @param value The permissions to set. + * @return This builder for chaining. + */ + public Builder setPermissions(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePermissionsIsMutable(); + permissions_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+         * A list of permissions. A sample permission string: "compute.disk.get".
+         * 
+ * + * repeated string permissions = 1; + * + * @param value The permissions to add. + * @return This builder for chaining. + */ + public Builder addPermissions(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePermissionsIsMutable(); + permissions_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+         * A list of permissions. A sample permission string: "compute.disk.get".
+         * 
+ * + * repeated string permissions = 1; + * + * @param values The permissions to add. + * @return This builder for chaining. + */ + public Builder addAllPermissions(java.lang.Iterable values) { + ensurePermissionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, permissions_); + onChanged(); + return this; + } + /** + * + * + *
+         * A list of permissions. A sample permission string: "compute.disk.get".
+         * 
+ * + * repeated string permissions = 1; + * + * @return This builder for chaining. + */ + public Builder clearPermissions() { + permissions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+         * A list of permissions. A sample permission string: "compute.disk.get".
+         * 
+ * + * repeated string permissions = 1; + * + * @param value The bytes of the permissions to add. + * @return This builder for chaining. + */ + public Builder addPermissionsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensurePermissionsIsMutable(); + permissions_.add(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.v1.IamPolicySearchResult.Explanation.Permissions) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) + private static final com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions(); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Permissions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Permissions(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.v1.IamPolicySearchResult.Explanation.Permissions + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int MATCHED_PERMISSIONS_FIELD_NUMBER = 1; + + private static final class MatchedPermissionsDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + defaultEntry = + com.google.protobuf.MapEntry + . + newDefaultInstance( + com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_MatchedPermissionsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + .getDefaultInstance()); + } + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + matchedPermissions_; + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + internalGetMatchedPermissions() { + if (matchedPermissions_ == null) { + return com.google.protobuf.MapField.emptyMapField( + MatchedPermissionsDefaultEntryHolder.defaultEntry); + } + return matchedPermissions_; + } + + public int getMatchedPermissionsCount() { + return internalGetMatchedPermissions().getMap().size(); + } + /** + * + * + *
+     * The map from roles to their included permissions that match the
+     * permission query (i.e., a query containing `policy.role.permissions:`).
+     * Example: if query `policy.role.permissions : "compute.disk.get"`
+     * matches a policy binding that contains owner role, the
+     * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+     * roles can also be found in the returned `policy` bindings. Note that the
+     * map is populated only for requests with permission queries.
+     * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public boolean containsMatchedPermissions(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetMatchedPermissions().getMap().containsKey(key); + } + /** Use {@link #getMatchedPermissionsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + getMatchedPermissions() { + return getMatchedPermissionsMap(); + } + /** + * + * + *
+     * The map from roles to their included permissions that match the
+     * permission query (i.e., a query containing `policy.role.permissions:`).
+     * Example: if query `policy.role.permissions : "compute.disk.get"`
+     * matches a policy binding that contains owner role, the
+     * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+     * roles can also be found in the returned `policy` bindings. Note that the
+     * map is populated only for requests with permission queries.
+     * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + getMatchedPermissionsMap() { + return internalGetMatchedPermissions().getMap(); + } + /** + * + * + *
+     * The map from roles to their included permissions that match the
+     * permission query (i.e., a query containing `policy.role.permissions:`).
+     * Example: if query `policy.role.permissions : "compute.disk.get"`
+     * matches a policy binding that contains owner role, the
+     * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+     * roles can also be found in the returned `policy` bindings. Note that the
+     * map is populated only for requests with permission queries.
+     * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + getMatchedPermissionsOrDefault( + java.lang.String key, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + map = internalGetMatchedPermissions().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * The map from roles to their included permissions that match the
+     * permission query (i.e., a query containing `policy.role.permissions:`).
+     * Example: if query `policy.role.permissions : "compute.disk.get"`
+     * matches a policy binding that contains owner role, the
+     * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+     * roles can also be found in the returned `policy` bindings. Note that the
+     * map is populated only for requests with permission queries.
+     * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + getMatchedPermissionsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + map = internalGetMatchedPermissions().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, + internalGetMatchedPermissions(), + MatchedPermissionsDefaultEntryHolder.defaultEntry, + 1); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + entry : internalGetMatchedPermissions().getMap().entrySet()) { + com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + matchedPermissions__ = + MatchedPermissionsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, matchedPermissions__); + } + 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.v1.IamPolicySearchResult.Explanation)) { + return super.equals(obj); + } + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation other = + (com.google.cloud.asset.v1.IamPolicySearchResult.Explanation) obj; + + if (!internalGetMatchedPermissions().equals(other.internalGetMatchedPermissions())) + 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 (!internalGetMatchedPermissions().getMap().isEmpty()) { + hash = (37 * hash) + MATCHED_PERMISSIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetMatchedPermissions().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation 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.v1.IamPolicySearchResult.Explanation parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation 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.v1.IamPolicySearchResult.Explanation parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation 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.v1.IamPolicySearchResult.Explanation parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation 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.v1.IamPolicySearchResult.Explanation parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation 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.v1.IamPolicySearchResult.Explanation 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; + } + /** + * + * + *
+     * Explanation about the IAM policy search result.
+     * 
+ * + * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult.Explanation} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.IamPolicySearchResult.Explanation) + com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetMatchedPermissions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 1: + return internalGetMutableMatchedPermissions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.class, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder.class); + } + + // Construct using com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.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(); + internalGetMutableMatchedPermissions().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation + getDefaultInstanceForType() { + return com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation build() { + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation buildPartial() { + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation result = + new com.google.cloud.asset.v1.IamPolicySearchResult.Explanation(this); + int from_bitField0_ = bitField0_; + result.matchedPermissions_ = internalGetMatchedPermissions(); + result.matchedPermissions_.makeImmutable(); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.asset.v1.IamPolicySearchResult.Explanation) { + return mergeFrom((com.google.cloud.asset.v1.IamPolicySearchResult.Explanation) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1.IamPolicySearchResult.Explanation other) { + if (other + == com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance()) + return this; + internalGetMutableMatchedPermissions().mergeFrom(other.internalGetMatchedPermissions()); + 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.v1.IamPolicySearchResult.Explanation parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1.IamPolicySearchResult.Explanation) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + matchedPermissions_; + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + internalGetMatchedPermissions() { + if (matchedPermissions_ == null) { + return com.google.protobuf.MapField.emptyMapField( + MatchedPermissionsDefaultEntryHolder.defaultEntry); + } + return matchedPermissions_; + } + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + internalGetMutableMatchedPermissions() { + onChanged(); + ; + if (matchedPermissions_ == null) { + matchedPermissions_ = + com.google.protobuf.MapField.newMapField( + MatchedPermissionsDefaultEntryHolder.defaultEntry); + } + if (!matchedPermissions_.isMutable()) { + matchedPermissions_ = matchedPermissions_.copy(); + } + return matchedPermissions_; + } + + public int getMatchedPermissionsCount() { + return internalGetMatchedPermissions().getMap().size(); + } + /** + * + * + *
+       * The map from roles to their included permissions that match the
+       * permission query (i.e., a query containing `policy.role.permissions:`).
+       * Example: if query `policy.role.permissions : "compute.disk.get"`
+       * matches a policy binding that contains owner role, the
+       * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+       * roles can also be found in the returned `policy` bindings. Note that the
+       * map is populated only for requests with permission queries.
+       * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public boolean containsMatchedPermissions(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetMatchedPermissions().getMap().containsKey(key); + } + /** Use {@link #getMatchedPermissionsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + getMatchedPermissions() { + return getMatchedPermissionsMap(); + } + /** + * + * + *
+       * The map from roles to their included permissions that match the
+       * permission query (i.e., a query containing `policy.role.permissions:`).
+       * Example: if query `policy.role.permissions : "compute.disk.get"`
+       * matches a policy binding that contains owner role, the
+       * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+       * roles can also be found in the returned `policy` bindings. Note that the
+       * map is populated only for requests with permission queries.
+       * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + getMatchedPermissionsMap() { + return internalGetMatchedPermissions().getMap(); + } + /** + * + * + *
+       * The map from roles to their included permissions that match the
+       * permission query (i.e., a query containing `policy.role.permissions:`).
+       * Example: if query `policy.role.permissions : "compute.disk.get"`
+       * matches a policy binding that contains owner role, the
+       * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+       * roles can also be found in the returned `policy` bindings. Note that the
+       * map is populated only for requests with permission queries.
+       * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + getMatchedPermissionsOrDefault( + java.lang.String key, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + map = internalGetMatchedPermissions().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+       * The map from roles to their included permissions that match the
+       * permission query (i.e., a query containing `policy.role.permissions:`).
+       * Example: if query `policy.role.permissions : "compute.disk.get"`
+       * matches a policy binding that contains owner role, the
+       * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+       * roles can also be found in the returned `policy` bindings. Note that the
+       * map is populated only for requests with permission queries.
+       * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + getMatchedPermissionsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + map = internalGetMatchedPermissions().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearMatchedPermissions() { + internalGetMutableMatchedPermissions().getMutableMap().clear(); + return this; + } + /** + * + * + *
+       * The map from roles to their included permissions that match the
+       * permission query (i.e., a query containing `policy.role.permissions:`).
+       * Example: if query `policy.role.permissions : "compute.disk.get"`
+       * matches a policy binding that contains owner role, the
+       * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+       * roles can also be found in the returned `policy` bindings. Note that the
+       * map is populated only for requests with permission queries.
+       * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public Builder removeMatchedPermissions(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableMatchedPermissions().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + getMutableMatchedPermissions() { + return internalGetMutableMatchedPermissions().getMutableMap(); + } + /** + * + * + *
+       * The map from roles to their included permissions that match the
+       * permission query (i.e., a query containing `policy.role.permissions:`).
+       * Example: if query `policy.role.permissions : "compute.disk.get"`
+       * matches a policy binding that contains owner role, the
+       * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+       * roles can also be found in the returned `policy` bindings. Note that the
+       * map is populated only for requests with permission queries.
+       * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public Builder putMatchedPermissions( + java.lang.String key, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableMatchedPermissions().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+       * The map from roles to their included permissions that match the
+       * permission query (i.e., a query containing `policy.role.permissions:`).
+       * Example: if query `policy.role.permissions : "compute.disk.get"`
+       * matches a policy binding that contains owner role, the
+       * matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+       * roles can also be found in the returned `policy` bindings. Note that the
+       * map is populated only for requests with permission queries.
+       * 
+ * + * + * map<string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> matched_permissions = 1; + * + */ + public Builder putAllMatchedPermissions( + java.util.Map< + java.lang.String, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions> + values) { + internalGetMutableMatchedPermissions().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.asset.v1.IamPolicySearchResult.Explanation) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.IamPolicySearchResult.Explanation) + private static final com.google.cloud.asset.v1.IamPolicySearchResult.Explanation + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1.IamPolicySearchResult.Explanation(); + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Explanation parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Explanation(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.v1.IamPolicySearchResult.Explanation getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int RESOURCE_FIELD_NUMBER = 1; + private volatile java.lang.Object resource_; + /** + * + * + *
+   * The full resource name of the resource associated with this IAM policy.
+   * Example:
+   * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+   * See [Cloud Asset Inventory Resource Name
+   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+   * for more information.
+   * To search against the `resource`:
+   * * use a field query. Example: `resource : "organizations/123"`
+   * 
+ * + * 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 of the resource associated with this IAM policy.
+   * Example:
+   * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+   * See [Cloud Asset Inventory Resource Name
+   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+   * for more information.
+   * To search against the `resource`:
+   * * use a field query. Example: `resource : "organizations/123"`
+   * 
+ * + * 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 = 2; + 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.
+   * To search against the `project`:
+   * * specify the `scope` field as this project in your search request.
+   * 
+ * + * string project = 2; + * + * @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.
+   * To search against the `project`:
+   * * specify the `scope` field as this project in your search request.
+   * 
+ * + * string project = 2; + * + * @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 = 3; + private com.google.iam.v1.Policy policy_; + /** + * + * + *
+   * The IAM policy directly set on the given resource. Note that the original
+   * IAM policy can contain multiple bindings. This only contains the bindings
+   * that match the given query. For queries that don't contain a constrain on
+   * policies (e.g., an empty query), this contains all the bindings.
+   * To search against the `policy` bindings:
+   * * use a field query, as following:
+   *     - query by the policy contained members. Example:
+   *       `policy : "amy@gmail.com"`
+   *     - query by the policy contained roles. Example:
+   *       `policy : "roles/compute.admin"`
+   *     - query by the policy contained roles' implied permissions. Example:
+   *       `policy.role.permissions : "compute.instances.create"`
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return Whether the policy field is set. + */ + public boolean hasPolicy() { + return policy_ != null; + } + /** + * + * + *
+   * The IAM policy directly set on the given resource. Note that the original
+   * IAM policy can contain multiple bindings. This only contains the bindings
+   * that match the given query. For queries that don't contain a constrain on
+   * policies (e.g., an empty query), this contains all the bindings.
+   * To search against the `policy` bindings:
+   * * use a field query, as following:
+   *     - query by the policy contained members. Example:
+   *       `policy : "amy@gmail.com"`
+   *     - query by the policy contained roles. Example:
+   *       `policy : "roles/compute.admin"`
+   *     - query by the policy contained roles' implied permissions. Example:
+   *       `policy.role.permissions : "compute.instances.create"`
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return The policy. + */ + public com.google.iam.v1.Policy getPolicy() { + return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_; + } + /** + * + * + *
+   * The IAM policy directly set on the given resource. Note that the original
+   * IAM policy can contain multiple bindings. This only contains the bindings
+   * that match the given query. For queries that don't contain a constrain on
+   * policies (e.g., an empty query), this contains all the bindings.
+   * To search against the `policy` bindings:
+   * * use a field query, as following:
+   *     - query by the policy contained members. Example:
+   *       `policy : "amy@gmail.com"`
+   *     - query by the policy contained roles. Example:
+   *       `policy : "roles/compute.admin"`
+   *     - query by the policy contained roles' implied permissions. Example:
+   *       `policy.role.permissions : "compute.instances.create"`
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder() { + return getPolicy(); + } + + public static final int EXPLANATION_FIELD_NUMBER = 4; + private com.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation_; + /** + * + * + *
+   * Explanation about the IAM policy search result. It contains additional
+   * information to explain why the search result matches the query.
+   * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + * + * @return Whether the explanation field is set. + */ + public boolean hasExplanation() { + return explanation_ != null; + } + /** + * + * + *
+   * Explanation about the IAM policy search result. It contains additional
+   * information to explain why the search result matches the query.
+   * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + * + * @return The explanation. + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation getExplanation() { + return explanation_ == null + ? com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance() + : explanation_; + } + /** + * + * + *
+   * Explanation about the IAM policy search result. It contains additional
+   * information to explain why the search result matches the query.
+   * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder + getExplanationOrBuilder() { + return getExplanation(); + } + + 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, 2, project_); + } + if (policy_ != null) { + output.writeMessage(3, getPolicy()); + } + if (explanation_ != null) { + output.writeMessage(4, getExplanation()); + } + 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(2, project_); + } + if (policy_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getPolicy()); + } + if (explanation_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getExplanation()); + } + 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.v1.IamPolicySearchResult)) { + return super.equals(obj); + } + com.google.cloud.asset.v1.IamPolicySearchResult other = + (com.google.cloud.asset.v1.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 (hasExplanation() != other.hasExplanation()) return false; + if (hasExplanation()) { + if (!getExplanation().equals(other.getExplanation())) 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(); + } + if (hasExplanation()) { + hash = (37 * hash) + EXPLANATION_FIELD_NUMBER; + hash = (53 * hash) + getExplanation().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1.IamPolicySearchResult parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.IamPolicySearchResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.IamPolicySearchResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.IamPolicySearchResult parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.IamPolicySearchResult parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.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.v1.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.v1.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; + } + /** + * + * + *
+   * A result of IAM Policy search, containing information of an IAM policy.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.IamPolicySearchResult) + com.google.cloud.asset.v1.IamPolicySearchResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.IamPolicySearchResult.class, + com.google.cloud.asset.v1.IamPolicySearchResult.Builder.class); + } + + // Construct using com.google.cloud.asset.v1.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; + } + if (explanationBuilder_ == null) { + explanation_ = null; + } else { + explanation_ = null; + explanationBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_IamPolicySearchResult_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1.IamPolicySearchResult getDefaultInstanceForType() { + return com.google.cloud.asset.v1.IamPolicySearchResult.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1.IamPolicySearchResult build() { + com.google.cloud.asset.v1.IamPolicySearchResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1.IamPolicySearchResult buildPartial() { + com.google.cloud.asset.v1.IamPolicySearchResult result = + new com.google.cloud.asset.v1.IamPolicySearchResult(this); + result.resource_ = resource_; + result.project_ = project_; + if (policyBuilder_ == null) { + result.policy_ = policy_; + } else { + result.policy_ = policyBuilder_.build(); + } + if (explanationBuilder_ == null) { + result.explanation_ = explanation_; + } else { + result.explanation_ = explanationBuilder_.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.v1.IamPolicySearchResult) { + return mergeFrom((com.google.cloud.asset.v1.IamPolicySearchResult) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1.IamPolicySearchResult other) { + if (other == com.google.cloud.asset.v1.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()); + } + if (other.hasExplanation()) { + mergeExplanation(other.getExplanation()); + } + 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.v1.IamPolicySearchResult parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.asset.v1.IamPolicySearchResult) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object resource_ = ""; + /** + * + * + *
+     * The full resource name of the resource associated with this IAM policy.
+     * Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `resource`:
+     * * use a field query. Example: `resource : "organizations/123"`
+     * 
+ * + * 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 of the resource associated with this IAM policy.
+     * Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `resource`:
+     * * use a field query. Example: `resource : "organizations/123"`
+     * 
+ * + * 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 of the resource associated with this IAM policy.
+     * Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `resource`:
+     * * use a field query. Example: `resource : "organizations/123"`
+     * 
+ * + * 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 of the resource associated with this IAM policy.
+     * Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `resource`:
+     * * use a field query. Example: `resource : "organizations/123"`
+     * 
+ * + * string resource = 1; + * + * @return This builder for chaining. + */ + public Builder clearResource() { + + resource_ = getDefaultInstance().getResource(); + onChanged(); + return this; + } + /** + * + * + *
+     * The full resource name of the resource associated with this IAM policy.
+     * Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `resource`:
+     * * use a field query. Example: `resource : "organizations/123"`
+     * 
+ * + * 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.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * string project = 2; + * + * @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.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * string project = 2; + * + * @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.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * string project = 2; + * + * @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.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * string project = 2; + * + * @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.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * string project = 2; + * + * @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_; + /** + * + * + *
+     * The IAM policy directly set on the given resource. Note that the original
+     * IAM policy can contain multiple bindings. This only contains the bindings
+     * that match the given query. For queries that don't contain a constrain on
+     * policies (e.g., an empty query), this contains all the bindings.
+     * To search against the `policy` bindings:
+     * * use a field query, as following:
+     *     - query by the policy contained members. Example:
+     *       `policy : "amy@gmail.com"`
+     *     - query by the policy contained roles. Example:
+     *       `policy : "roles/compute.admin"`
+     *     - query by the policy contained roles' implied permissions. Example:
+     *       `policy.role.permissions : "compute.instances.create"`
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return Whether the policy field is set. + */ + public boolean hasPolicy() { + return policyBuilder_ != null || policy_ != null; + } + /** + * + * + *
+     * The IAM policy directly set on the given resource. Note that the original
+     * IAM policy can contain multiple bindings. This only contains the bindings
+     * that match the given query. For queries that don't contain a constrain on
+     * policies (e.g., an empty query), this contains all the bindings.
+     * To search against the `policy` bindings:
+     * * use a field query, as following:
+     *     - query by the policy contained members. Example:
+     *       `policy : "amy@gmail.com"`
+     *     - query by the policy contained roles. Example:
+     *       `policy : "roles/compute.admin"`
+     *     - query by the policy contained roles' implied permissions. Example:
+     *       `policy.role.permissions : "compute.instances.create"`
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @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(); + } + } + /** + * + * + *
+     * The IAM policy directly set on the given resource. Note that the original
+     * IAM policy can contain multiple bindings. This only contains the bindings
+     * that match the given query. For queries that don't contain a constrain on
+     * policies (e.g., an empty query), this contains all the bindings.
+     * To search against the `policy` bindings:
+     * * use a field query, as following:
+     *     - query by the policy contained members. Example:
+     *       `policy : "amy@gmail.com"`
+     *     - query by the policy contained roles. Example:
+     *       `policy : "roles/compute.admin"`
+     *     - query by the policy contained roles' implied permissions. Example:
+     *       `policy.role.permissions : "compute.instances.create"`
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + 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; + } + /** + * + * + *
+     * The IAM policy directly set on the given resource. Note that the original
+     * IAM policy can contain multiple bindings. This only contains the bindings
+     * that match the given query. For queries that don't contain a constrain on
+     * policies (e.g., an empty query), this contains all the bindings.
+     * To search against the `policy` bindings:
+     * * use a field query, as following:
+     *     - query by the policy contained members. Example:
+     *       `policy : "amy@gmail.com"`
+     *     - query by the policy contained roles. Example:
+     *       `policy : "roles/compute.admin"`
+     *     - query by the policy contained roles' implied permissions. Example:
+     *       `policy.role.permissions : "compute.instances.create"`
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public Builder setPolicy(com.google.iam.v1.Policy.Builder builderForValue) { + if (policyBuilder_ == null) { + policy_ = builderForValue.build(); + onChanged(); + } else { + policyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The IAM policy directly set on the given resource. Note that the original
+     * IAM policy can contain multiple bindings. This only contains the bindings
+     * that match the given query. For queries that don't contain a constrain on
+     * policies (e.g., an empty query), this contains all the bindings.
+     * To search against the `policy` bindings:
+     * * use a field query, as following:
+     *     - query by the policy contained members. Example:
+     *       `policy : "amy@gmail.com"`
+     *     - query by the policy contained roles. Example:
+     *       `policy : "roles/compute.admin"`
+     *     - query by the policy contained roles' implied permissions. Example:
+     *       `policy.role.permissions : "compute.instances.create"`
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + 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; + } + /** + * + * + *
+     * The IAM policy directly set on the given resource. Note that the original
+     * IAM policy can contain multiple bindings. This only contains the bindings
+     * that match the given query. For queries that don't contain a constrain on
+     * policies (e.g., an empty query), this contains all the bindings.
+     * To search against the `policy` bindings:
+     * * use a field query, as following:
+     *     - query by the policy contained members. Example:
+     *       `policy : "amy@gmail.com"`
+     *     - query by the policy contained roles. Example:
+     *       `policy : "roles/compute.admin"`
+     *     - query by the policy contained roles' implied permissions. Example:
+     *       `policy.role.permissions : "compute.instances.create"`
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public Builder clearPolicy() { + if (policyBuilder_ == null) { + policy_ = null; + onChanged(); + } else { + policy_ = null; + policyBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The IAM policy directly set on the given resource. Note that the original
+     * IAM policy can contain multiple bindings. This only contains the bindings
+     * that match the given query. For queries that don't contain a constrain on
+     * policies (e.g., an empty query), this contains all the bindings.
+     * To search against the `policy` bindings:
+     * * use a field query, as following:
+     *     - query by the policy contained members. Example:
+     *       `policy : "amy@gmail.com"`
+     *     - query by the policy contained roles. Example:
+     *       `policy : "roles/compute.admin"`
+     *     - query by the policy contained roles' implied permissions. Example:
+     *       `policy.role.permissions : "compute.instances.create"`
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public com.google.iam.v1.Policy.Builder getPolicyBuilder() { + + onChanged(); + return getPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The IAM policy directly set on the given resource. Note that the original
+     * IAM policy can contain multiple bindings. This only contains the bindings
+     * that match the given query. For queries that don't contain a constrain on
+     * policies (e.g., an empty query), this contains all the bindings.
+     * To search against the `policy` bindings:
+     * * use a field query, as following:
+     *     - query by the policy contained members. Example:
+     *       `policy : "amy@gmail.com"`
+     *     - query by the policy contained roles. Example:
+     *       `policy : "roles/compute.admin"`
+     *     - query by the policy contained roles' implied permissions. Example:
+     *       `policy.role.permissions : "compute.instances.create"`
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder() { + if (policyBuilder_ != null) { + return policyBuilder_.getMessageOrBuilder(); + } else { + return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_; + } + } + /** + * + * + *
+     * The IAM policy directly set on the given resource. Note that the original
+     * IAM policy can contain multiple bindings. This only contains the bindings
+     * that match the given query. For queries that don't contain a constrain on
+     * policies (e.g., an empty query), this contains all the bindings.
+     * To search against the `policy` bindings:
+     * * use a field query, as following:
+     *     - query by the policy contained members. Example:
+     *       `policy : "amy@gmail.com"`
+     *     - query by the policy contained roles. Example:
+     *       `policy : "roles/compute.admin"`
+     *     - query by the policy contained roles' implied permissions. Example:
+     *       `policy.role.permissions : "compute.instances.create"`
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + 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_; + } + + private com.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder, + com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder> + explanationBuilder_; + /** + * + * + *
+     * Explanation about the IAM policy search result. It contains additional
+     * information to explain why the search result matches the query.
+     * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + * + * @return Whether the explanation field is set. + */ + public boolean hasExplanation() { + return explanationBuilder_ != null || explanation_ != null; + } + /** + * + * + *
+     * Explanation about the IAM policy search result. It contains additional
+     * information to explain why the search result matches the query.
+     * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + * + * @return The explanation. + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation getExplanation() { + if (explanationBuilder_ == null) { + return explanation_ == null + ? com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance() + : explanation_; + } else { + return explanationBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Explanation about the IAM policy search result. It contains additional
+     * information to explain why the search result matches the query.
+     * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + */ + public Builder setExplanation( + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation value) { + if (explanationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + explanation_ = value; + onChanged(); + } else { + explanationBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Explanation about the IAM policy search result. It contains additional
+     * information to explain why the search result matches the query.
+     * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + */ + public Builder setExplanation( + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder builderForValue) { + if (explanationBuilder_ == null) { + explanation_ = builderForValue.build(); + onChanged(); + } else { + explanationBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Explanation about the IAM policy search result. It contains additional
+     * information to explain why the search result matches the query.
+     * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + */ + public Builder mergeExplanation( + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation value) { + if (explanationBuilder_ == null) { + if (explanation_ != null) { + explanation_ = + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.newBuilder(explanation_) + .mergeFrom(value) + .buildPartial(); + } else { + explanation_ = value; + } + onChanged(); + } else { + explanationBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Explanation about the IAM policy search result. It contains additional
+     * information to explain why the search result matches the query.
+     * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + */ + public Builder clearExplanation() { + if (explanationBuilder_ == null) { + explanation_ = null; + onChanged(); + } else { + explanation_ = null; + explanationBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Explanation about the IAM policy search result. It contains additional
+     * information to explain why the search result matches the query.
+     * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder + getExplanationBuilder() { + + onChanged(); + return getExplanationFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Explanation about the IAM policy search result. It contains additional
+     * information to explain why the search result matches the query.
+     * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder + getExplanationOrBuilder() { + if (explanationBuilder_ != null) { + return explanationBuilder_.getMessageOrBuilder(); + } else { + return explanation_ == null + ? com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance() + : explanation_; + } + } + /** + * + * + *
+     * Explanation about the IAM policy search result. It contains additional
+     * information to explain why the search result matches the query.
+     * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder, + com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder> + getExplanationFieldBuilder() { + if (explanationBuilder_ == null) { + explanationBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation, + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder, + com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder>( + getExplanation(), getParentForChildren(), isClean()); + explanation_ = null; + } + return explanationBuilder_; + } + + @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.v1.IamPolicySearchResult) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.IamPolicySearchResult) + private static final com.google.cloud.asset.v1.IamPolicySearchResult DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1.IamPolicySearchResult(); + } + + public static com.google.cloud.asset.v1.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.v1.IamPolicySearchResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/IamPolicySearchResultOrBuilder.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/IamPolicySearchResultOrBuilder.java new file mode 100644 index 000000000..e0eac262b --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/IamPolicySearchResultOrBuilder.java @@ -0,0 +1,207 @@ +/* + * 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/v1/assets.proto + +package com.google.cloud.asset.v1; + +public interface IamPolicySearchResultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.IamPolicySearchResult) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The full resource name of the resource associated with this IAM policy.
+   * Example:
+   * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+   * See [Cloud Asset Inventory Resource Name
+   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+   * for more information.
+   * To search against the `resource`:
+   * * use a field query. Example: `resource : "organizations/123"`
+   * 
+ * + * string resource = 1; + * + * @return The resource. + */ + java.lang.String getResource(); + /** + * + * + *
+   * The full resource name of the resource associated with this IAM policy.
+   * Example:
+   * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+   * See [Cloud Asset Inventory Resource Name
+   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+   * for more information.
+   * To search against the `resource`:
+   * * use a field query. Example: `resource : "organizations/123"`
+   * 
+ * + * 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.
+   * To search against the `project`:
+   * * specify the `scope` field as this project in your search request.
+   * 
+ * + * string project = 2; + * + * @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.
+   * To search against the `project`:
+   * * specify the `scope` field as this project in your search request.
+   * 
+ * + * string project = 2; + * + * @return The bytes for project. + */ + com.google.protobuf.ByteString getProjectBytes(); + + /** + * + * + *
+   * The IAM policy directly set on the given resource. Note that the original
+   * IAM policy can contain multiple bindings. This only contains the bindings
+   * that match the given query. For queries that don't contain a constrain on
+   * policies (e.g., an empty query), this contains all the bindings.
+   * To search against the `policy` bindings:
+   * * use a field query, as following:
+   *     - query by the policy contained members. Example:
+   *       `policy : "amy@gmail.com"`
+   *     - query by the policy contained roles. Example:
+   *       `policy : "roles/compute.admin"`
+   *     - query by the policy contained roles' implied permissions. Example:
+   *       `policy.role.permissions : "compute.instances.create"`
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return Whether the policy field is set. + */ + boolean hasPolicy(); + /** + * + * + *
+   * The IAM policy directly set on the given resource. Note that the original
+   * IAM policy can contain multiple bindings. This only contains the bindings
+   * that match the given query. For queries that don't contain a constrain on
+   * policies (e.g., an empty query), this contains all the bindings.
+   * To search against the `policy` bindings:
+   * * use a field query, as following:
+   *     - query by the policy contained members. Example:
+   *       `policy : "amy@gmail.com"`
+   *     - query by the policy contained roles. Example:
+   *       `policy : "roles/compute.admin"`
+   *     - query by the policy contained roles' implied permissions. Example:
+   *       `policy.role.permissions : "compute.instances.create"`
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return The policy. + */ + com.google.iam.v1.Policy getPolicy(); + /** + * + * + *
+   * The IAM policy directly set on the given resource. Note that the original
+   * IAM policy can contain multiple bindings. This only contains the bindings
+   * that match the given query. For queries that don't contain a constrain on
+   * policies (e.g., an empty query), this contains all the bindings.
+   * To search against the `policy` bindings:
+   * * use a field query, as following:
+   *     - query by the policy contained members. Example:
+   *       `policy : "amy@gmail.com"`
+   *     - query by the policy contained roles. Example:
+   *       `policy : "roles/compute.admin"`
+   *     - query by the policy contained roles' implied permissions. Example:
+   *       `policy.role.permissions : "compute.instances.create"`
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder(); + + /** + * + * + *
+   * Explanation about the IAM policy search result. It contains additional
+   * information to explain why the search result matches the query.
+   * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + * + * @return Whether the explanation field is set. + */ + boolean hasExplanation(); + /** + * + * + *
+   * Explanation about the IAM policy search result. It contains additional
+   * information to explain why the search result matches the query.
+   * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + * + * @return The explanation. + */ + com.google.cloud.asset.v1.IamPolicySearchResult.Explanation getExplanation(); + /** + * + * + *
+   * Explanation about the IAM policy search result. It contains additional
+   * information to explain why the search result matches the query.
+   * 
+ * + * .google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4; + */ + com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder getExplanationOrBuilder(); +} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/Resource.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/Resource.java index 9474231b7..19bc80109 100644 --- a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/Resource.java +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/Resource.java @@ -43,6 +43,7 @@ private Resource() { discoveryName_ = ""; resourceUrl_ = ""; parent_ = ""; + location_ = ""; } @java.lang.Override @@ -121,6 +122,13 @@ private Resource( data_ = subBuilder.buildPartial(); } + break; + } + case 66: + { + java.lang.String s = input.readStringRequireUtf8(); + + location_ = s; break; } default: @@ -476,6 +484,55 @@ public com.google.protobuf.StructOrBuilder getDataOrBuilder() { return getData(); } + public static final int LOCATION_FIELD_NUMBER = 8; + private volatile java.lang.Object location_; + /** + * + * + *
+   * The location of the resource in Google Cloud, such as its zone and region.
+   * For more information, see https://cloud.google.com/about/locations/.
+   * 
+ * + * string location = 8; + * + * @return The location. + */ + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } + } + /** + * + * + *
+   * The location of the resource in Google Cloud, such as its zone and region.
+   * For more information, see https://cloud.google.com/about/locations/.
+   * 
+ * + * string location = 8; + * + * @return The bytes for location. + */ + public com.google.protobuf.ByteString getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -508,6 +565,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (data_ != null) { output.writeMessage(6, getData()); } + if (!getLocationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, location_); + } unknownFields.writeTo(output); } @@ -535,6 +595,9 @@ public int getSerializedSize() { if (data_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getData()); } + if (!getLocationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, location_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -559,6 +622,7 @@ public boolean equals(final java.lang.Object obj) { if (hasData()) { if (!getData().equals(other.getData())) return false; } + if (!getLocation().equals(other.getLocation())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -584,6 +648,8 @@ public int hashCode() { hash = (37 * hash) + DATA_FIELD_NUMBER; hash = (53 * hash) + getData().hashCode(); } + hash = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -744,6 +810,8 @@ public Builder clear() { data_ = null; dataBuilder_ = null; } + location_ = ""; + return this; } @@ -780,6 +848,7 @@ public com.google.cloud.asset.v1.Resource buildPartial() { } else { result.data_ = dataBuilder_.build(); } + result.location_ = location_; onBuilt(); return result; } @@ -852,6 +921,10 @@ public Builder mergeFrom(com.google.cloud.asset.v1.Resource other) { if (other.hasData()) { mergeData(other.getData()); } + if (!other.getLocation().isEmpty()) { + location_ = other.location_; + onChanged(); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -1692,6 +1765,117 @@ public com.google.protobuf.StructOrBuilder getDataOrBuilder() { return dataBuilder_; } + private java.lang.Object location_ = ""; + /** + * + * + *
+     * The location of the resource in Google Cloud, such as its zone and region.
+     * For more information, see https://cloud.google.com/about/locations/.
+     * 
+ * + * string location = 8; + * + * @return The location. + */ + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The location of the resource in Google Cloud, such as its zone and region.
+     * For more information, see https://cloud.google.com/about/locations/.
+     * 
+ * + * string location = 8; + * + * @return The bytes for location. + */ + public com.google.protobuf.ByteString getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The location of the resource in Google Cloud, such as its zone and region.
+     * For more information, see https://cloud.google.com/about/locations/.
+     * 
+ * + * string location = 8; + * + * @param value The location to set. + * @return This builder for chaining. + */ + public Builder setLocation(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + location_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The location of the resource in Google Cloud, such as its zone and region.
+     * For more information, see https://cloud.google.com/about/locations/.
+     * 
+ * + * string location = 8; + * + * @return This builder for chaining. + */ + public Builder clearLocation() { + + location_ = getDefaultInstance().getLocation(); + onChanged(); + return this; + } + /** + * + * + *
+     * The location of the resource in Google Cloud, such as its zone and region.
+     * For more information, see https://cloud.google.com/about/locations/.
+     * 
+ * + * string location = 8; + * + * @param value The bytes for location to set. + * @return This builder for chaining. + */ + public Builder setLocationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + location_ = value; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceOrBuilder.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceOrBuilder.java index 41da2857f..fc5e7f65b 100644 --- a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceOrBuilder.java +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceOrBuilder.java @@ -223,4 +223,31 @@ public interface ResourceOrBuilder * .google.protobuf.Struct data = 6; */ com.google.protobuf.StructOrBuilder getDataOrBuilder(); + + /** + * + * + *
+   * The location of the resource in Google Cloud, such as its zone and region.
+   * For more information, see https://cloud.google.com/about/locations/.
+   * 
+ * + * string location = 8; + * + * @return The location. + */ + java.lang.String getLocation(); + /** + * + * + *
+   * The location of the resource in Google Cloud, such as its zone and region.
+   * For more information, see https://cloud.google.com/about/locations/.
+   * 
+ * + * string location = 8; + * + * @return The bytes for location. + */ + com.google.protobuf.ByteString getLocationBytes(); } diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceSearchResult.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceSearchResult.java new file mode 100644 index 000000000..48c0eaaea --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceSearchResult.java @@ -0,0 +1,2780 @@ +/* + * 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/v1/assets.proto + +package com.google.cloud.asset.v1; + +/** + * + * + *
+ * A result of Resource Search, containing information of a cloud resoure.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1.ResourceSearchResult} + */ +public final class ResourceSearchResult extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.ResourceSearchResult) + ResourceSearchResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use ResourceSearchResult.newBuilder() to construct. + private ResourceSearchResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ResourceSearchResult() { + name_ = ""; + assetType_ = ""; + project_ = ""; + displayName_ = ""; + description_ = ""; + location_ = ""; + networkTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ResourceSearchResult(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ResourceSearchResult( + 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(); + + 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; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + location_ = s; + break; + } + case 58: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + labels_ = + com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); + break; + } + case 66: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + networkTags_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + networkTags_.add(s); + break; + } + case 74: + { + com.google.protobuf.Struct.Builder subBuilder = null; + if (additionalAttributes_ != null) { + subBuilder = additionalAttributes_.toBuilder(); + } + additionalAttributes_ = + input.readMessage(com.google.protobuf.Struct.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(additionalAttributes_); + additionalAttributes_ = 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 { + if (((mutable_bitField0_ & 0x00000002) != 0)) { + networkTags_ = networkTags_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_ResourceSearchResult_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 7: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_ResourceSearchResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.ResourceSearchResult.class, + com.google.cloud.asset.v1.ResourceSearchResult.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The full resource name of this resource. Example:
+   * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+   * See [Cloud Asset Inventory Resource Name
+   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+   * for more information.
+   * To search against the `name`:
+   * * use a field query. Example: `name : "instance1"`
+   * * use a free text query. Example: `"instance1"`
+   * 
+ * + * 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 of this resource. Example:
+   * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+   * See [Cloud Asset Inventory Resource Name
+   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+   * for more information.
+   * To search against the `name`:
+   * * use a field query. Example: `name : "instance1"`
+   * * use a free text query. Example: `"instance1"`
+   * 
+ * + * 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. Example: "compute.googleapis.com/Disk".
+   * To search against the `asset_type`:
+   * * specify the `asset_type` field in your search request.
+   * 
+ * + * 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. Example: "compute.googleapis.com/Disk".
+   * To search against the `asset_type`:
+   * * specify the `asset_type` field in your search request.
+   * 
+ * + * 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}.
+   * To search against the `project`:
+   * * specify the `scope` field as this project in your search request.
+   * 
+ * + * 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}.
+   * To search against the `project`:
+   * * specify the `scope` field as this project in your search request.
+   * 
+ * + * 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.
+   * To search against the `display_name`:
+   * * use a field query. Example: `displayName : "My Instance"`
+   * * use a free text query. Example: `"My Instance"`
+   * 
+ * + * 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.
+   * To search against the `display_name`:
+   * * use a field query. Example: `displayName : "My Instance"`
+   * * use a free text query. Example: `"My Instance"`
+   * 
+ * + * 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.
+   * To search against the `description`:
+   * * use a field query. Example: `description : "*important instance*"`
+   * * use a free text query. Example: `"*important instance*"`
+   * 
+ * + * 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.
+   * To search against the `description`:
+   * * use a field query. Example: `description : "*important instance*"`
+   * * use a free text query. Example: `"*important instance*"`
+   * 
+ * + * 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; + } + } + + public static final int LOCATION_FIELD_NUMBER = 6; + private volatile java.lang.Object location_; + /** + * + * + *
+   * Location can be "global", regional like "us-east1", or zonal like
+   * "us-west1-b".
+   * To search against the `location`:
+   * * use a field query. Example: `location : "us-west*"`
+   * * use a free text query. Example: `"us-west*"`
+   * 
+ * + * string location = 6; + * + * @return The location. + */ + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } + } + /** + * + * + *
+   * Location can be "global", regional like "us-east1", or zonal like
+   * "us-west1-b".
+   * To search against the `location`:
+   * * use a field query. Example: `location : "us-west*"`
+   * * use a free text query. Example: `"us-west*"`
+   * 
+ * + * string location = 6; + * + * @return The bytes for location. + */ + public com.google.protobuf.ByteString getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LABELS_FIELD_NUMBER = 7; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_ResourceSearchResult_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * Labels associated with this resource. See [Labelling and grouping GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `labels`:
+   * * use a field query, as following:
+   *     - query on any label's key or value. Example: `labels : "prod"`
+   *     - query by a given label. Example: `labels.env : "prod"`
+   *     - query by a given label'sexistence. Example: `labels.env : *`
+   * * use a free text query. Example: `"prod"`
+   * 
+ * + * map<string, string> labels = 7; + */ + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * Labels associated with this resource. See [Labelling and grouping GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `labels`:
+   * * use a field query, as following:
+   *     - query on any label's key or value. Example: `labels : "prod"`
+   *     - query by a given label. Example: `labels.env : "prod"`
+   *     - query by a given label'sexistence. Example: `labels.env : *`
+   * * use a free text query. Example: `"prod"`
+   * 
+ * + * map<string, string> labels = 7; + */ + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * Labels associated with this resource. See [Labelling and grouping GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `labels`:
+   * * use a field query, as following:
+   *     - query on any label's key or value. Example: `labels : "prod"`
+   *     - query by a given label. Example: `labels.env : "prod"`
+   *     - query by a given label'sexistence. Example: `labels.env : *`
+   * * use a free text query. Example: `"prod"`
+   * 
+ * + * map<string, string> labels = 7; + */ + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Labels associated with this resource. See [Labelling and grouping GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `labels`:
+   * * use a field query, as following:
+   *     - query on any label's key or value. Example: `labels : "prod"`
+   *     - query by a given label. Example: `labels.env : "prod"`
+   *     - query by a given label'sexistence. Example: `labels.env : *`
+   * * use a free text query. Example: `"prod"`
+   * 
+ * + * map<string, string> labels = 7; + */ + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int NETWORK_TAGS_FIELD_NUMBER = 8; + private com.google.protobuf.LazyStringList networkTags_; + /** + * + * + *
+   * Network tags associated with this resource. Like labels, network tags are a
+   * type of annotations used to group GCP resources. See [Labelling GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `network_tags`:
+   * * use a field query. Example: `networkTags : "internal"`
+   * * use a free text query. Example: `"internal"`
+   * 
+ * + * repeated string network_tags = 8; + * + * @return A list containing the networkTags. + */ + public com.google.protobuf.ProtocolStringList getNetworkTagsList() { + return networkTags_; + } + /** + * + * + *
+   * Network tags associated with this resource. Like labels, network tags are a
+   * type of annotations used to group GCP resources. See [Labelling GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `network_tags`:
+   * * use a field query. Example: `networkTags : "internal"`
+   * * use a free text query. Example: `"internal"`
+   * 
+ * + * repeated string network_tags = 8; + * + * @return The count of networkTags. + */ + public int getNetworkTagsCount() { + return networkTags_.size(); + } + /** + * + * + *
+   * Network tags associated with this resource. Like labels, network tags are a
+   * type of annotations used to group GCP resources. See [Labelling GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `network_tags`:
+   * * use a field query. Example: `networkTags : "internal"`
+   * * use a free text query. Example: `"internal"`
+   * 
+ * + * repeated string network_tags = 8; + * + * @param index The index of the element to return. + * @return The networkTags at the given index. + */ + public java.lang.String getNetworkTags(int index) { + return networkTags_.get(index); + } + /** + * + * + *
+   * Network tags associated with this resource. Like labels, network tags are a
+   * type of annotations used to group GCP resources. See [Labelling GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `network_tags`:
+   * * use a field query. Example: `networkTags : "internal"`
+   * * use a free text query. Example: `"internal"`
+   * 
+ * + * repeated string network_tags = 8; + * + * @param index The index of the value to return. + * @return The bytes of the networkTags at the given index. + */ + public com.google.protobuf.ByteString getNetworkTagsBytes(int index) { + return networkTags_.getByteString(index); + } + + public static final int ADDITIONAL_ATTRIBUTES_FIELD_NUMBER = 9; + private com.google.protobuf.Struct additionalAttributes_; + /** + * + * + *
+   * The additional attributes of this resource. The attributes may vary from
+   * one resource type to another. Examples: "projectId" for Project,
+   * "dnsName" for DNS ManagedZone.
+   * To search against the `additional_attributes`:
+   * * use a free text query to match the attributes values. Example: to search
+   *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+   *   `"foobar"`.
+   * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + * + * @return Whether the additionalAttributes field is set. + */ + public boolean hasAdditionalAttributes() { + return additionalAttributes_ != null; + } + /** + * + * + *
+   * The additional attributes of this resource. The attributes may vary from
+   * one resource type to another. Examples: "projectId" for Project,
+   * "dnsName" for DNS ManagedZone.
+   * To search against the `additional_attributes`:
+   * * use a free text query to match the attributes values. Example: to search
+   *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+   *   `"foobar"`.
+   * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + * + * @return The additionalAttributes. + */ + public com.google.protobuf.Struct getAdditionalAttributes() { + return additionalAttributes_ == null + ? com.google.protobuf.Struct.getDefaultInstance() + : additionalAttributes_; + } + /** + * + * + *
+   * The additional attributes of this resource. The attributes may vary from
+   * one resource type to another. Examples: "projectId" for Project,
+   * "dnsName" for DNS ManagedZone.
+   * To search against the `additional_attributes`:
+   * * use a free text query to match the attributes values. Example: to search
+   *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+   *   `"foobar"`.
+   * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + */ + public com.google.protobuf.StructOrBuilder getAdditionalAttributesOrBuilder() { + return getAdditionalAttributes(); + } + + 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_); + } + if (!getLocationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, location_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 7); + for (int i = 0; i < networkTags_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, networkTags_.getRaw(i)); + } + if (additionalAttributes_ != null) { + output.writeMessage(9, getAdditionalAttributes()); + } + 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_); + } + if (!getLocationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, location_); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, labels__); + } + { + int dataSize = 0; + for (int i = 0; i < networkTags_.size(); i++) { + dataSize += computeStringSizeNoTag(networkTags_.getRaw(i)); + } + size += dataSize; + size += 1 * getNetworkTagsList().size(); + } + if (additionalAttributes_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(9, getAdditionalAttributes()); + } + 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.v1.ResourceSearchResult)) { + return super.equals(obj); + } + com.google.cloud.asset.v1.ResourceSearchResult other = + (com.google.cloud.asset.v1.ResourceSearchResult) 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 (!getLocation().equals(other.getLocation())) return false; + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!getNetworkTagsList().equals(other.getNetworkTagsList())) return false; + if (hasAdditionalAttributes() != other.hasAdditionalAttributes()) return false; + if (hasAdditionalAttributes()) { + if (!getAdditionalAttributes().equals(other.getAdditionalAttributes())) 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 = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + if (getNetworkTagsCount() > 0) { + hash = (37 * hash) + NETWORK_TAGS_FIELD_NUMBER; + hash = (53 * hash) + getNetworkTagsList().hashCode(); + } + if (hasAdditionalAttributes()) { + hash = (37 * hash) + ADDITIONAL_ATTRIBUTES_FIELD_NUMBER; + hash = (53 * hash) + getAdditionalAttributes().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1.ResourceSearchResult parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.ResourceSearchResult 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.v1.ResourceSearchResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.ResourceSearchResult 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.v1.ResourceSearchResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.ResourceSearchResult parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.asset.v1.ResourceSearchResult parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.ResourceSearchResult 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.v1.ResourceSearchResult parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.ResourceSearchResult 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.v1.ResourceSearchResult parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.ResourceSearchResult 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.v1.ResourceSearchResult 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; + } + /** + * + * + *
+   * A result of Resource Search, containing information of a cloud resoure.
+   * 
+ * + * Protobuf type {@code google.cloud.asset.v1.ResourceSearchResult} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.ResourceSearchResult) + com.google.cloud.asset.v1.ResourceSearchResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_ResourceSearchResult_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 7: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 7: + return internalGetMutableLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_ResourceSearchResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.ResourceSearchResult.class, + com.google.cloud.asset.v1.ResourceSearchResult.Builder.class); + } + + // Construct using com.google.cloud.asset.v1.ResourceSearchResult.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_ = ""; + + location_ = ""; + + internalGetMutableLabels().clear(); + networkTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + if (additionalAttributesBuilder_ == null) { + additionalAttributes_ = null; + } else { + additionalAttributes_ = null; + additionalAttributesBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1.AssetProto + .internal_static_google_cloud_asset_v1_ResourceSearchResult_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1.ResourceSearchResult getDefaultInstanceForType() { + return com.google.cloud.asset.v1.ResourceSearchResult.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1.ResourceSearchResult build() { + com.google.cloud.asset.v1.ResourceSearchResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1.ResourceSearchResult buildPartial() { + com.google.cloud.asset.v1.ResourceSearchResult result = + new com.google.cloud.asset.v1.ResourceSearchResult(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.assetType_ = assetType_; + result.project_ = project_; + result.displayName_ = displayName_; + result.description_ = description_; + result.location_ = location_; + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + if (((bitField0_ & 0x00000002) != 0)) { + networkTags_ = networkTags_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.networkTags_ = networkTags_; + if (additionalAttributesBuilder_ == null) { + result.additionalAttributes_ = additionalAttributes_; + } else { + result.additionalAttributes_ = additionalAttributesBuilder_.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.v1.ResourceSearchResult) { + return mergeFrom((com.google.cloud.asset.v1.ResourceSearchResult) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1.ResourceSearchResult other) { + if (other == com.google.cloud.asset.v1.ResourceSearchResult.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(); + } + if (!other.getLocation().isEmpty()) { + location_ = other.location_; + onChanged(); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + if (!other.networkTags_.isEmpty()) { + if (networkTags_.isEmpty()) { + networkTags_ = other.networkTags_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureNetworkTagsIsMutable(); + networkTags_.addAll(other.networkTags_); + } + onChanged(); + } + if (other.hasAdditionalAttributes()) { + mergeAdditionalAttributes(other.getAdditionalAttributes()); + } + 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.v1.ResourceSearchResult parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.asset.v1.ResourceSearchResult) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The full resource name of this resource. Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `name`:
+     * * use a field query. Example: `name : "instance1"`
+     * * use a free text query. Example: `"instance1"`
+     * 
+ * + * 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 of this resource. Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `name`:
+     * * use a field query. Example: `name : "instance1"`
+     * * use a free text query. Example: `"instance1"`
+     * 
+ * + * 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 of this resource. Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `name`:
+     * * use a field query. Example: `name : "instance1"`
+     * * use a free text query. Example: `"instance1"`
+     * 
+ * + * 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 of this resource. Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `name`:
+     * * use a field query. Example: `name : "instance1"`
+     * * use a free text query. Example: `"instance1"`
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The full resource name of this resource. Example:
+     * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+     * See [Cloud Asset Inventory Resource Name
+     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+     * for more information.
+     * To search against the `name`:
+     * * use a field query. Example: `name : "instance1"`
+     * * use a free text query. Example: `"instance1"`
+     * 
+ * + * 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. Example: "compute.googleapis.com/Disk".
+     * To search against the `asset_type`:
+     * * specify the `asset_type` field in your search request.
+     * 
+ * + * 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. Example: "compute.googleapis.com/Disk".
+     * To search against the `asset_type`:
+     * * specify the `asset_type` field in your search request.
+     * 
+ * + * 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. Example: "compute.googleapis.com/Disk".
+     * To search against the `asset_type`:
+     * * specify the `asset_type` field in your search request.
+     * 
+ * + * 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. Example: "compute.googleapis.com/Disk".
+     * To search against the `asset_type`:
+     * * specify the `asset_type` field in your search request.
+     * 
+ * + * string asset_type = 2; + * + * @return This builder for chaining. + */ + public Builder clearAssetType() { + + assetType_ = getDefaultInstance().getAssetType(); + onChanged(); + return this; + } + /** + * + * + *
+     * The type of this resource. Example: "compute.googleapis.com/Disk".
+     * To search against the `asset_type`:
+     * * specify the `asset_type` field in your search request.
+     * 
+ * + * 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}.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * 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}.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * 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}.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * 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}.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * 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}.
+     * To search against the `project`:
+     * * specify the `scope` field as this project in your search request.
+     * 
+ * + * 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.
+     * To search against the `display_name`:
+     * * use a field query. Example: `displayName : "My Instance"`
+     * * use a free text query. Example: `"My Instance"`
+     * 
+ * + * 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.
+     * To search against the `display_name`:
+     * * use a field query. Example: `displayName : "My Instance"`
+     * * use a free text query. Example: `"My Instance"`
+     * 
+ * + * 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.
+     * To search against the `display_name`:
+     * * use a field query. Example: `displayName : "My Instance"`
+     * * use a free text query. Example: `"My Instance"`
+     * 
+ * + * 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.
+     * To search against the `display_name`:
+     * * use a field query. Example: `displayName : "My Instance"`
+     * * use a free text query. Example: `"My Instance"`
+     * 
+ * + * string display_name = 4; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The display name of this resource.
+     * To search against the `display_name`:
+     * * use a field query. Example: `displayName : "My Instance"`
+     * * use a free text query. Example: `"My Instance"`
+     * 
+ * + * 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.
+     * To search against the `description`:
+     * * use a field query. Example: `description : "*important instance*"`
+     * * use a free text query. Example: `"*important instance*"`
+     * 
+ * + * 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.
+     * To search against the `description`:
+     * * use a field query. Example: `description : "*important instance*"`
+     * * use a free text query. Example: `"*important instance*"`
+     * 
+ * + * 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.
+     * To search against the `description`:
+     * * use a field query. Example: `description : "*important instance*"`
+     * * use a free text query. Example: `"*important instance*"`
+     * 
+ * + * 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.
+     * To search against the `description`:
+     * * use a field query. Example: `description : "*important instance*"`
+     * * use a free text query. Example: `"*important instance*"`
+     * 
+ * + * 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.
+     * To search against the `description`:
+     * * use a field query. Example: `description : "*important instance*"`
+     * * use a free text query. Example: `"*important instance*"`
+     * 
+ * + * 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; + } + + private java.lang.Object location_ = ""; + /** + * + * + *
+     * Location can be "global", regional like "us-east1", or zonal like
+     * "us-west1-b".
+     * To search against the `location`:
+     * * use a field query. Example: `location : "us-west*"`
+     * * use a free text query. Example: `"us-west*"`
+     * 
+ * + * string location = 6; + * + * @return The location. + */ + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Location can be "global", regional like "us-east1", or zonal like
+     * "us-west1-b".
+     * To search against the `location`:
+     * * use a field query. Example: `location : "us-west*"`
+     * * use a free text query. Example: `"us-west*"`
+     * 
+ * + * string location = 6; + * + * @return The bytes for location. + */ + public com.google.protobuf.ByteString getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Location can be "global", regional like "us-east1", or zonal like
+     * "us-west1-b".
+     * To search against the `location`:
+     * * use a field query. Example: `location : "us-west*"`
+     * * use a free text query. Example: `"us-west*"`
+     * 
+ * + * string location = 6; + * + * @param value The location to set. + * @return This builder for chaining. + */ + public Builder setLocation(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + location_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Location can be "global", regional like "us-east1", or zonal like
+     * "us-west1-b".
+     * To search against the `location`:
+     * * use a field query. Example: `location : "us-west*"`
+     * * use a free text query. Example: `"us-west*"`
+     * 
+ * + * string location = 6; + * + * @return This builder for chaining. + */ + public Builder clearLocation() { + + location_ = getDefaultInstance().getLocation(); + onChanged(); + return this; + } + /** + * + * + *
+     * Location can be "global", regional like "us-east1", or zonal like
+     * "us-west1-b".
+     * To search against the `location`:
+     * * use a field query. Example: `location : "us-west*"`
+     * * use a free text query. Example: `"us-west*"`
+     * 
+ * + * string location = 6; + * + * @param value The bytes for location to set. + * @return This builder for chaining. + */ + public Builder setLocationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + location_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * Labels associated with this resource. See [Labelling and grouping GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `labels`:
+     * * use a field query, as following:
+     *     - query on any label's key or value. Example: `labels : "prod"`
+     *     - query by a given label. Example: `labels.env : "prod"`
+     *     - query by a given label'sexistence. Example: `labels.env : *`
+     * * use a free text query. Example: `"prod"`
+     * 
+ * + * map<string, string> labels = 7; + */ + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * Labels associated with this resource. See [Labelling and grouping GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `labels`:
+     * * use a field query, as following:
+     *     - query on any label's key or value. Example: `labels : "prod"`
+     *     - query by a given label. Example: `labels.env : "prod"`
+     *     - query by a given label'sexistence. Example: `labels.env : *`
+     * * use a free text query. Example: `"prod"`
+     * 
+ * + * map<string, string> labels = 7; + */ + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * Labels associated with this resource. See [Labelling and grouping GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `labels`:
+     * * use a field query, as following:
+     *     - query on any label's key or value. Example: `labels : "prod"`
+     *     - query by a given label. Example: `labels.env : "prod"`
+     *     - query by a given label'sexistence. Example: `labels.env : *`
+     * * use a free text query. Example: `"prod"`
+     * 
+ * + * map<string, string> labels = 7; + */ + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Labels associated with this resource. See [Labelling and grouping GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `labels`:
+     * * use a field query, as following:
+     *     - query on any label's key or value. Example: `labels : "prod"`
+     *     - query by a given label. Example: `labels.env : "prod"`
+     *     - query by a given label'sexistence. Example: `labels.env : *`
+     * * use a free text query. Example: `"prod"`
+     * 
+ * + * map<string, string> labels = 7; + */ + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Labels associated with this resource. See [Labelling and grouping GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `labels`:
+     * * use a field query, as following:
+     *     - query on any label's key or value. Example: `labels : "prod"`
+     *     - query by a given label. Example: `labels.env : "prod"`
+     *     - query by a given label'sexistence. Example: `labels.env : *`
+     * * use a free text query. Example: `"prod"`
+     * 
+ * + * map<string, string> labels = 7; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * Labels associated with this resource. See [Labelling and grouping GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `labels`:
+     * * use a field query, as following:
+     *     - query on any label's key or value. Example: `labels : "prod"`
+     *     - query by a given label. Example: `labels.env : "prod"`
+     *     - query by a given label'sexistence. Example: `labels.env : *`
+     * * use a free text query. Example: `"prod"`
+     * 
+ * + * map<string, string> labels = 7; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Labels associated with this resource. See [Labelling and grouping GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `labels`:
+     * * use a field query, as following:
+     *     - query on any label's key or value. Example: `labels : "prod"`
+     *     - query by a given label. Example: `labels.env : "prod"`
+     *     - query by a given label'sexistence. Example: `labels.env : *`
+     * * use a free text query. Example: `"prod"`
+     * 
+ * + * map<string, string> labels = 7; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.LazyStringList networkTags_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureNetworkTagsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + networkTags_ = new com.google.protobuf.LazyStringArrayList(networkTags_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * Network tags associated with this resource. Like labels, network tags are a
+     * type of annotations used to group GCP resources. See [Labelling GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `network_tags`:
+     * * use a field query. Example: `networkTags : "internal"`
+     * * use a free text query. Example: `"internal"`
+     * 
+ * + * repeated string network_tags = 8; + * + * @return A list containing the networkTags. + */ + public com.google.protobuf.ProtocolStringList getNetworkTagsList() { + return networkTags_.getUnmodifiableView(); + } + /** + * + * + *
+     * Network tags associated with this resource. Like labels, network tags are a
+     * type of annotations used to group GCP resources. See [Labelling GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `network_tags`:
+     * * use a field query. Example: `networkTags : "internal"`
+     * * use a free text query. Example: `"internal"`
+     * 
+ * + * repeated string network_tags = 8; + * + * @return The count of networkTags. + */ + public int getNetworkTagsCount() { + return networkTags_.size(); + } + /** + * + * + *
+     * Network tags associated with this resource. Like labels, network tags are a
+     * type of annotations used to group GCP resources. See [Labelling GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `network_tags`:
+     * * use a field query. Example: `networkTags : "internal"`
+     * * use a free text query. Example: `"internal"`
+     * 
+ * + * repeated string network_tags = 8; + * + * @param index The index of the element to return. + * @return The networkTags at the given index. + */ + public java.lang.String getNetworkTags(int index) { + return networkTags_.get(index); + } + /** + * + * + *
+     * Network tags associated with this resource. Like labels, network tags are a
+     * type of annotations used to group GCP resources. See [Labelling GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `network_tags`:
+     * * use a field query. Example: `networkTags : "internal"`
+     * * use a free text query. Example: `"internal"`
+     * 
+ * + * repeated string network_tags = 8; + * + * @param index The index of the value to return. + * @return The bytes of the networkTags at the given index. + */ + public com.google.protobuf.ByteString getNetworkTagsBytes(int index) { + return networkTags_.getByteString(index); + } + /** + * + * + *
+     * Network tags associated with this resource. Like labels, network tags are a
+     * type of annotations used to group GCP resources. See [Labelling GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `network_tags`:
+     * * use a field query. Example: `networkTags : "internal"`
+     * * use a free text query. Example: `"internal"`
+     * 
+ * + * repeated string network_tags = 8; + * + * @param index The index to set the value at. + * @param value The networkTags to set. + * @return This builder for chaining. + */ + public Builder setNetworkTags(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureNetworkTagsIsMutable(); + networkTags_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Network tags associated with this resource. Like labels, network tags are a
+     * type of annotations used to group GCP resources. See [Labelling GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `network_tags`:
+     * * use a field query. Example: `networkTags : "internal"`
+     * * use a free text query. Example: `"internal"`
+     * 
+ * + * repeated string network_tags = 8; + * + * @param value The networkTags to add. + * @return This builder for chaining. + */ + public Builder addNetworkTags(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureNetworkTagsIsMutable(); + networkTags_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Network tags associated with this resource. Like labels, network tags are a
+     * type of annotations used to group GCP resources. See [Labelling GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `network_tags`:
+     * * use a field query. Example: `networkTags : "internal"`
+     * * use a free text query. Example: `"internal"`
+     * 
+ * + * repeated string network_tags = 8; + * + * @param values The networkTags to add. + * @return This builder for chaining. + */ + public Builder addAllNetworkTags(java.lang.Iterable values) { + ensureNetworkTagsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, networkTags_); + onChanged(); + return this; + } + /** + * + * + *
+     * Network tags associated with this resource. Like labels, network tags are a
+     * type of annotations used to group GCP resources. See [Labelling GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `network_tags`:
+     * * use a field query. Example: `networkTags : "internal"`
+     * * use a free text query. Example: `"internal"`
+     * 
+ * + * repeated string network_tags = 8; + * + * @return This builder for chaining. + */ + public Builder clearNetworkTags() { + networkTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Network tags associated with this resource. Like labels, network tags are a
+     * type of annotations used to group GCP resources. See [Labelling GCP
+     * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+     * for more information.
+     * To search against the `network_tags`:
+     * * use a field query. Example: `networkTags : "internal"`
+     * * use a free text query. Example: `"internal"`
+     * 
+ * + * repeated string network_tags = 8; + * + * @param value The bytes of the networkTags to add. + * @return This builder for chaining. + */ + public Builder addNetworkTagsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureNetworkTagsIsMutable(); + networkTags_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.Struct additionalAttributes_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder> + additionalAttributesBuilder_; + /** + * + * + *
+     * The additional attributes of this resource. The attributes may vary from
+     * one resource type to another. Examples: "projectId" for Project,
+     * "dnsName" for DNS ManagedZone.
+     * To search against the `additional_attributes`:
+     * * use a free text query to match the attributes values. Example: to search
+     *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+     *   `"foobar"`.
+     * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + * + * @return Whether the additionalAttributes field is set. + */ + public boolean hasAdditionalAttributes() { + return additionalAttributesBuilder_ != null || additionalAttributes_ != null; + } + /** + * + * + *
+     * The additional attributes of this resource. The attributes may vary from
+     * one resource type to another. Examples: "projectId" for Project,
+     * "dnsName" for DNS ManagedZone.
+     * To search against the `additional_attributes`:
+     * * use a free text query to match the attributes values. Example: to search
+     *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+     *   `"foobar"`.
+     * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + * + * @return The additionalAttributes. + */ + public com.google.protobuf.Struct getAdditionalAttributes() { + if (additionalAttributesBuilder_ == null) { + return additionalAttributes_ == null + ? com.google.protobuf.Struct.getDefaultInstance() + : additionalAttributes_; + } else { + return additionalAttributesBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The additional attributes of this resource. The attributes may vary from
+     * one resource type to another. Examples: "projectId" for Project,
+     * "dnsName" for DNS ManagedZone.
+     * To search against the `additional_attributes`:
+     * * use a free text query to match the attributes values. Example: to search
+     *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+     *   `"foobar"`.
+     * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + */ + public Builder setAdditionalAttributes(com.google.protobuf.Struct value) { + if (additionalAttributesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + additionalAttributes_ = value; + onChanged(); + } else { + additionalAttributesBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The additional attributes of this resource. The attributes may vary from
+     * one resource type to another. Examples: "projectId" for Project,
+     * "dnsName" for DNS ManagedZone.
+     * To search against the `additional_attributes`:
+     * * use a free text query to match the attributes values. Example: to search
+     *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+     *   `"foobar"`.
+     * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + */ + public Builder setAdditionalAttributes(com.google.protobuf.Struct.Builder builderForValue) { + if (additionalAttributesBuilder_ == null) { + additionalAttributes_ = builderForValue.build(); + onChanged(); + } else { + additionalAttributesBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The additional attributes of this resource. The attributes may vary from
+     * one resource type to another. Examples: "projectId" for Project,
+     * "dnsName" for DNS ManagedZone.
+     * To search against the `additional_attributes`:
+     * * use a free text query to match the attributes values. Example: to search
+     *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+     *   `"foobar"`.
+     * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + */ + public Builder mergeAdditionalAttributes(com.google.protobuf.Struct value) { + if (additionalAttributesBuilder_ == null) { + if (additionalAttributes_ != null) { + additionalAttributes_ = + com.google.protobuf.Struct.newBuilder(additionalAttributes_) + .mergeFrom(value) + .buildPartial(); + } else { + additionalAttributes_ = value; + } + onChanged(); + } else { + additionalAttributesBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The additional attributes of this resource. The attributes may vary from
+     * one resource type to another. Examples: "projectId" for Project,
+     * "dnsName" for DNS ManagedZone.
+     * To search against the `additional_attributes`:
+     * * use a free text query to match the attributes values. Example: to search
+     *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+     *   `"foobar"`.
+     * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + */ + public Builder clearAdditionalAttributes() { + if (additionalAttributesBuilder_ == null) { + additionalAttributes_ = null; + onChanged(); + } else { + additionalAttributes_ = null; + additionalAttributesBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The additional attributes of this resource. The attributes may vary from
+     * one resource type to another. Examples: "projectId" for Project,
+     * "dnsName" for DNS ManagedZone.
+     * To search against the `additional_attributes`:
+     * * use a free text query to match the attributes values. Example: to search
+     *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+     *   `"foobar"`.
+     * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + */ + public com.google.protobuf.Struct.Builder getAdditionalAttributesBuilder() { + + onChanged(); + return getAdditionalAttributesFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The additional attributes of this resource. The attributes may vary from
+     * one resource type to another. Examples: "projectId" for Project,
+     * "dnsName" for DNS ManagedZone.
+     * To search against the `additional_attributes`:
+     * * use a free text query to match the attributes values. Example: to search
+     *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+     *   `"foobar"`.
+     * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + */ + public com.google.protobuf.StructOrBuilder getAdditionalAttributesOrBuilder() { + if (additionalAttributesBuilder_ != null) { + return additionalAttributesBuilder_.getMessageOrBuilder(); + } else { + return additionalAttributes_ == null + ? com.google.protobuf.Struct.getDefaultInstance() + : additionalAttributes_; + } + } + /** + * + * + *
+     * The additional attributes of this resource. The attributes may vary from
+     * one resource type to another. Examples: "projectId" for Project,
+     * "dnsName" for DNS ManagedZone.
+     * To search against the `additional_attributes`:
+     * * use a free text query to match the attributes values. Example: to search
+     *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+     *   `"foobar"`.
+     * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder> + getAdditionalAttributesFieldBuilder() { + if (additionalAttributesBuilder_ == null) { + additionalAttributesBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder>( + getAdditionalAttributes(), getParentForChildren(), isClean()); + additionalAttributes_ = null; + } + return additionalAttributesBuilder_; + } + + @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.v1.ResourceSearchResult) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.ResourceSearchResult) + private static final com.google.cloud.asset.v1.ResourceSearchResult DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1.ResourceSearchResult(); + } + + public static com.google.cloud.asset.v1.ResourceSearchResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ResourceSearchResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ResourceSearchResult(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.v1.ResourceSearchResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceSearchResultOrBuilder.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceSearchResultOrBuilder.java new file mode 100644 index 000000000..c7b026745 --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/ResourceSearchResultOrBuilder.java @@ -0,0 +1,443 @@ +/* + * 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/v1/assets.proto + +package com.google.cloud.asset.v1; + +public interface ResourceSearchResultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.ResourceSearchResult) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The full resource name of this resource. Example:
+   * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+   * See [Cloud Asset Inventory Resource Name
+   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+   * for more information.
+   * To search against the `name`:
+   * * use a field query. Example: `name : "instance1"`
+   * * use a free text query. Example: `"instance1"`
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The full resource name of this resource. Example:
+   * "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+   * See [Cloud Asset Inventory Resource Name
+   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+   * for more information.
+   * To search against the `name`:
+   * * use a field query. Example: `name : "instance1"`
+   * * use a free text query. Example: `"instance1"`
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The type of this resource. Example: "compute.googleapis.com/Disk".
+   * To search against the `asset_type`:
+   * * specify the `asset_type` field in your search request.
+   * 
+ * + * string asset_type = 2; + * + * @return The assetType. + */ + java.lang.String getAssetType(); + /** + * + * + *
+   * The type of this resource. Example: "compute.googleapis.com/Disk".
+   * To search against the `asset_type`:
+   * * specify the `asset_type` field in your search request.
+   * 
+ * + * 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}.
+   * To search against the `project`:
+   * * specify the `scope` field as this project in your search request.
+   * 
+ * + * string project = 3; + * + * @return The project. + */ + java.lang.String getProject(); + /** + * + * + *
+   * The project that this resource belongs to, in the form of
+   * projects/{PROJECT_NUMBER}.
+   * To search against the `project`:
+   * * specify the `scope` field as this project in your search request.
+   * 
+ * + * string project = 3; + * + * @return The bytes for project. + */ + com.google.protobuf.ByteString getProjectBytes(); + + /** + * + * + *
+   * The display name of this resource.
+   * To search against the `display_name`:
+   * * use a field query. Example: `displayName : "My Instance"`
+   * * use a free text query. Example: `"My Instance"`
+   * 
+ * + * string display_name = 4; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * The display name of this resource.
+   * To search against the `display_name`:
+   * * use a field query. Example: `displayName : "My Instance"`
+   * * use a free text query. Example: `"My Instance"`
+   * 
+ * + * 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.
+   * To search against the `description`:
+   * * use a field query. Example: `description : "*important instance*"`
+   * * use a free text query. Example: `"*important instance*"`
+   * 
+ * + * 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.
+   * To search against the `description`:
+   * * use a field query. Example: `description : "*important instance*"`
+   * * use a free text query. Example: `"*important instance*"`
+   * 
+ * + * string description = 5; + * + * @return The bytes for description. + */ + com.google.protobuf.ByteString getDescriptionBytes(); + + /** + * + * + *
+   * Location can be "global", regional like "us-east1", or zonal like
+   * "us-west1-b".
+   * To search against the `location`:
+   * * use a field query. Example: `location : "us-west*"`
+   * * use a free text query. Example: `"us-west*"`
+   * 
+ * + * string location = 6; + * + * @return The location. + */ + java.lang.String getLocation(); + /** + * + * + *
+   * Location can be "global", regional like "us-east1", or zonal like
+   * "us-west1-b".
+   * To search against the `location`:
+   * * use a field query. Example: `location : "us-west*"`
+   * * use a free text query. Example: `"us-west*"`
+   * 
+ * + * string location = 6; + * + * @return The bytes for location. + */ + com.google.protobuf.ByteString getLocationBytes(); + + /** + * + * + *
+   * Labels associated with this resource. See [Labelling and grouping GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `labels`:
+   * * use a field query, as following:
+   *     - query on any label's key or value. Example: `labels : "prod"`
+   *     - query by a given label. Example: `labels.env : "prod"`
+   *     - query by a given label'sexistence. Example: `labels.env : *`
+   * * use a free text query. Example: `"prod"`
+   * 
+ * + * map<string, string> labels = 7; + */ + int getLabelsCount(); + /** + * + * + *
+   * Labels associated with this resource. See [Labelling and grouping GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `labels`:
+   * * use a field query, as following:
+   *     - query on any label's key or value. Example: `labels : "prod"`
+   *     - query by a given label. Example: `labels.env : "prod"`
+   *     - query by a given label'sexistence. Example: `labels.env : *`
+   * * use a free text query. Example: `"prod"`
+   * 
+ * + * map<string, string> labels = 7; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * Labels associated with this resource. See [Labelling and grouping GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `labels`:
+   * * use a field query, as following:
+   *     - query on any label's key or value. Example: `labels : "prod"`
+   *     - query by a given label. Example: `labels.env : "prod"`
+   *     - query by a given label'sexistence. Example: `labels.env : *`
+   * * use a free text query. Example: `"prod"`
+   * 
+ * + * map<string, string> labels = 7; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * Labels associated with this resource. See [Labelling and grouping GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `labels`:
+   * * use a field query, as following:
+   *     - query on any label's key or value. Example: `labels : "prod"`
+   *     - query by a given label. Example: `labels.env : "prod"`
+   *     - query by a given label'sexistence. Example: `labels.env : *`
+   * * use a free text query. Example: `"prod"`
+   * 
+ * + * map<string, string> labels = 7; + */ + java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /** + * + * + *
+   * Labels associated with this resource. See [Labelling and grouping GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `labels`:
+   * * use a field query, as following:
+   *     - query on any label's key or value. Example: `labels : "prod"`
+   *     - query by a given label. Example: `labels.env : "prod"`
+   *     - query by a given label'sexistence. Example: `labels.env : *`
+   * * use a free text query. Example: `"prod"`
+   * 
+ * + * map<string, string> labels = 7; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Network tags associated with this resource. Like labels, network tags are a
+   * type of annotations used to group GCP resources. See [Labelling GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `network_tags`:
+   * * use a field query. Example: `networkTags : "internal"`
+   * * use a free text query. Example: `"internal"`
+   * 
+ * + * repeated string network_tags = 8; + * + * @return A list containing the networkTags. + */ + java.util.List getNetworkTagsList(); + /** + * + * + *
+   * Network tags associated with this resource. Like labels, network tags are a
+   * type of annotations used to group GCP resources. See [Labelling GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `network_tags`:
+   * * use a field query. Example: `networkTags : "internal"`
+   * * use a free text query. Example: `"internal"`
+   * 
+ * + * repeated string network_tags = 8; + * + * @return The count of networkTags. + */ + int getNetworkTagsCount(); + /** + * + * + *
+   * Network tags associated with this resource. Like labels, network tags are a
+   * type of annotations used to group GCP resources. See [Labelling GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `network_tags`:
+   * * use a field query. Example: `networkTags : "internal"`
+   * * use a free text query. Example: `"internal"`
+   * 
+ * + * repeated string network_tags = 8; + * + * @param index The index of the element to return. + * @return The networkTags at the given index. + */ + java.lang.String getNetworkTags(int index); + /** + * + * + *
+   * Network tags associated with this resource. Like labels, network tags are a
+   * type of annotations used to group GCP resources. See [Labelling GCP
+   * resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+   * for more information.
+   * To search against the `network_tags`:
+   * * use a field query. Example: `networkTags : "internal"`
+   * * use a free text query. Example: `"internal"`
+   * 
+ * + * repeated string network_tags = 8; + * + * @param index The index of the value to return. + * @return The bytes of the networkTags at the given index. + */ + com.google.protobuf.ByteString getNetworkTagsBytes(int index); + + /** + * + * + *
+   * The additional attributes of this resource. The attributes may vary from
+   * one resource type to another. Examples: "projectId" for Project,
+   * "dnsName" for DNS ManagedZone.
+   * To search against the `additional_attributes`:
+   * * use a free text query to match the attributes values. Example: to search
+   *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+   *   `"foobar"`.
+   * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + * + * @return Whether the additionalAttributes field is set. + */ + boolean hasAdditionalAttributes(); + /** + * + * + *
+   * The additional attributes of this resource. The attributes may vary from
+   * one resource type to another. Examples: "projectId" for Project,
+   * "dnsName" for DNS ManagedZone.
+   * To search against the `additional_attributes`:
+   * * use a free text query to match the attributes values. Example: to search
+   *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+   *   `"foobar"`.
+   * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + * + * @return The additionalAttributes. + */ + com.google.protobuf.Struct getAdditionalAttributes(); + /** + * + * + *
+   * The additional attributes of this resource. The attributes may vary from
+   * one resource type to another. Examples: "projectId" for Project,
+   * "dnsName" for DNS ManagedZone.
+   * To search against the `additional_attributes`:
+   * * use a free text query to match the attributes values. Example: to search
+   *   additional_attributes = { dnsName: "foobar" }, you can issue a query
+   *   `"foobar"`.
+   * 
+ * + * .google.protobuf.Struct additional_attributes = 9; + */ + com.google.protobuf.StructOrBuilder getAdditionalAttributesOrBuilder(); +} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesRequest.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesRequest.java new file mode 100644 index 000000000..45c3eb3bc --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesRequest.java @@ -0,0 +1,1275 @@ +/* + * 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/v1/asset_service.proto + +package com.google.cloud.asset.v1; + +/** + * + * + *
+ * Search all IAM policies request.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1.SearchAllIamPoliciesRequest} + */ +public final class SearchAllIamPoliciesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.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.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest.class, + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest.Builder.class); + } + + public static final int SCOPE_FIELD_NUMBER = 1; + private volatile java.lang.Object scope_; + /** + * + * + *
+   * Required. A scope can be a project, a folder or an organization. The search
+   * is limited to the IAM policies within the `scope`.
+   * The allowed values are:
+   * * projects/{PROJECT_ID}
+   * * projects/{PROJECT_NUMBER}
+   * * folders/{FOLDER_NUMBER}
+   * * organizations/{ORGANIZATION_NUMBER}
+   * 
+ * + * 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. A scope can be a project, a folder or an organization. The search
+   * is limited to the IAM policies within the `scope`.
+   * The allowed values are:
+   * * projects/{PROJECT_ID}
+   * * projects/{PROJECT_NUMBER}
+   * * folders/{FOLDER_NUMBER}
+   * * organizations/{ORGANIZATION_NUMBER}
+   * 
+ * + * 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. An empty query can be specified to search
+   * all the IAM policies within the given `scope`.
+   * Examples:
+   * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+   *   specify user "amy@gmail.com".
+   * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+   *   specify the Compute Admin role.
+   * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+   *   policy bindings that specify a role containing "storage.buckets.update"
+   *   permission.
+   * * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+   *   are set on "organizations/123".
+   * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+   *   to find Cloud IAM policy bindings that are set on "organizations/123" or
+   *   "folders/1234", and also specify user "amy".
+   * See [how to construct a
+   * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+   * for more details.
+   * 
+ * + * 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. An empty query can be specified to search
+   * all the IAM policies within the given `scope`.
+   * Examples:
+   * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+   *   specify user "amy@gmail.com".
+   * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+   *   specify the Compute Admin role.
+   * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+   *   policy bindings that specify a role containing "storage.buckets.update"
+   *   permission.
+   * * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+   *   are set on "organizations/123".
+   * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+   *   to find Cloud IAM policy bindings that are set on "organizations/123" or
+   *   "folders/1234", and also specify user "amy".
+   * See [how to construct a
+   * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+   * for more details.
+   * 
+ * + * 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. Page size is capped
+   * at 500 even if a larger value is given. If set to zero, server will pick an
+   * appropriate default. Returned results may be fewer than requested. When
+   * this happens, there could be more results as long as `next_page_token` is
+   * returned.
+   * 
+ * + * 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.v1.SearchAllIamPoliciesRequest)) { + return super.equals(obj); + } + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest other = + (com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.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.v1.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.v1.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.v1.SearchAllIamPoliciesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.SearchAllIamPoliciesRequest) + com.google.cloud.asset.v1.SearchAllIamPoliciesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest.class, + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest.Builder.class); + } + + // Construct using com.google.cloud.asset.v1.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.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllIamPoliciesRequest getDefaultInstanceForType() { + return com.google.cloud.asset.v1.SearchAllIamPoliciesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllIamPoliciesRequest build() { + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllIamPoliciesRequest buildPartial() { + com.google.cloud.asset.v1.SearchAllIamPoliciesRequest result = + new com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesRequest) { + return mergeFrom((com.google.cloud.asset.v1.SearchAllIamPoliciesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1.SearchAllIamPoliciesRequest other) { + if (other == com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1.SearchAllIamPoliciesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object scope_ = ""; + /** + * + * + *
+     * Required. A scope can be a project, a folder or an organization. The search
+     * is limited to the IAM policies within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * 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. A scope can be a project, a folder or an organization. The search
+     * is limited to the IAM policies within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * 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. A scope can be a project, a folder or an organization. The search
+     * is limited to the IAM policies within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * 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. A scope can be a project, a folder or an organization. The search
+     * is limited to the IAM policies within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearScope() { + + scope_ = getDefaultInstance().getScope(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. A scope can be a project, a folder or an organization. The search
+     * is limited to the IAM policies within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the IAM policies within the given `scope`.
+     * Examples:
+     * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+     *   specify user "amy@gmail.com".
+     * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+     *   specify the Compute Admin role.
+     * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+     *   policy bindings that specify a role containing "storage.buckets.update"
+     *   permission.
+     * * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+     *   are set on "organizations/123".
+     * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+     *   to find Cloud IAM policy bindings that are set on "organizations/123" or
+     *   "folders/1234", and also specify user "amy".
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the IAM policies within the given `scope`.
+     * Examples:
+     * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+     *   specify user "amy@gmail.com".
+     * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+     *   specify the Compute Admin role.
+     * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+     *   policy bindings that specify a role containing "storage.buckets.update"
+     *   permission.
+     * * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+     *   are set on "organizations/123".
+     * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+     *   to find Cloud IAM policy bindings that are set on "organizations/123" or
+     *   "folders/1234", and also specify user "amy".
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the IAM policies within the given `scope`.
+     * Examples:
+     * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+     *   specify user "amy@gmail.com".
+     * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+     *   specify the Compute Admin role.
+     * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+     *   policy bindings that specify a role containing "storage.buckets.update"
+     *   permission.
+     * * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+     *   are set on "organizations/123".
+     * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+     *   to find Cloud IAM policy bindings that are set on "organizations/123" or
+     *   "folders/1234", and also specify user "amy".
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the IAM policies within the given `scope`.
+     * Examples:
+     * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+     *   specify user "amy@gmail.com".
+     * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+     *   specify the Compute Admin role.
+     * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+     *   policy bindings that specify a role containing "storage.buckets.update"
+     *   permission.
+     * * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+     *   are set on "organizations/123".
+     * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+     *   to find Cloud IAM policy bindings that are set on "organizations/123" or
+     *   "folders/1234", and also specify user "amy".
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the IAM policies within the given `scope`.
+     * Examples:
+     * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+     *   specify user "amy@gmail.com".
+     * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+     *   specify the Compute Admin role.
+     * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+     *   policy bindings that specify a role containing "storage.buckets.update"
+     *   permission.
+     * * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+     *   are set on "organizations/123".
+     * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+     *   to find Cloud IAM policy bindings that are set on "organizations/123" or
+     *   "folders/1234", and also specify user "amy".
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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. Page size is capped
+     * at 500 even if a larger value is given. If set to zero, server will pick an
+     * appropriate default. Returned results may be fewer than requested. When
+     * this happens, there could be more results as long as `next_page_token` is
+     * returned.
+     * 
+ * + * 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. Page size is capped
+     * at 500 even if a larger value is given. If set to zero, server will pick an
+     * appropriate default. Returned results may be fewer than requested. When
+     * this happens, there could be more results as long as `next_page_token` is
+     * returned.
+     * 
+ * + * 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. Page size is capped
+     * at 500 even if a larger value is given. If set to zero, server will pick an
+     * appropriate default. Returned results may be fewer than requested. When
+     * this happens, there could be more results as long as `next_page_token` is
+     * returned.
+     * 
+ * + * 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.v1.SearchAllIamPoliciesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.SearchAllIamPoliciesRequest) + private static final com.google.cloud.asset.v1.SearchAllIamPoliciesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1.SearchAllIamPoliciesRequest(); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesRequestOrBuilder.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesRequestOrBuilder.java new file mode 100644 index 000000000..9b7e127db --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesRequestOrBuilder.java @@ -0,0 +1,169 @@ +/* + * 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/v1/asset_service.proto + +package com.google.cloud.asset.v1; + +public interface SearchAllIamPoliciesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.SearchAllIamPoliciesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. A scope can be a project, a folder or an organization. The search
+   * is limited to the IAM policies within the `scope`.
+   * The allowed values are:
+   * * projects/{PROJECT_ID}
+   * * projects/{PROJECT_NUMBER}
+   * * folders/{FOLDER_NUMBER}
+   * * organizations/{ORGANIZATION_NUMBER}
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + java.lang.String getScope(); + /** + * + * + *
+   * Required. A scope can be a project, a folder or an organization. The search
+   * is limited to the IAM policies within the `scope`.
+   * The allowed values are:
+   * * projects/{PROJECT_ID}
+   * * projects/{PROJECT_NUMBER}
+   * * folders/{FOLDER_NUMBER}
+   * * organizations/{ORGANIZATION_NUMBER}
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + com.google.protobuf.ByteString getScopeBytes(); + + /** + * + * + *
+   * Optional. The query statement. An empty query can be specified to search
+   * all the IAM policies within the given `scope`.
+   * Examples:
+   * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+   *   specify user "amy@gmail.com".
+   * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+   *   specify the Compute Admin role.
+   * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+   *   policy bindings that specify a role containing "storage.buckets.update"
+   *   permission.
+   * * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+   *   are set on "organizations/123".
+   * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+   *   to find Cloud IAM policy bindings that are set on "organizations/123" or
+   *   "folders/1234", and also specify user "amy".
+   * See [how to construct a
+   * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+   * for more details.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + java.lang.String getQuery(); + /** + * + * + *
+   * Optional. The query statement. An empty query can be specified to search
+   * all the IAM policies within the given `scope`.
+   * Examples:
+   * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+   *   specify user "amy@gmail.com".
+   * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+   *   specify the Compute Admin role.
+   * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+   *   policy bindings that specify a role containing "storage.buckets.update"
+   *   permission.
+   * * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+   *   are set on "organizations/123".
+   * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+   *   to find Cloud IAM policy bindings that are set on "organizations/123" or
+   *   "folders/1234", and also specify user "amy".
+   * See [how to construct a
+   * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+   * for more details.
+   * 
+ * + * 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. Page size is capped
+   * at 500 even if a larger value is given. If set to zero, server will pick an
+   * appropriate default. Returned results may be fewer than requested. When
+   * this happens, there could be more results as long as `next_page_token` is
+   * returned.
+   * 
+ * + * 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-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesResponse.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesResponse.java new file mode 100644 index 000000000..39ce263c3 --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesResponse.java @@ -0,0 +1,1162 @@ +/* + * 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/v1/asset_service.proto + +package com.google.cloud.asset.v1; + +/** + * + * + *
+ * Search all IAM policies response.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1.SearchAllIamPoliciesResponse} + */ +public final class SearchAllIamPoliciesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.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(); + mutable_bitField0_ |= 0x00000001; + } + results_.add( + input.readMessage( + com.google.cloud.asset.v1.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.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse.class, + com.google.cloud.asset.v1.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.v1.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.v1.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.v1.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.v1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse)) { + return super.equals(obj); + } + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse other = + (com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.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.v1.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.v1.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.v1.SearchAllIamPoliciesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.SearchAllIamPoliciesResponse) + com.google.cloud.asset.v1.SearchAllIamPoliciesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse.class, + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse.Builder.class); + } + + // Construct using com.google.cloud.asset.v1.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.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllIamPoliciesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllIamPoliciesResponse getDefaultInstanceForType() { + return com.google.cloud.asset.v1.SearchAllIamPoliciesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllIamPoliciesResponse build() { + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllIamPoliciesResponse buildPartial() { + com.google.cloud.asset.v1.SearchAllIamPoliciesResponse result = + new com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse) { + return mergeFrom((com.google.cloud.asset.v1.SearchAllIamPoliciesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1.SearchAllIamPoliciesResponse other) { + if (other == com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1.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.v1.IamPolicySearchResult, + com.google.cloud.asset.v1.IamPolicySearchResult.Builder, + com.google.cloud.asset.v1.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.v1.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.v1.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.v1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public Builder setResults(int index, com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public Builder setResults( + int index, com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public Builder addResults(com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public Builder addResults(int index, com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public Builder addResults( + com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public Builder addResults( + int index, com.google.cloud.asset.v1.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.v1.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.v1.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.v1.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.v1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1.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.v1.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.v1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder(com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public com.google.cloud.asset.v1.IamPolicySearchResult.Builder addResultsBuilder(int index) { + return getResultsFieldBuilder() + .addBuilder(index, com.google.cloud.asset.v1.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.v1.IamPolicySearchResult results = 1; + */ + public java.util.List + getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1.IamPolicySearchResult, + com.google.cloud.asset.v1.IamPolicySearchResult.Builder, + com.google.cloud.asset.v1.IamPolicySearchResultOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1.IamPolicySearchResult, + com.google.cloud.asset.v1.IamPolicySearchResult.Builder, + com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.SearchAllIamPoliciesResponse) + private static final com.google.cloud.asset.v1.SearchAllIamPoliciesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1.SearchAllIamPoliciesResponse(); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllIamPoliciesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesResponseOrBuilder.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllIamPoliciesResponseOrBuilder.java new file mode 100644 index 000000000..56d9e7a7a --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/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/v1/asset_service.proto + +package com.google.cloud.asset.v1; + +public interface SearchAllIamPoliciesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.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.v1.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.v1.IamPolicySearchResult results = 1; + */ + com.google.cloud.asset.v1.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.v1.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.v1.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.v1.IamPolicySearchResult results = 1; + */ + com.google.cloud.asset.v1.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-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesRequest.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesRequest.java new file mode 100644 index 000000000..02583675a --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesRequest.java @@ -0,0 +1,1869 @@ +/* + * 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/v1/asset_service.proto + +package com.google.cloud.asset.v1; + +/** + * + * + *
+ * Search all resources request.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1.SearchAllResourcesRequest} + */ +public final class SearchAllResourcesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.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_ = ""; + orderBy_ = ""; + } + + @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; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + orderBy_ = 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.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.SearchAllResourcesRequest.class, + com.google.cloud.asset.v1.SearchAllResourcesRequest.Builder.class); + } + + public static final int SCOPE_FIELD_NUMBER = 1; + private volatile java.lang.Object scope_; + /** + * + * + *
+   * Required. A scope can be a project, a folder or an organization. The search
+   * is limited to the resources within the `scope`.
+   * The allowed values are:
+   * * projects/{PROJECT_ID}
+   * * projects/{PROJECT_NUMBER}
+   * * folders/{FOLDER_NUMBER}
+   * * organizations/{ORGANIZATION_NUMBER}
+   * 
+ * + * 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. A scope can be a project, a folder or an organization. The search
+   * is limited to the resources within the `scope`.
+   * The allowed values are:
+   * * projects/{PROJECT_ID}
+   * * projects/{PROJECT_NUMBER}
+   * * folders/{FOLDER_NUMBER}
+   * * organizations/{ORGANIZATION_NUMBER}
+   * 
+ * + * 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. An empty query can be specified to search
+   * all the resources of certain `asset_types` within the given `scope`.
+   * Examples:
+   * * `name : "Important"` to find Cloud resources whose name contains
+   *   "Important" as a word.
+   * * `displayName : "Impor*"` to find Cloud resources whose display name
+   *   contains "Impor" as a word prefix.
+   * * `description : "*por*"` to find Cloud resources whose description
+   *   contains "por" as a substring.
+   * * `location : "us-west*"` to find Cloud resources whose location is
+   *   prefixed with "us-west".
+   * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+   *   a key or value.
+   * * `labels.env : "prod"` to find Cloud resources which have a label "env"
+   *   and its value is "prod".
+   * * `labels.env : *` to find Cloud resources which have a label "env".
+   * * `"Important"` to find Cloud resources which contain "Important" as a word
+   *   in any of the searchable fields.
+   * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+   *   in any of the searchable fields.
+   * * `"*por*"` to find Cloud resources which contain "por" as a substring in
+   *   any of the searchable fields.
+   * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+   *   resources which contain "Important" as a word in any of the searchable
+   *   fields and are also located in the "us-west1" region or the "global"
+   *   location.
+   * See [how to construct a
+   * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+   * for more details.
+   * 
+ * + * 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. An empty query can be specified to search
+   * all the resources of certain `asset_types` within the given `scope`.
+   * Examples:
+   * * `name : "Important"` to find Cloud resources whose name contains
+   *   "Important" as a word.
+   * * `displayName : "Impor*"` to find Cloud resources whose display name
+   *   contains "Impor" as a word prefix.
+   * * `description : "*por*"` to find Cloud resources whose description
+   *   contains "por" as a substring.
+   * * `location : "us-west*"` to find Cloud resources whose location is
+   *   prefixed with "us-west".
+   * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+   *   a key or value.
+   * * `labels.env : "prod"` to find Cloud resources which have a label "env"
+   *   and its value is "prod".
+   * * `labels.env : *` to find Cloud resources which have a label "env".
+   * * `"Important"` to find Cloud resources which contain "Important" as a word
+   *   in any of the searchable fields.
+   * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+   *   in any of the searchable fields.
+   * * `"*por*"` to find Cloud resources which contain "por" as a substring in
+   *   any of the searchable fields.
+   * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+   *   resources which contain "Important" as a word in any of the searchable
+   *   fields and are also located in the "us-west1" region or the "global"
+   *   location.
+   * See [how to construct a
+   * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+   * for more details.
+   * 
+ * + * 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 [searchable asset
+   * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+   * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+   * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+   * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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. Page size is capped
+   * at 500 even if a larger value is given. If set to zero, server will pick an
+   * appropriate default. Returned results may be fewer than requested. When
+   * this happens, there could be more results as long as `next_page_token` is
+   * returned.
+   * 
+ * + * 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; + } + } + + public static final int ORDER_BY_FIELD_NUMBER = 6; + private volatile java.lang.Object orderBy_; + /** + * + * + *
+   * Optional. A comma separated list of fields specifying the sorting order of
+   * the results. The default order is ascending. Add " DESC" after the field
+   * name to indicate descending order. Redundant space characters are ignored.
+   * Example: "location DESC, name". See [supported resource metadata
+   * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+   * for more details.
+   * 
+ * + * string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The orderBy. + */ + public java.lang.String getOrderBy() { + java.lang.Object ref = orderBy_; + 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(); + orderBy_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. A comma separated list of fields specifying the sorting order of
+   * the results. The default order is ascending. Add " DESC" after the field
+   * name to indicate descending order. Redundant space characters are ignored.
+   * Example: "location DESC, name". See [supported resource metadata
+   * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+   * for more details.
+   * 
+ * + * string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for orderBy. + */ + public com.google.protobuf.ByteString getOrderByBytes() { + java.lang.Object ref = orderBy_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + orderBy_ = 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_); + } + if (!getOrderByBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, orderBy_); + } + 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_); + } + if (!getOrderByBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, orderBy_); + } + 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.v1.SearchAllResourcesRequest)) { + return super.equals(obj); + } + com.google.cloud.asset.v1.SearchAllResourcesRequest other = + (com.google.cloud.asset.v1.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 (!getOrderBy().equals(other.getOrderBy())) 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 = (37 * hash) + ORDER_BY_FIELD_NUMBER; + hash = (53 * hash) + getOrderBy().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.asset.v1.SearchAllResourcesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.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.v1.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.v1.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.v1.SearchAllResourcesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.SearchAllResourcesRequest) + com.google.cloud.asset.v1.SearchAllResourcesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.SearchAllResourcesRequest.class, + com.google.cloud.asset.v1.SearchAllResourcesRequest.Builder.class); + } + + // Construct using com.google.cloud.asset.v1.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_ = ""; + + orderBy_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllResourcesRequest getDefaultInstanceForType() { + return com.google.cloud.asset.v1.SearchAllResourcesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllResourcesRequest build() { + com.google.cloud.asset.v1.SearchAllResourcesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllResourcesRequest buildPartial() { + com.google.cloud.asset.v1.SearchAllResourcesRequest result = + new com.google.cloud.asset.v1.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_; + result.orderBy_ = orderBy_; + 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.v1.SearchAllResourcesRequest) { + return mergeFrom((com.google.cloud.asset.v1.SearchAllResourcesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1.SearchAllResourcesRequest other) { + if (other == com.google.cloud.asset.v1.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(); + } + if (!other.getOrderBy().isEmpty()) { + orderBy_ = other.orderBy_; + 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.v1.SearchAllResourcesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1.SearchAllResourcesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object scope_ = ""; + /** + * + * + *
+     * Required. A scope can be a project, a folder or an organization. The search
+     * is limited to the resources within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * 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. A scope can be a project, a folder or an organization. The search
+     * is limited to the resources within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * 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. A scope can be a project, a folder or an organization. The search
+     * is limited to the resources within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * 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. A scope can be a project, a folder or an organization. The search
+     * is limited to the resources within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearScope() { + + scope_ = getDefaultInstance().getScope(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. A scope can be a project, a folder or an organization. The search
+     * is limited to the resources within the `scope`.
+     * The allowed values are:
+     * * projects/{PROJECT_ID}
+     * * projects/{PROJECT_NUMBER}
+     * * folders/{FOLDER_NUMBER}
+     * * organizations/{ORGANIZATION_NUMBER}
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the resources of certain `asset_types` within the given `scope`.
+     * Examples:
+     * * `name : "Important"` to find Cloud resources whose name contains
+     *   "Important" as a word.
+     * * `displayName : "Impor*"` to find Cloud resources whose display name
+     *   contains "Impor" as a word prefix.
+     * * `description : "*por*"` to find Cloud resources whose description
+     *   contains "por" as a substring.
+     * * `location : "us-west*"` to find Cloud resources whose location is
+     *   prefixed with "us-west".
+     * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+     *   a key or value.
+     * * `labels.env : "prod"` to find Cloud resources which have a label "env"
+     *   and its value is "prod".
+     * * `labels.env : *` to find Cloud resources which have a label "env".
+     * * `"Important"` to find Cloud resources which contain "Important" as a word
+     *   in any of the searchable fields.
+     * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+     *   in any of the searchable fields.
+     * * `"*por*"` to find Cloud resources which contain "por" as a substring in
+     *   any of the searchable fields.
+     * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+     *   resources which contain "Important" as a word in any of the searchable
+     *   fields and are also located in the "us-west1" region or the "global"
+     *   location.
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the resources of certain `asset_types` within the given `scope`.
+     * Examples:
+     * * `name : "Important"` to find Cloud resources whose name contains
+     *   "Important" as a word.
+     * * `displayName : "Impor*"` to find Cloud resources whose display name
+     *   contains "Impor" as a word prefix.
+     * * `description : "*por*"` to find Cloud resources whose description
+     *   contains "por" as a substring.
+     * * `location : "us-west*"` to find Cloud resources whose location is
+     *   prefixed with "us-west".
+     * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+     *   a key or value.
+     * * `labels.env : "prod"` to find Cloud resources which have a label "env"
+     *   and its value is "prod".
+     * * `labels.env : *` to find Cloud resources which have a label "env".
+     * * `"Important"` to find Cloud resources which contain "Important" as a word
+     *   in any of the searchable fields.
+     * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+     *   in any of the searchable fields.
+     * * `"*por*"` to find Cloud resources which contain "por" as a substring in
+     *   any of the searchable fields.
+     * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+     *   resources which contain "Important" as a word in any of the searchable
+     *   fields and are also located in the "us-west1" region or the "global"
+     *   location.
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the resources of certain `asset_types` within the given `scope`.
+     * Examples:
+     * * `name : "Important"` to find Cloud resources whose name contains
+     *   "Important" as a word.
+     * * `displayName : "Impor*"` to find Cloud resources whose display name
+     *   contains "Impor" as a word prefix.
+     * * `description : "*por*"` to find Cloud resources whose description
+     *   contains "por" as a substring.
+     * * `location : "us-west*"` to find Cloud resources whose location is
+     *   prefixed with "us-west".
+     * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+     *   a key or value.
+     * * `labels.env : "prod"` to find Cloud resources which have a label "env"
+     *   and its value is "prod".
+     * * `labels.env : *` to find Cloud resources which have a label "env".
+     * * `"Important"` to find Cloud resources which contain "Important" as a word
+     *   in any of the searchable fields.
+     * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+     *   in any of the searchable fields.
+     * * `"*por*"` to find Cloud resources which contain "por" as a substring in
+     *   any of the searchable fields.
+     * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+     *   resources which contain "Important" as a word in any of the searchable
+     *   fields and are also located in the "us-west1" region or the "global"
+     *   location.
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the resources of certain `asset_types` within the given `scope`.
+     * Examples:
+     * * `name : "Important"` to find Cloud resources whose name contains
+     *   "Important" as a word.
+     * * `displayName : "Impor*"` to find Cloud resources whose display name
+     *   contains "Impor" as a word prefix.
+     * * `description : "*por*"` to find Cloud resources whose description
+     *   contains "por" as a substring.
+     * * `location : "us-west*"` to find Cloud resources whose location is
+     *   prefixed with "us-west".
+     * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+     *   a key or value.
+     * * `labels.env : "prod"` to find Cloud resources which have a label "env"
+     *   and its value is "prod".
+     * * `labels.env : *` to find Cloud resources which have a label "env".
+     * * `"Important"` to find Cloud resources which contain "Important" as a word
+     *   in any of the searchable fields.
+     * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+     *   in any of the searchable fields.
+     * * `"*por*"` to find Cloud resources which contain "por" as a substring in
+     *   any of the searchable fields.
+     * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+     *   resources which contain "Important" as a word in any of the searchable
+     *   fields and are also located in the "us-west1" region or the "global"
+     *   location.
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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. An empty query can be specified to search
+     * all the resources of certain `asset_types` within the given `scope`.
+     * Examples:
+     * * `name : "Important"` to find Cloud resources whose name contains
+     *   "Important" as a word.
+     * * `displayName : "Impor*"` to find Cloud resources whose display name
+     *   contains "Impor" as a word prefix.
+     * * `description : "*por*"` to find Cloud resources whose description
+     *   contains "por" as a substring.
+     * * `location : "us-west*"` to find Cloud resources whose location is
+     *   prefixed with "us-west".
+     * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+     *   a key or value.
+     * * `labels.env : "prod"` to find Cloud resources which have a label "env"
+     *   and its value is "prod".
+     * * `labels.env : *` to find Cloud resources which have a label "env".
+     * * `"Important"` to find Cloud resources which contain "Important" as a word
+     *   in any of the searchable fields.
+     * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+     *   in any of the searchable fields.
+     * * `"*por*"` to find Cloud resources which contain "por" as a substring in
+     *   any of the searchable fields.
+     * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+     *   resources which contain "Important" as a word in any of the searchable
+     *   fields and are also located in the "us-west1" region or the "global"
+     *   location.
+     * See [how to construct a
+     * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+     * for more details.
+     * 
+ * + * 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 [searchable asset
+     * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+     * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+     * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+     * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+     * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+     * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+     * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+     * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+     * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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. Page size is capped
+     * at 500 even if a larger value is given. If set to zero, server will pick an
+     * appropriate default. Returned results may be fewer than requested. When
+     * this happens, there could be more results as long as `next_page_token` is
+     * returned.
+     * 
+ * + * 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. Page size is capped
+     * at 500 even if a larger value is given. If set to zero, server will pick an
+     * appropriate default. Returned results may be fewer than requested. When
+     * this happens, there could be more results as long as `next_page_token` is
+     * returned.
+     * 
+ * + * 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. Page size is capped
+     * at 500 even if a larger value is given. If set to zero, server will pick an
+     * appropriate default. Returned results may be fewer than requested. When
+     * this happens, there could be more results as long as `next_page_token` is
+     * returned.
+     * 
+ * + * 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; + } + + private java.lang.Object orderBy_ = ""; + /** + * + * + *
+     * Optional. A comma separated list of fields specifying the sorting order of
+     * the results. The default order is ascending. Add " DESC" after the field
+     * name to indicate descending order. Redundant space characters are ignored.
+     * Example: "location DESC, name". See [supported resource metadata
+     * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+     * for more details.
+     * 
+ * + * string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The orderBy. + */ + public java.lang.String getOrderBy() { + java.lang.Object ref = orderBy_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + orderBy_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. A comma separated list of fields specifying the sorting order of
+     * the results. The default order is ascending. Add " DESC" after the field
+     * name to indicate descending order. Redundant space characters are ignored.
+     * Example: "location DESC, name". See [supported resource metadata
+     * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+     * for more details.
+     * 
+ * + * string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for orderBy. + */ + public com.google.protobuf.ByteString getOrderByBytes() { + java.lang.Object ref = orderBy_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + orderBy_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. A comma separated list of fields specifying the sorting order of
+     * the results. The default order is ascending. Add " DESC" after the field
+     * name to indicate descending order. Redundant space characters are ignored.
+     * Example: "location DESC, name". See [supported resource metadata
+     * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+     * for more details.
+     * 
+ * + * string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The orderBy to set. + * @return This builder for chaining. + */ + public Builder setOrderBy(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + orderBy_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A comma separated list of fields specifying the sorting order of
+     * the results. The default order is ascending. Add " DESC" after the field
+     * name to indicate descending order. Redundant space characters are ignored.
+     * Example: "location DESC, name". See [supported resource metadata
+     * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+     * for more details.
+     * 
+ * + * string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearOrderBy() { + + orderBy_ = getDefaultInstance().getOrderBy(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A comma separated list of fields specifying the sorting order of
+     * the results. The default order is ascending. Add " DESC" after the field
+     * name to indicate descending order. Redundant space characters are ignored.
+     * Example: "location DESC, name". See [supported resource metadata
+     * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+     * for more details.
+     * 
+ * + * string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for orderBy to set. + * @return This builder for chaining. + */ + public Builder setOrderByBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + orderBy_ = 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.v1.SearchAllResourcesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.SearchAllResourcesRequest) + private static final com.google.cloud.asset.v1.SearchAllResourcesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1.SearchAllResourcesRequest(); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesRequestOrBuilder.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesRequestOrBuilder.java new file mode 100644 index 000000000..27994f1db --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesRequestOrBuilder.java @@ -0,0 +1,285 @@ +/* + * 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/v1/asset_service.proto + +package com.google.cloud.asset.v1; + +public interface SearchAllResourcesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.SearchAllResourcesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. A scope can be a project, a folder or an organization. The search
+   * is limited to the resources within the `scope`.
+   * The allowed values are:
+   * * projects/{PROJECT_ID}
+   * * projects/{PROJECT_NUMBER}
+   * * folders/{FOLDER_NUMBER}
+   * * organizations/{ORGANIZATION_NUMBER}
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The scope. + */ + java.lang.String getScope(); + /** + * + * + *
+   * Required. A scope can be a project, a folder or an organization. The search
+   * is limited to the resources within the `scope`.
+   * The allowed values are:
+   * * projects/{PROJECT_ID}
+   * * projects/{PROJECT_NUMBER}
+   * * folders/{FOLDER_NUMBER}
+   * * organizations/{ORGANIZATION_NUMBER}
+   * 
+ * + * string scope = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for scope. + */ + com.google.protobuf.ByteString getScopeBytes(); + + /** + * + * + *
+   * Optional. The query statement. An empty query can be specified to search
+   * all the resources of certain `asset_types` within the given `scope`.
+   * Examples:
+   * * `name : "Important"` to find Cloud resources whose name contains
+   *   "Important" as a word.
+   * * `displayName : "Impor*"` to find Cloud resources whose display name
+   *   contains "Impor" as a word prefix.
+   * * `description : "*por*"` to find Cloud resources whose description
+   *   contains "por" as a substring.
+   * * `location : "us-west*"` to find Cloud resources whose location is
+   *   prefixed with "us-west".
+   * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+   *   a key or value.
+   * * `labels.env : "prod"` to find Cloud resources which have a label "env"
+   *   and its value is "prod".
+   * * `labels.env : *` to find Cloud resources which have a label "env".
+   * * `"Important"` to find Cloud resources which contain "Important" as a word
+   *   in any of the searchable fields.
+   * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+   *   in any of the searchable fields.
+   * * `"*por*"` to find Cloud resources which contain "por" as a substring in
+   *   any of the searchable fields.
+   * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+   *   resources which contain "Important" as a word in any of the searchable
+   *   fields and are also located in the "us-west1" region or the "global"
+   *   location.
+   * See [how to construct a
+   * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+   * for more details.
+   * 
+ * + * string query = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The query. + */ + java.lang.String getQuery(); + /** + * + * + *
+   * Optional. The query statement. An empty query can be specified to search
+   * all the resources of certain `asset_types` within the given `scope`.
+   * Examples:
+   * * `name : "Important"` to find Cloud resources whose name contains
+   *   "Important" as a word.
+   * * `displayName : "Impor*"` to find Cloud resources whose display name
+   *   contains "Impor" as a word prefix.
+   * * `description : "*por*"` to find Cloud resources whose description
+   *   contains "por" as a substring.
+   * * `location : "us-west*"` to find Cloud resources whose location is
+   *   prefixed with "us-west".
+   * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+   *   a key or value.
+   * * `labels.env : "prod"` to find Cloud resources which have a label "env"
+   *   and its value is "prod".
+   * * `labels.env : *` to find Cloud resources which have a label "env".
+   * * `"Important"` to find Cloud resources which contain "Important" as a word
+   *   in any of the searchable fields.
+   * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+   *   in any of the searchable fields.
+   * * `"*por*"` to find Cloud resources which contain "por" as a substring in
+   *   any of the searchable fields.
+   * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+   *   resources which contain "Important" as a word in any of the searchable
+   *   fields and are also located in the "us-west1" region or the "global"
+   *   location.
+   * See [how to construct a
+   * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+   * for more details.
+   * 
+ * + * 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 [searchable asset
+   * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+   * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+   * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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 [searchable asset
+   * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_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. Page size is capped
+   * at 500 even if a larger value is given. If set to zero, server will pick an
+   * appropriate default. Returned results may be fewer than requested. When
+   * this happens, there could be more results as long as `next_page_token` is
+   * returned.
+   * 
+ * + * 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(); + + /** + * + * + *
+   * Optional. A comma separated list of fields specifying the sorting order of
+   * the results. The default order is ascending. Add " DESC" after the field
+   * name to indicate descending order. Redundant space characters are ignored.
+   * Example: "location DESC, name". See [supported resource metadata
+   * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+   * for more details.
+   * 
+ * + * string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The orderBy. + */ + java.lang.String getOrderBy(); + /** + * + * + *
+   * Optional. A comma separated list of fields specifying the sorting order of
+   * the results. The default order is ascending. Add " DESC" after the field
+   * name to indicate descending order. Redundant space characters are ignored.
+   * Example: "location DESC, name". See [supported resource metadata
+   * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+   * for more details.
+   * 
+ * + * string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for orderBy. + */ + com.google.protobuf.ByteString getOrderByBytes(); +} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesResponse.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesResponse.java new file mode 100644 index 000000000..87eacbfe5 --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesResponse.java @@ -0,0 +1,1161 @@ +/* + * 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/v1/asset_service.proto + +package com.google.cloud.asset.v1; + +/** + * + * + *
+ * Search all resources response.
+ * 
+ * + * Protobuf type {@code google.cloud.asset.v1.SearchAllResourcesResponse} + */ +public final class SearchAllResourcesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.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(); + mutable_bitField0_ |= 0x00000001; + } + results_.add( + input.readMessage( + com.google.cloud.asset.v1.ResourceSearchResult.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.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.SearchAllResourcesResponse.class, + com.google.cloud.asset.v1.SearchAllResourcesResponse.Builder.class); + } + + public static final int RESULTS_FIELD_NUMBER = 1; + private java.util.List results_; + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public java.util.List getResultsList() { + return results_; + } + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public java.util.List + getResultsOrBuilderList() { + return results_; + } + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public int getResultsCount() { + return results_.size(); + } + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public com.google.cloud.asset.v1.ResourceSearchResult getResults(int index) { + return results_.get(index); + } + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public com.google.cloud.asset.v1.ResourceSearchResultOrBuilder 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.v1.SearchAllResourcesResponse)) { + return super.equals(obj); + } + com.google.cloud.asset.v1.SearchAllResourcesResponse other = + (com.google.cloud.asset.v1.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.v1.SearchAllResourcesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.asset.v1.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.v1.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.v1.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.v1.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.v1.SearchAllResourcesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.SearchAllResourcesResponse) + com.google.cloud.asset.v1.SearchAllResourcesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.asset.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.asset.v1.SearchAllResourcesResponse.class, + com.google.cloud.asset.v1.SearchAllResourcesResponse.Builder.class); + } + + // Construct using com.google.cloud.asset.v1.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.v1.AssetServiceProto + .internal_static_google_cloud_asset_v1_SearchAllResourcesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllResourcesResponse getDefaultInstanceForType() { + return com.google.cloud.asset.v1.SearchAllResourcesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllResourcesResponse build() { + com.google.cloud.asset.v1.SearchAllResourcesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.asset.v1.SearchAllResourcesResponse buildPartial() { + com.google.cloud.asset.v1.SearchAllResourcesResponse result = + new com.google.cloud.asset.v1.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.v1.SearchAllResourcesResponse) { + return mergeFrom((com.google.cloud.asset.v1.SearchAllResourcesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.asset.v1.SearchAllResourcesResponse other) { + if (other == com.google.cloud.asset.v1.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.v1.SearchAllResourcesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.asset.v1.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.v1.ResourceSearchResult, + com.google.cloud.asset.v1.ResourceSearchResult.Builder, + com.google.cloud.asset.v1.ResourceSearchResultOrBuilder> + resultsBuilder_; + + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public java.util.List getResultsList() { + if (resultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(results_); + } else { + return resultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public int getResultsCount() { + if (resultsBuilder_ == null) { + return results_.size(); + } else { + return resultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public com.google.cloud.asset.v1.ResourceSearchResult getResults(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public Builder setResults(int index, com.google.cloud.asset.v1.ResourceSearchResult 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 Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public Builder setResults( + int index, com.google.cloud.asset.v1.ResourceSearchResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.set(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public Builder addResults(com.google.cloud.asset.v1.ResourceSearchResult value) { + if (resultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResultsIsMutable(); + results_.add(value); + onChanged(); + } else { + resultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public Builder addResults(int index, com.google.cloud.asset.v1.ResourceSearchResult 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 Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public Builder addResults( + com.google.cloud.asset.v1.ResourceSearchResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public Builder addResults( + int index, com.google.cloud.asset.v1.ResourceSearchResult.Builder builderForValue) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.add(index, builderForValue.build()); + onChanged(); + } else { + resultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult 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 Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult 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 Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public Builder removeResults(int index) { + if (resultsBuilder_ == null) { + ensureResultsIsMutable(); + results_.remove(index); + onChanged(); + } else { + resultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public com.google.cloud.asset.v1.ResourceSearchResult.Builder getResultsBuilder(int index) { + return getResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public com.google.cloud.asset.v1.ResourceSearchResultOrBuilder getResultsOrBuilder(int index) { + if (resultsBuilder_ == null) { + return results_.get(index); + } else { + return resultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public java.util.List + getResultsOrBuilderList() { + if (resultsBuilder_ != null) { + return resultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(results_); + } + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public com.google.cloud.asset.v1.ResourceSearchResult.Builder addResultsBuilder() { + return getResultsFieldBuilder() + .addBuilder(com.google.cloud.asset.v1.ResourceSearchResult.getDefaultInstance()); + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public com.google.cloud.asset.v1.ResourceSearchResult.Builder addResultsBuilder(int index) { + return getResultsFieldBuilder() + .addBuilder(index, com.google.cloud.asset.v1.ResourceSearchResult.getDefaultInstance()); + } + /** + * + * + *
+     * A list of Resources that match the search query. It contains the resource
+     * standard metadata information.
+     * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + public java.util.List + getResultsBuilderList() { + return getResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1.ResourceSearchResult, + com.google.cloud.asset.v1.ResourceSearchResult.Builder, + com.google.cloud.asset.v1.ResourceSearchResultOrBuilder> + getResultsFieldBuilder() { + if (resultsBuilder_ == null) { + resultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.asset.v1.ResourceSearchResult, + com.google.cloud.asset.v1.ResourceSearchResult.Builder, + com.google.cloud.asset.v1.ResourceSearchResultOrBuilder>( + 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.v1.SearchAllResourcesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.SearchAllResourcesResponse) + private static final com.google.cloud.asset.v1.SearchAllResourcesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.asset.v1.SearchAllResourcesResponse(); + } + + public static com.google.cloud.asset.v1.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.v1.SearchAllResourcesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesResponseOrBuilder.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesResponseOrBuilder.java new file mode 100644 index 000000000..2a0215998 --- /dev/null +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/SearchAllResourcesResponseOrBuilder.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/v1/asset_service.proto + +package com.google.cloud.asset.v1; + +public interface SearchAllResourcesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.SearchAllResourcesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + java.util.List getResultsList(); + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + com.google.cloud.asset.v1.ResourceSearchResult getResults(int index); + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + int getResultsCount(); + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + java.util.List + getResultsOrBuilderList(); + /** + * + * + *
+   * A list of Resources that match the search query. It contains the resource
+   * standard metadata information.
+   * 
+ * + * repeated .google.cloud.asset.v1.ResourceSearchResult results = 1; + */ + com.google.cloud.asset.v1.ResourceSearchResultOrBuilder 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-v1/src/main/java/com/google/cloud/asset/v1/UpdateFeedRequest.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/UpdateFeedRequest.java index b77577098..8c75e48f0 100644 --- a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/UpdateFeedRequest.java +++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/UpdateFeedRequest.java @@ -137,8 +137,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * * *
-   * Required. The new values of feed details. It must match an existing feed and the
-   * field `name` must be in the format of:
+   * Required. The new values of feed details. It must match an existing feed
+   * and the field `name` must be in the format of:
    * projects/project_number/feeds/feed_id or
    * folders/folder_number/feeds/feed_id or
    * organizations/organization_number/feeds/feed_id.
@@ -155,8 +155,8 @@ public boolean hasFeed() {
    *
    *
    * 
-   * Required. The new values of feed details. It must match an existing feed and the
-   * field `name` must be in the format of:
+   * Required. The new values of feed details. It must match an existing feed
+   * and the field `name` must be in the format of:
    * projects/project_number/feeds/feed_id or
    * folders/folder_number/feeds/feed_id or
    * organizations/organization_number/feeds/feed_id.
@@ -173,8 +173,8 @@ public com.google.cloud.asset.v1.Feed getFeed() {
    *
    *
    * 
-   * Required. The new values of feed details. It must match an existing feed and the
-   * field `name` must be in the format of:
+   * Required. The new values of feed details. It must match an existing feed
+   * and the field `name` must be in the format of:
    * projects/project_number/feeds/feed_id or
    * folders/folder_number/feeds/feed_id or
    * organizations/organization_number/feeds/feed_id.
@@ -604,8 +604,8 @@ public Builder mergeFrom(
      *
      *
      * 
-     * Required. The new values of feed details. It must match an existing feed and the
-     * field `name` must be in the format of:
+     * Required. The new values of feed details. It must match an existing feed
+     * and the field `name` must be in the format of:
      * projects/project_number/feeds/feed_id or
      * folders/folder_number/feeds/feed_id or
      * organizations/organization_number/feeds/feed_id.
@@ -622,8 +622,8 @@ public boolean hasFeed() {
      *
      *
      * 
-     * Required. The new values of feed details. It must match an existing feed and the
-     * field `name` must be in the format of:
+     * Required. The new values of feed details. It must match an existing feed
+     * and the field `name` must be in the format of:
      * projects/project_number/feeds/feed_id or
      * folders/folder_number/feeds/feed_id or
      * organizations/organization_number/feeds/feed_id.
@@ -644,8 +644,8 @@ public com.google.cloud.asset.v1.Feed getFeed() {
      *
      *
      * 
-     * Required. The new values of feed details. It must match an existing feed and the
-     * field `name` must be in the format of:
+     * Required. The new values of feed details. It must match an existing feed
+     * and the field `name` must be in the format of:
      * projects/project_number/feeds/feed_id or
      * folders/folder_number/feeds/feed_id or
      * organizations/organization_number/feeds/feed_id.
@@ -670,8 +670,8 @@ public Builder setFeed(com.google.cloud.asset.v1.Feed value) {
      *
      *
      * 
-     * Required. The new values of feed details. It must match an existing feed and the
-     * field `name` must be in the format of:
+     * Required. The new values of feed details. It must match an existing feed
+     * and the field `name` must be in the format of:
      * projects/project_number/feeds/feed_id or
      * folders/folder_number/feeds/feed_id or
      * organizations/organization_number/feeds/feed_id.
@@ -693,8 +693,8 @@ public Builder setFeed(com.google.cloud.asset.v1.Feed.Builder builderForValue) {
      *
      *
      * 
-     * Required. The new values of feed details. It must match an existing feed and the
-     * field `name` must be in the format of:
+     * Required. The new values of feed details. It must match an existing feed
+     * and the field `name` must be in the format of:
      * projects/project_number/feeds/feed_id or
      * folders/folder_number/feeds/feed_id or
      * organizations/organization_number/feeds/feed_id.
@@ -720,8 +720,8 @@ public Builder mergeFeed(com.google.cloud.asset.v1.Feed value) {
      *
      *
      * 
-     * Required. The new values of feed details. It must match an existing feed and the
-     * field `name` must be in the format of:
+     * Required. The new values of feed details. It must match an existing feed
+     * and the field `name` must be in the format of:
      * projects/project_number/feeds/feed_id or
      * folders/folder_number/feeds/feed_id or
      * organizations/organization_number/feeds/feed_id.
@@ -744,8 +744,8 @@ public Builder clearFeed() {
      *
      *
      * 
-     * Required. The new values of feed details. It must match an existing feed and the
-     * field `name` must be in the format of:
+     * Required. The new values of feed details. It must match an existing feed
+     * and the field `name` must be in the format of:
      * projects/project_number/feeds/feed_id or
      * folders/folder_number/feeds/feed_id or
      * organizations/organization_number/feeds/feed_id.
@@ -762,8 +762,8 @@ public com.google.cloud.asset.v1.Feed.Builder getFeedBuilder() {
      *
      *
      * 
-     * Required. The new values of feed details. It must match an existing feed and the
-     * field `name` must be in the format of:
+     * Required. The new values of feed details. It must match an existing feed
+     * and the field `name` must be in the format of:
      * projects/project_number/feeds/feed_id or
      * folders/folder_number/feeds/feed_id or
      * organizations/organization_number/feeds/feed_id.
@@ -782,8 +782,8 @@ public com.google.cloud.asset.v1.FeedOrBuilder getFeedOrBuilder() {
      *
      *
      * 
-     * Required. The new values of feed details. It must match an existing feed and the
-     * field `name` must be in the format of:
+     * Required. The new values of feed details. It must match an existing feed
+     * and the field `name` must be in the format of:
      * projects/project_number/feeds/feed_id or
      * folders/folder_number/feeds/feed_id or
      * organizations/organization_number/feeds/feed_id.
diff --git a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/UpdateFeedRequestOrBuilder.java b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/UpdateFeedRequestOrBuilder.java
index fe7ebbc66..d6cac469d 100644
--- a/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/UpdateFeedRequestOrBuilder.java
+++ b/proto-google-cloud-asset-v1/src/main/java/com/google/cloud/asset/v1/UpdateFeedRequestOrBuilder.java
@@ -27,8 +27,8 @@ public interface UpdateFeedRequestOrBuilder
    *
    *
    * 
-   * Required. The new values of feed details. It must match an existing feed and the
-   * field `name` must be in the format of:
+   * Required. The new values of feed details. It must match an existing feed
+   * and the field `name` must be in the format of:
    * projects/project_number/feeds/feed_id or
    * folders/folder_number/feeds/feed_id or
    * organizations/organization_number/feeds/feed_id.
@@ -43,8 +43,8 @@ public interface UpdateFeedRequestOrBuilder
    *
    *
    * 
-   * Required. The new values of feed details. It must match an existing feed and the
-   * field `name` must be in the format of:
+   * Required. The new values of feed details. It must match an existing feed
+   * and the field `name` must be in the format of:
    * projects/project_number/feeds/feed_id or
    * folders/folder_number/feeds/feed_id or
    * organizations/organization_number/feeds/feed_id.
@@ -59,8 +59,8 @@ public interface UpdateFeedRequestOrBuilder
    *
    *
    * 
-   * Required. The new values of feed details. It must match an existing feed and the
-   * field `name` must be in the format of:
+   * Required. The new values of feed details. It must match an existing feed
+   * and the field `name` must be in the format of:
    * projects/project_number/feeds/feed_id or
    * folders/folder_number/feeds/feed_id or
    * organizations/organization_number/feeds/feed_id.
diff --git a/proto-google-cloud-asset-v1/src/main/proto/google/cloud/asset/v1/asset_service.proto b/proto-google-cloud-asset-v1/src/main/proto/google/cloud/asset/v1/asset_service.proto
index 9c7b16d03..0eab6efdd 100644
--- a/proto-google-cloud-asset-v1/src/main/proto/google/cloud/asset/v1/asset_service.proto
+++ b/proto-google-cloud-asset-v1/src/main/proto/google/cloud/asset/v1/asset_service.proto
@@ -37,12 +37,14 @@ option php_namespace = "Google\\Cloud\\Asset\\V1";
 // 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";
+  option (google.api.oauth_scopes) =
+      "https://www.googleapis.com/auth/cloud-platform";
 
   // Exports assets with time and resource types to a given Cloud Storage
   // location. The output format is newline-delimited JSON.
-  // This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
-  // to keep track of the export.
+  // This API implements the
+  // [google.longrunning.Operation][google.longrunning.Operation] API allowing
+  // you to keep track of the export.
   rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) {
     option (google.api.http) = {
       post: "/v1/{parent=*/*}:exportAssets"
@@ -61,7 +63,8 @@ service AssetService {
   // attached IAM POLICY both exist. This can create gaps in the output history.
   // If a specified asset does not exist, this API returns an INVALID_ARGUMENT
   // error.
-  rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) returns (BatchGetAssetsHistoryResponse) {
+  rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest)
+      returns (BatchGetAssetsHistoryResponse) {
     option (google.api.http) = {
       get: "/v1/{parent=*/*}:batchGetAssetsHistory"
     };
@@ -109,6 +112,30 @@ service AssetService {
     };
     option (google.api.method_signature) = "name";
   }
+
+  // Searches all the resources within the given accessible scope (e.g., a
+  // project, a folder or an organization). Callers should have
+  // cloud.assets.SearchAllResources permission upon the requested scope,
+  // otherwise the request will be rejected.
+  rpc SearchAllResources(SearchAllResourcesRequest)
+      returns (SearchAllResourcesResponse) {
+    option (google.api.http) = {
+      get: "/v1/{scope=*/*}:searchAllResources"
+    };
+    option (google.api.method_signature) = "scope,query,asset_types";
+  }
+
+  // Searches all the IAM policies within the given accessible scope (e.g., a
+  // project, a folder or an organization). Callers should have
+  // cloud.assets.SearchAllIamPolicies permission upon the requested scope,
+  // otherwise the request will be rejected.
+  rpc SearchAllIamPolicies(SearchAllIamPoliciesRequest)
+      returns (SearchAllIamPoliciesResponse) {
+    option (google.api.http) = {
+      get: "/v1/{scope=*/*}:searchAllIamPolicies"
+    };
+    option (google.api.method_signature) = "scope,query";
+  }
 }
 
 // Export asset request.
@@ -148,8 +175,10 @@ message ExportAssetsRequest {
 }
 
 // The export asset response. This message is returned by the
-// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned
-// [google.longrunning.Operation.response][google.longrunning.Operation.response] field.
+// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation]
+// method in the returned
+// [google.longrunning.Operation.response][google.longrunning.Operation.response]
+// field.
 message ExportAssetsResponse {
   // Time the snapshot was taken.
   google.protobuf.Timestamp read_time = 1;
@@ -214,9 +243,8 @@ message CreateFeedRequest {
   // be unique under a specific parent project/folder/organization.
   string feed_id = 2 [(google.api.field_behavior) = REQUIRED];
 
-  // Required. The feed details. The field `name` must be empty and it will be generated
-  // in the format of:
-  // projects/project_number/feeds/feed_id
+  // Required. The feed details. The field `name` must be empty and it will be
+  // generated in the format of: projects/project_number/feeds/feed_id
   // folders/folder_number/feeds/feed_id
   // organizations/organization_number/feeds/feed_id
   Feed feed = 3 [(google.api.field_behavior) = REQUIRED];
@@ -230,9 +258,7 @@ message GetFeedRequest {
   // organizations/organization_number/feeds/feed_id
   string name = 1 [
     (google.api.field_behavior) = REQUIRED,
-    (google.api.resource_reference) = {
-      type: "cloudasset.googleapis.com/Feed"
-    }
+    (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" }
   ];
 }
 
@@ -251,8 +277,8 @@ message ListFeedsResponse {
 
 // Update asset feed request.
 message UpdateFeedRequest {
-  // Required. The new values of feed details. It must match an existing feed and the
-  // field `name` must be in the format of:
+  // Required. The new values of feed details. It must match an existing feed
+  // and the field `name` must be in the format of:
   // projects/project_number/feeds/feed_id or
   // folders/folder_number/feeds/feed_id or
   // organizations/organization_number/feeds/feed_id.
@@ -261,7 +287,8 @@ message UpdateFeedRequest {
   // Required. Only updates the `feed` fields indicated by this mask.
   // The field mask must not be empty, and it must not contain fields that
   // are immutable or only set by the server.
-  google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
+  google.protobuf.FieldMask update_mask = 2
+      [(google.api.field_behavior) = REQUIRED];
 }
 
 message DeleteFeedRequest {
@@ -271,9 +298,7 @@ message DeleteFeedRequest {
   // organizations/organization_number/feeds/feed_id
   string name = 1 [
     (google.api.field_behavior) = REQUIRED,
-    (google.api.resource_reference) = {
-      type: "cloudasset.googleapis.com/Feed"
-    }
+    (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" }
   ];
 }
 
@@ -401,7 +426,156 @@ message Feed {
 
   // Required. Feed output configuration defining where the asset updates are
   // published to.
-  FeedOutputConfig feed_output_config = 5 [(google.api.field_behavior) = REQUIRED];
+  FeedOutputConfig feed_output_config = 5
+      [(google.api.field_behavior) = REQUIRED];
+}
+
+// Search all resources request.
+message SearchAllResourcesRequest {
+  // Required. A scope can be a project, a folder or an organization. The search
+  // is limited to the resources within the `scope`.
+  //
+  // The allowed values are:
+  //
+  // * projects/{PROJECT_ID}
+  // * projects/{PROJECT_NUMBER}
+  // * folders/{FOLDER_NUMBER}
+  // * organizations/{ORGANIZATION_NUMBER}
+  string scope = 1 [(google.api.field_behavior) = REQUIRED];
+
+  // Optional. The query statement. An empty query can be specified to search
+  // all the resources of certain `asset_types` within the given `scope`.
+  //
+  // Examples:
+  //
+  // * `name : "Important"` to find Cloud resources whose name contains
+  //   "Important" as a word.
+  // * `displayName : "Impor*"` to find Cloud resources whose display name
+  //   contains "Impor" as a word prefix.
+  // * `description : "*por*"` to find Cloud resources whose description
+  //   contains "por" as a substring.
+  // * `location : "us-west*"` to find Cloud resources whose location is
+  //   prefixed with "us-west".
+  // * `labels : "prod"` to find Cloud resources whose labels contain "prod" as
+  //   a key or value.
+  // * `labels.env : "prod"` to find Cloud resources which have a label "env"
+  //   and its value is "prod".
+  // * `labels.env : *` to find Cloud resources which have a label "env".
+  // * `"Important"` to find Cloud resources which contain "Important" as a word
+  //   in any of the searchable fields.
+  // * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix
+  //   in any of the searchable fields.
+  // * `"*por*"` to find Cloud resources which contain "por" as a substring in
+  //   any of the searchable fields.
+  // * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud
+  //   resources which contain "Important" as a word in any of the searchable
+  //   fields and are also located in the "us-west1" region or the "global"
+  //   location.
+  //
+  // See [how to construct a
+  // query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
+  // for more details.
+  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 [searchable asset
+  // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types).
+  repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL];
+
+  // Optional. The page size for search result pagination. Page size is capped
+  // at 500 even if a larger value is given. If set to zero, server will pick an
+  // appropriate default. Returned results may be fewer than requested. When
+  // this happens, there could be more results as long as `next_page_token` is
+  // returned.
+  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];
+
+  // Optional. A comma separated list of fields specifying the sorting order of
+  // the results. The default order is ascending. Add " DESC" after the field
+  // name to indicate descending order. Redundant space characters are ignored.
+  // Example: "location DESC, name". See [supported resource metadata
+  // fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields)
+  // for more details.
+  string order_by = 6 [(google.api.field_behavior) = OPTIONAL];
+}
+
+// Search all resources response.
+message SearchAllResourcesResponse {
+  // A list of Resources that match the search query. It contains the resource
+  // standard metadata information.
+  repeated ResourceSearchResult 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. A scope can be a project, a folder or an organization. The search
+  // is limited to the IAM policies within the `scope`.
+  //
+  // The allowed values are:
+  //
+  // * projects/{PROJECT_ID}
+  // * projects/{PROJECT_NUMBER}
+  // * folders/{FOLDER_NUMBER}
+  // * organizations/{ORGANIZATION_NUMBER}
+  string scope = 1 [(google.api.field_behavior) = REQUIRED];
+
+  // Optional. The query statement. An empty query can be specified to search
+  // all the IAM policies within the given `scope`.
+  //
+  // Examples:
+  //
+  // * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that
+  //   specify user "amy@gmail.com".
+  // * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that
+  //   specify the Compute Admin role.
+  // * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM
+  //   policy bindings that specify a role containing "storage.buckets.update"
+  //   permission.
+  // * `resource : "organizations/123"` to find Cloud IAM policy bindings that
+  //   are set on "organizations/123".
+  // * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")`
+  //   to find Cloud IAM policy bindings that are set on "organizations/123" or
+  //   "folders/1234", and also specify user "amy".
+  //
+  // See [how to construct a
+  // query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
+  // for more details.
+  string query = 2 [(google.api.field_behavior) = OPTIONAL];
+
+  // Optional. The page size for search result pagination. Page size is capped
+  // at 500 even if a larger value is given. If set to zero, server will pick an
+  // appropriate default. Returned results may be fewer than requested. When
+  // this happens, there could be more results as long as `next_page_token` is
+  // returned.
+  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;
 }
 
 // Asset content type.
diff --git a/proto-google-cloud-asset-v1/src/main/proto/google/cloud/asset/v1/assets.proto b/proto-google-cloud-asset-v1/src/main/proto/google/cloud/asset/v1/assets.proto
index 1e8b40a11..4e537d5ce 100644
--- a/proto-google-cloud-asset-v1/src/main/proto/google/cloud/asset/v1/assets.proto
+++ b/proto-google-cloud-asset-v1/src/main/proto/google/cloud/asset/v1/assets.proto
@@ -16,6 +16,7 @@ syntax = "proto3";
 
 package google.cloud.asset.v1;
 
+import "google/api/annotations.proto";
 import "google/api/resource.proto";
 import "google/cloud/orgpolicy/v1/orgpolicy.proto";
 import "google/iam/v1/policy.proto";
@@ -25,7 +26,6 @@ import "google/identity/accesscontextmanager/v1/service_perimeter.proto";
 import "google/protobuf/any.proto";
 import "google/protobuf/struct.proto";
 import "google/protobuf/timestamp.proto";
-import "google/api/annotations.proto";
 
 option cc_enable_arenas = true;
 option csharp_namespace = "Google.Cloud.Asset.V1";
@@ -111,7 +111,8 @@ message Asset {
 
     google.identity.accesscontextmanager.v1.AccessLevel access_level = 8;
 
-    google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = 9;
+    google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter =
+        9;
   }
 
   // The ancestry path of an asset in Google Cloud [resource
@@ -169,4 +170,163 @@ message Resource {
   // The content of the resource, in which some sensitive fields are removed
   // and may not be present.
   google.protobuf.Struct data = 6;
+
+  // The location of the resource in Google Cloud, such as its zone and region.
+  // For more information, see https://cloud.google.com/about/locations/.
+  string location = 8;
+}
+
+// A result of Resource Search, containing information of a cloud resoure.
+message ResourceSearchResult {
+  // The full resource name of this resource. Example:
+  // "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+  // See [Cloud Asset Inventory Resource Name
+  // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+  // for more information.
+  //
+  // To search against the `name`:
+  //
+  // * use a field query. Example: `name : "instance1"`
+  // * use a free text query. Example: `"instance1"`
+  string name = 1;
+
+  // The type of this resource. Example: "compute.googleapis.com/Disk".
+  //
+  // To search against the `asset_type`:
+  //
+  // * specify the `asset_type` field in your search request.
+  string asset_type = 2;
+
+  // The project that this resource belongs to, in the form of
+  // projects/{PROJECT_NUMBER}.
+  //
+  // To search against the `project`:
+  //
+  // * specify the `scope` field as this project in your search request.
+  string project = 3;
+
+  // The display name of this resource.
+  //
+  // To search against the `display_name`:
+  //
+  // * use a field query. Example: `displayName : "My Instance"`
+  // * use a free text query. Example: `"My Instance"`
+  string display_name = 4;
+
+  // One or more paragraphs of text description of this resource. Maximum length
+  // could be up to 1M bytes.
+  //
+  // To search against the `description`:
+  //
+  // * use a field query. Example: `description : "*important instance*"`
+  // * use a free text query. Example: `"*important instance*"`
+  string description = 5;
+
+  // Location can be "global", regional like "us-east1", or zonal like
+  // "us-west1-b".
+  //
+  // To search against the `location`:
+  //
+  // * use a field query. Example: `location : "us-west*"`
+  // * use a free text query. Example: `"us-west*"`
+  string location = 6;
+
+  // Labels associated with this resource. See [Labelling and grouping GCP
+  // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+  // for more information.
+  //
+  // To search against the `labels`:
+  //
+  // * use a field query, as following:
+  //     - query on any label's key or value. Example: `labels : "prod"`
+  //     - query by a given label. Example: `labels.env : "prod"`
+  //     - query by a given label'sexistence. Example: `labels.env : *`
+  // * use a free text query. Example: `"prod"`
+  map labels = 7;
+
+  // Network tags associated with this resource. Like labels, network tags are a
+  // type of annotations used to group GCP resources. See [Labelling GCP
+  // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
+  // for more information.
+  //
+  // To search against the `network_tags`:
+  //
+  // * use a field query. Example: `networkTags : "internal"`
+  // * use a free text query. Example: `"internal"`
+  repeated string network_tags = 8;
+
+  // The additional attributes of this resource. The attributes may vary from
+  // one resource type to another. Examples: "projectId" for Project,
+  // "dnsName" for DNS ManagedZone.
+  //
+  // To search against the `additional_attributes`:
+  //
+  // * use a free text query to match the attributes values. Example: to search
+  //   additional_attributes = { dnsName: "foobar" }, you can issue a query
+  //   `"foobar"`.
+  google.protobuf.Struct additional_attributes = 9;
+}
+
+// A result of IAM Policy search, containing information of an IAM policy.
+message IamPolicySearchResult {
+  // Explanation about the IAM policy search result.
+  message Explanation {
+    // IAM permissions
+    message Permissions {
+      // A list of permissions. A sample permission string: "compute.disk.get".
+      repeated string permissions = 1;
+    }
+
+    // The map from roles to their included permissions that match the
+    // permission query (i.e., a query containing `policy.role.permissions:`).
+    // Example: if query `policy.role.permissions : "compute.disk.get"`
+    // matches a policy binding that contains owner role, the
+    // matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The
+    // roles can also be found in the returned `policy` bindings. Note that the
+    // map is populated only for requests with permission queries.
+    map matched_permissions = 1;
+  }
+
+  // The full resource name of the resource associated with this IAM policy.
+  // Example:
+  // "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1".
+  // See [Cloud Asset Inventory Resource Name
+  // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
+  // for more information.
+  //
+  // To search against the `resource`:
+  //
+  // * use a field query. Example: `resource : "organizations/123"`
+  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.
+  //
+  // To search against the `project`:
+  //
+  // * specify the `scope` field as this project in your search request.
+  string project = 2;
+
+  // The IAM policy directly set on the given resource. Note that the original
+  // IAM policy can contain multiple bindings. This only contains the bindings
+  // that match the given query. For queries that don't contain a constrain on
+  // policies (e.g., an empty query), this contains all the bindings.
+  //
+  // To search against the `policy` bindings:
+  //
+  // * use a field query, as following:
+  //     - query by the policy contained members. Example:
+  //       `policy : "amy@gmail.com"`
+  //     - query by the policy contained roles. Example:
+  //       `policy : "roles/compute.admin"`
+  //     - query by the policy contained roles' implied permissions. Example:
+  //       `policy.role.permissions : "compute.instances.create"`
+  google.iam.v1.Policy policy = 3;
+
+  // Explanation about the IAM policy search result. It contains additional
+  // information to explain why the search result matches the query.
+  Explanation explanation = 4;
 }
diff --git a/synth.metadata b/synth.metadata
index 71f3775c3..6d902bf06 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -11,40 +11,40 @@
       "git": {
         "name": "googleapis",
         "remote": "https://github.com/googleapis/googleapis.git",
-        "sha": "e0f9d9e1f9de890db765be46f45ca8490723e3eb",
-        "internalRef": "309824146"
+        "sha": "2433bd50656264a2ef9f684bf646fb4d250d39ff",
+        "internalRef": "311601348"
       }
     },
     {
       "git": {
         "name": "googleapis",
         "remote": "https://github.com/googleapis/googleapis.git",
-        "sha": "e0f9d9e1f9de890db765be46f45ca8490723e3eb",
-        "internalRef": "309824146"
+        "sha": "2433bd50656264a2ef9f684bf646fb4d250d39ff",
+        "internalRef": "311601348"
       }
     },
     {
       "git": {
         "name": "googleapis",
         "remote": "https://github.com/googleapis/googleapis.git",
-        "sha": "e0f9d9e1f9de890db765be46f45ca8490723e3eb",
-        "internalRef": "309824146"
+        "sha": "2433bd50656264a2ef9f684bf646fb4d250d39ff",
+        "internalRef": "311601348"
       }
     },
     {
       "git": {
         "name": "googleapis",
         "remote": "https://github.com/googleapis/googleapis.git",
-        "sha": "e0f9d9e1f9de890db765be46f45ca8490723e3eb",
-        "internalRef": "309824146"
+        "sha": "2433bd50656264a2ef9f684bf646fb4d250d39ff",
+        "internalRef": "311601348"
       }
     },
     {
       "git": {
         "name": "googleapis",
         "remote": "https://github.com/googleapis/googleapis.git",
-        "sha": "e0f9d9e1f9de890db765be46f45ca8490723e3eb",
-        "internalRef": "309824146"
+        "sha": "2433bd50656264a2ef9f684bf646fb4d250d39ff",
+        "internalRef": "311601348"
       }
     },
     {